* Struggling with ConTeXt
@ 2012-08-02 15:29 Olivier Binda
2012-08-02 15:43 ` Aditya Mahajan
0 siblings, 1 reply; 13+ messages in thread
From: Olivier Binda @ 2012-08-02 15:29 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 2904 bytes --]
Hello
I'm trying to port a big 300+ pages math course full of macros from
plain XeTEX to ConTeXt mark IV (ubuntu 12.04+ stand alone beta)
and I'm having some difficulties, could you please help ?
My questions :
1) does lxml.att("#1","some tag") really work ?
the next snipet doesn't work for me:
\startluacode
function set(node)
p = lxml.att(node,"p") -- or p = lxml.att(lxml.id(node),"p")
end
\stopluacode
\startxmlsetups xml:section
\ctxlua{set("#1")}
\stopxmlsetups
it looks like it returns the p attribute of the node before #1
the following snipet works though (which is strange because I looked in
the context source and it gives
\def\xmlatt#1#2{\ctxlua{lxml.att("#1","#2")}}...)
\startxmlsetups xml:section
\ctxlua{p = \xmlatt{"#1","p"}}
\stopxmlsetups
2) I'm trying to export to xml and have set
\setupbackend[export=yes, xhtml=yes, css=mkiv-export.css]
But
a) my Metafun/Tikz pictures aren't exported to svg :/
b) the exported xml has namespaces problems (like error on line 63 at
column 20: Namespace prefix m on math is not defined error on line 64 at
column 22: Namespace prefix m on mrow is not defined)
What am I doing wrong ? (I'm compiling with "context mydoc.tex")
Is there some \csname tex4ht\endcsname command or some other directive
that I should use to get my xml export right ?
Am I missing some namespace commands (there are lots of m:math and
m:mrow mathml tags int the exported xml source, this smells like a
tex4ht issue)
3) I have defined some framed text with metafun overlays (like in the
Context manual)
and I'm trying to type something like
\inmargin{some label}
\startMyFramedText...\stopMyFramedText
Yet, the text in the margin is after the framed text :(
(fiddling with the "location" setting (low, ..) doesn't allow me to have
the in margin text right next the top of the framed text
I somehow found a dirty workaround with typing a blank space
\defineframedtext[Property][frame=off,background=OverlayProperty,before={}]
and
\inmargin{some label}\noindent\startMyFramedText...\stopMyFramedText
but it's not really satisfying. (hate to lose vertical space with
wandering blank spaces)
Is there a better way ?
4) I'm trying to port the following TeX code to ConTeXt
$$\eqalign{x&=1\cr y&=2\cr}\qquad \hbox{haha}$$
it looks like \startformula\startalign.. doesn't allow me to do that
I somehow managed to have it by typing
\startformula
\vcenter{\starttabular[|rM|lM|]
\NC x \NC =1\NC\NR
\NC y \NC =2\NC\NR
\stoptabular}\qquad\text{haha}
\stopformula
the pdf export is fine, but the xml export is awfull (because of
\vcenter I guess)
a) Is there a way to use tables inside math mode alongside other stuff
(would be handy) ?
b) what is the correct way to type the previous text, so the pdf and xml
are fine in Context ?
Best regards
Olivier... really enjoying utf, xml, lua inside TeX as well as other
nice ConTeXt features
[-- Attachment #1.2: Type: text/html, Size: 5609 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-02 15:29 Struggling with ConTeXt Olivier Binda
@ 2012-08-02 15:43 ` Aditya Mahajan
2012-08-02 15:47 ` Aditya Mahajan
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Aditya Mahajan @ 2012-08-02 15:43 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Thu, 2 Aug 2012, Olivier Binda wrote:
> 1) does lxml.att("#1","some tag") really work ?
I don't know, but please provide a complete minimal example.
> 2) I'm trying to export to xml and have set
>
> \setupbackend[export=yes, xhtml=yes, css=mkiv-export.css]
>
> But
> a) my Metafun/Tikz pictures aren't exported to svg :/
Currently ConTeXt does not export Metafun/Tikz pictures to svg.
> b) the exported xml has namespaces problems (like error on line 63 at column
> 20: Namespace prefix m on math is not defined error on line 64 at column 22:
> Namespace prefix m on mrow is not defined)
>
> What am I doing wrong ? (I'm compiling with "context mydoc.tex")
Could it be a validator error? The 11th line of my test document contains:
<document xmlns:m="http://www.w3.org/1998/Math/MathML"
which defines the 'm' namespace.
> Is there some \csname tex4ht\endcsname command or some other directive that I
> should use to get my xml export right ?
ConTeXt does not use tex4ht!
> Am I missing some namespace commands (there are lots of m:math and m:mrow
> mathml tags int the exported xml source, this smells like a tex4ht issue)
>
See above.
> 3) I have defined some framed text with metafun overlays (like in the Context
> manual)
> and I'm trying to type something like
>
> but it's not really satisfying. (hate to lose vertical space with wandering
> blank spaces)
>
> Is there a better way ?
Please provide a complete minimal example.
> 4) I'm trying to port the following TeX code to ConTeXt
>
> $$\eqalign{x&=1\cr y&=2\cr}\qquad \hbox{haha}$$
>
> it looks like \startformula\startalign.. doesn't allow me to do that
> I somehow managed to have it by typing
>
> \startformula
> \vcenter{\starttabular[|rM|lM|]
> \NC x \NC =1\NC\NR
> \NC y \NC =2\NC\NR
> \stoptabular}\qquad\text{haha}
> \stopformula
>
> the pdf export is fine, but the xml export is awfull (because of \vcenter I
> guess)
>
> a) Is there a way to use tables inside math mode alongside other stuff (would
> be handy) ?
> b) what is the correct way to type the previous text, so the pdf and xml are
> fine in Context ?
Why not use \startmathalign etc. See:
http://dl.contextgarden.net/myway/mathalign.pdf
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-02 15:43 ` Aditya Mahajan
@ 2012-08-02 15:47 ` Aditya Mahajan
2012-08-03 6:35 ` Olivier Binda
2012-08-20 22:27 ` Olivier Binda
2 siblings, 0 replies; 13+ messages in thread
From: Aditya Mahajan @ 2012-08-02 15:47 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Thu, 2 Aug 2012, Aditya Mahajan wrote:
>> 4) I'm trying to port the following TeX code to ConTeXt
>>
>> $$\eqalign{x&=1\cr y&=2\cr}\qquad \hbox{haha}$$
>>
>> it looks like \startformula\startalign.. doesn't allow me to do that
>> I somehow managed to have it by typing
>>
>> \startformula
>> \vcenter{\starttabular[|rM|lM|]
>> \NC x \NC =1\NC\NR
>> \NC y \NC =2\NC\NR
>> \stoptabular}\qquad\text{haha}
>> \stopformula
>>
>> the pdf export is fine, but the xml export is awfull (because of \vcenter I
>> guess)
>>
>> a) Is there a way to use tables inside math mode alongside other stuff
>> (would be handy) ?
>> b) what is the correct way to type the previous text, so the pdf and xml
>> are fine in Context ?
>
> Why not use \startmathalign etc. See:
>
> http://dl.contextgarden.net/myway/mathalign.pdf
Sorry, I meant, \startmathmatrix (or \startmatrix) etc.
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-02 15:43 ` Aditya Mahajan
2012-08-02 15:47 ` Aditya Mahajan
@ 2012-08-03 6:35 ` Olivier Binda
2012-08-03 10:10 ` Hans Hagen
2012-08-20 22:27 ` Olivier Binda
2 siblings, 1 reply; 13+ messages in thread
From: Olivier Binda @ 2012-08-03 6:35 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 02/08/2012 17:43, Aditya Mahajan wrote:
> On Thu, 2 Aug 2012, Olivier Binda wrote:
>
>> 1) does lxml.att("#1","some tag") really work ?
>
> I don't know, but please provide a complete minimal example.
\startxmlsetups xml:test
\xmlsetsetup{maths}{c}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:test}
\startxmlsetups xml:c
\ctxlua{
title = "test="..lxml.att("#1","title")
context(title)}%
\stopxmlsetups
\starttext
test : \xmlprocessdata {maths}{<?xml version='1.0' standalone='yes?><c
title="My title"></c>} {}
\stoptext
\endinput
Context gives the "can't concatenate with a nil value" Luatex error
when processing this snipet...but if I ignore the error, the pdf output
is okey
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-03 6:35 ` Olivier Binda
@ 2012-08-03 10:10 ` Hans Hagen
2012-08-03 14:50 ` Sietse Brouwer
0 siblings, 1 reply; 13+ messages in thread
From: Hans Hagen @ 2012-08-03 10:10 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 3-8-2012 08:35, Olivier Binda wrote:
> On 02/08/2012 17:43, Aditya Mahajan wrote:
>> On Thu, 2 Aug 2012, Olivier Binda wrote:
>>
>>> 1) does lxml.att("#1","some tag") really work ?
>>
>> I don't know, but please provide a complete minimal example.
> \startxmlsetups xml:test
> \xmlsetsetup{maths}{c}{xml:*}
> \stopxmlsetups
> \xmlregistersetup{xml:test}
> \startxmlsetups xml:c
> \ctxlua{
> title = "test="..lxml.att("#1","title")
> context(title)}%
> \stopxmlsetups
>
> \starttext
> test : \xmlprocessdata {maths}{<?xml version='1.0' standalone='yes?><c
> title="My title"></c>} {}
> \stoptext
> \endinput
>
> Context gives the "can't concatenate with a nil value" Luatex error
> when processing this snipet...but if I ignore the error, the pdf output
> is okey
the functions in the lxml namespace already print to context and return
no value so you effectively appends nil which is invalid
also, when used in a context run the default serializer is also piping
to context so if you want otherwise you need to prefix with xml://
(which is an indication that in principle there can be many variants)
here are some valid solutions (whatch the lxml.id):
\startxmlsetups xml:test
\xmlsetsetup{#1}{c}{xml:*}
\stopxmlsetups
\xmlregistersetup{xml:test}
\startxmlsetups xml:c
\ctxlua{title = "test=" ..
xml.filter(lxml.id("#1"),"xml://./attribute(title)") context(title)}
\par
\ctxlua{context("test=")
xml.filter(lxml.id("#1"),"./attribute(title)")}
\par
\ctxlua{context("test=") lxml.att("#1","title")}
\stopxmlsetups
\starttext
\xmlprocessdata
{maths}
{<?xml version='1.0' standalone='yes?><c title="My title"></c>}
{}
\stoptext
You can wikify this ...
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-03 10:10 ` Hans Hagen
@ 2012-08-03 14:50 ` Sietse Brouwer
2012-08-03 16:14 ` Hans Hagen
2012-08-05 9:35 ` Thomas A. Schmitz
0 siblings, 2 replies; 13+ messages in thread
From: Sietse Brouwer @ 2012-08-03 14:50 UTC (permalink / raw)
To: mailing list for ConTeXt users
Olivier Binda wrote:
> 1) does lxml.att("#1","some tag") really work ?
Hans Hagen wrote:
[various solutions]
> You can wikify this ...
I'm looking for a place to put it, but I'm handicapped by the fact
that I know nothing about ConTeXt's XML handling. I don't even know
whether the question+answer is about general lxml.att usage, or a
howto for some specific result. Can somebody tell me:
Is the lxml namespace common and populated enough that it would be
worth creating
http://wiki.contextgarden.net/XML_manipulation to document the lxml.*
functions, much like
http://wiki.contextgarden.net/String_Manipulation documents string.*
and lpeg.*, and
[[table_manipulation]] documents table.*, and
[[Extensions_to_the_Lua_I/O_library]] documents io.*. (Consistent page
names? Maybe for Christmas (or St. Nicholas), if you're very good.)
Or is there a more suitable page among the links on
http://wiki.contextgarden.net/XML?
Cheers,
Sietse
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-03 14:50 ` Sietse Brouwer
@ 2012-08-03 16:14 ` Hans Hagen
2012-08-05 9:35 ` Thomas A. Schmitz
1 sibling, 0 replies; 13+ messages in thread
From: Hans Hagen @ 2012-08-03 16:14 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 3-8-2012 16:50, Sietse Brouwer wrote:
> Olivier Binda wrote:
>> 1) does lxml.att("#1","some tag") really work ?
>
> Hans Hagen wrote:
> [various solutions]
>> You can wikify this ...
>
> I'm looking for a place to put it, but I'm handicapped by the fact
> that I know nothing about ConTeXt's XML handling. I don't even know
> whether the question+answer is about general lxml.att usage, or a
> howto for some specific result. Can somebody tell me:
>
> Is the lxml namespace common and populated enough that it would be
> worth creating
> http://wiki.contextgarden.net/XML_manipulation to document the lxml.*
> functions, much like
> http://wiki.contextgarden.net/String_Manipulation documents string.*
> and lpeg.*, and
> [[table_manipulation]] documents table.*, and
> [[Extensions_to_the_Lua_I/O_library]] documents io.*. (Consistent page
> names? Maybe for Christmas (or St. Nicholas), if you're very good.)
indeed. the lxml namespace is rather filled up and can have its own page
(maybe Hans vd Meer can help with that as he has played alot with the code)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-03 14:50 ` Sietse Brouwer
2012-08-03 16:14 ` Hans Hagen
@ 2012-08-05 9:35 ` Thomas A. Schmitz
1 sibling, 0 replies; 13+ messages in thread
From: Thomas A. Schmitz @ 2012-08-05 9:35 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 08/03/2012 04:50 PM, Sietse Brouwer wrote:
> I'm looking for a place to put it, but I'm handicapped by the fact
> that I know nothing about ConTeXt's XML handling. I don't even know
> whether the question+answer is about general lxml.att usage, or a
> howto for some specific result. Can somebody tell me:
>
> Is the lxml namespace common and populated enough that it would be
> worth creating
> http://wiki.contextgarden.net/XML_manipulation to document the lxml.*
> functions, much like
> http://wiki.contextgarden.net/String_Manipulation documents string.*
> and lpeg.*, and
> [[table_manipulation]] documents table.*, and
> [[Extensions_to_the_Lua_I/O_library]] documents io.*. (Consistent page
> names? Maybe for Christmas (or St. Nicholas), if you're very good.)
>
> Or is there a more suitable page among the links on
> http://wiki.contextgarden.net/XML?
>
> Cheers,
>
> Sietse
> _______
Hi Sietse,
I have reorganized the XML page on the wiki a bit. The separation
between mkii and mkiv wasn't visible enough, I think. It would now make
sense to add a category "manipulating xml in lua code" (or something to
that effect) under the mkiv heading and then add the lxml code.
All best
Thomas
--
Prof. Dr. Thomas A. Schmitz
Abteilung für Griechische und Lateinische Philologie
Universität Bonn
Am Hof 1e
53113 Bonn
http://www.philologie.uni-bonn.de/personal/schmitz
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-02 15:43 ` Aditya Mahajan
2012-08-02 15:47 ` Aditya Mahajan
2012-08-03 6:35 ` Olivier Binda
@ 2012-08-20 22:27 ` Olivier Binda
2012-08-22 4:54 ` Aditya Mahajan
2 siblings, 1 reply; 13+ messages in thread
From: Olivier Binda @ 2012-08-20 22:27 UTC (permalink / raw)
To: mailing list for ConTeXt users
Many thanks for the enlightening answers.
The explanations about xml solved question 1 and \startmatrix\stopmatrix
solved question 4.
I'm now crunching xml input and handling it half in lua and half in tex
(and I'm verry happy about it).
I'm still struggling with a few points though (with context standalone
beta on ubuntu):
3) I'm flowing text around mathematical text with graphic ornaments
(overlay) but the bounding box from metapost (red) and from TeX (black)
on the following minimal example aren't the same which produce all kinds
of "flowing text" issues.
is there a way/an option for framedtexts with overlay to get the max
width/height size of the main content + overlays ?
\startusableMPgraphic{myFrame}
numeric o, l, m ; path a, b ; pair c ;
picture d; d = textext.rt(\MPstring{Content}) ;
draw (unitsquare xyscaled (OverlayWidth,OverlayHeight) shifted
(-OverlayWidth/2,-OverlayHeight/2)) withpen pencircle scaled 1pt
withcolor green;
draw (d enlarged 2cm) withcolor red withpen pencircle scaled 2pt;
draw boundingbox currentpicture withpen pencircle scaled .1mm dashed
evenly withcolor blue ;
\stopusableMPgraphic
\defineoverlay[myOverlay][\useMPgraphic{myFrame}]
\defineframedtext[myStatement][frame=off]
\setupframedtexts[myStatement][backgroundcolor=lightgray,background=myOverlay,width=\textwidth,autowidth=force]
\starttext
\framed[fit]{\startmyStatement
TEST
\stopmyStatement}
\stoptext
3b) I found a dirty workaround by making metapost draw the texts and the
graphics (through mpstring) but then, i can't embed graphics in my
Tex-text.
Is there a way to have graphics inside MPstrings that goes inside metapost ?
About question 2, Context doesn't produce svg okey...but tikz and
metapost can produce svg.
So, is there a ConteXt setup/systems calls/a (simple or not) workaround
to make metapost/tikz produce svg files ?
Like some script that I could run on my snipets ?
I would really like to produce svg from my metapost/tikz pictures
Best regards,
Olivier
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-20 22:27 ` Olivier Binda
@ 2012-08-22 4:54 ` Aditya Mahajan
2012-08-22 8:21 ` Olivier Binda
0 siblings, 1 reply; 13+ messages in thread
From: Aditya Mahajan @ 2012-08-22 4:54 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Tue, 21 Aug 2012, Olivier Binda wrote:
> 3) I'm flowing text around mathematical text with graphic ornaments (overlay)
> but the bounding box from metapost (red) and from TeX (black) on the
> following minimal example aren't the same which produce all kinds of "flowing
> text" issues.
> is there a way/an option for framedtexts with overlay to get the max
> width/height size of the main content + overlays ?
Can you create a minimal example showing what you are trying to do? The
following example is a bit confusing (where is \MPstring{Content} set? Why
use framedtext instead of framed? What is \framed[fit] supposed to do?
etc).
> \startusableMPgraphic{myFrame}
> numeric o, l, m ; path a, b ; pair c ;
> picture d; d = textext.rt(\MPstring{Content}) ;
> draw (unitsquare xyscaled (OverlayWidth,OverlayHeight) shifted
> (-OverlayWidth/2,-OverlayHeight/2)) withpen pencircle scaled 1pt withcolor
> green;
You could also use
draw OverlayBox withpen ...
> draw (d enlarged 2cm) withcolor red withpen pencircle scaled 2pt;
> draw boundingbox currentpicture withpen pencircle scaled .1mm dashed
> evenly withcolor blue ;
> \stopusableMPgraphic
>
> \defineoverlay[myOverlay][\useMPgraphic{myFrame}]
> \defineframedtext[myStatement][frame=off]
> \setupframedtexts[myStatement][backgroundcolor=lightgray,background=myOverlay,width=\textwidth,autowidth=force]
> \starttext
> \framed[fit]{\startmyStatement
> TEST
> \stopmyStatement}
> \stoptext
You can try \framed[strut=no]{...} and add
\setupframedtext[...][offset=overlay]. See
http://wiki.contextgarden.net/Command/setupframed for details.
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-22 4:54 ` Aditya Mahajan
@ 2012-08-22 8:21 ` Olivier Binda
2012-08-22 8:42 ` Aditya Mahajan
0 siblings, 1 reply; 13+ messages in thread
From: Olivier Binda @ 2012-08-22 8:21 UTC (permalink / raw)
To: mailing list for ConTeXt users
Thank you for the tips.
Here, I cleaned up the code some more (sorry to have left stuff over
last time),.
I added some explanations to make my issue clearer
\startusableMPgraphic{myFrame}
draw OverlayBox withpen pencircle scaled 1pt withcolor green;
draw (currentpicture enlarged 2cm) withcolor red withpen pencircle
scaled 2pt;
\stopusableMPgraphic
\defineoverlay[myOverlay][\useMPgraphic{myFrame}]
\defineframedtext[myStatement][frame=off]
\setupframedtexts[myStatement][background=myOverlay,offset=overlay,autowidth=force]
\starttext
\framed[strut=no]{\startmyStatement FIRST TEST\stopmyStatement}
In the first test, I would like the black box to have the dimensions of
the red box.
\blank[big,big,big,big,big,big,big,big,big,big]
\placefigure[left,none]{}{\startmyStatement SECOND TEST\stopmyStatement}
In the second test, I'm going to demonstrate the issue by flowing text
around the framed text, the green color {\em and the red color}
shouldn't touch the flowing text as I want the float box to include the
text box {\em and the overlay box.}
Best regards,
Olivier
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-22 8:21 ` Olivier Binda
@ 2012-08-22 8:42 ` Aditya Mahajan
2012-08-22 10:31 ` Olivier Binda
0 siblings, 1 reply; 13+ messages in thread
From: Aditya Mahajan @ 2012-08-22 8:42 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Wed, 22 Aug 2012, Olivier Binda wrote:
> Thank you for the tips.
>
> Here, I cleaned up the code some more (sorry to have left stuff over last
> time),.
>
> I added some explanations to make my issue clearer
>
>
> \startusableMPgraphic{myFrame}
> draw OverlayBox withpen pencircle scaled 1pt withcolor green;
> draw (currentpicture enlarged 2cm) withcolor red withpen pencircle scaled
> 2pt;
> \stopusableMPgraphic
>
> \defineoverlay[myOverlay][\useMPgraphic{myFrame}]
> \defineframedtext[myStatement][frame=off]
> \setupframedtexts[myStatement][background=myOverlay,offset=overlay,autowidth=force]
> \starttext
> \framed[strut=no]{\startmyStatement FIRST TEST\stopmyStatement}
> In the first test, I would like the black box to have the dimensions of the
> red box.
\defineframed[myStatement][background=myOverlay, offset=overlay,width=fit]
\dontleavehmode\framed[strut=no, offset=2cm]{\myStatement{FIRST TEST}}
In the first test, I would like the black box to have the dimensions of
the red box.
> \blank[big,big,big,big,big,big,big,big,big,big]
>
> \placefigure[left,none]{}{\startmyStatement SECOND TEST\stopmyStatement}
> In the second test, I'm going to demonstrate the issue by flowing text around
> the framed text, the green color {\em and the red color} shouldn't touch the
> flowing text as I want the float box to include the text box {\em and the
> overlay box.}
\placefigure[left,none]{}{\framed[strut=no,offset=2cm]{\myStatement{SECOND
TEST}}}
....
If needed, you can hide this behind macros:
\def\startmyStatement
{\framed[struct=no, offset=2cm]\bgroup\myStatement\bgroup}
\def\stopmyStatement
{\egroup\egroup}
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Struggling with ConTeXt
2012-08-22 8:42 ` Aditya Mahajan
@ 2012-08-22 10:31 ` Olivier Binda
0 siblings, 0 replies; 13+ messages in thread
From: Olivier Binda @ 2012-08-22 10:31 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 22/08/2012 10:42, Aditya Mahajan wrote:
> On Wed, 22 Aug 2012, Olivier Binda wrote:
>
>> Thank you for the tips.
>>
>> Here, I cleaned up the code some more (sorry to have left stuff over
>> last time),.
>>
>> I added some explanations to make my issue clearer
>>
>>
>> \startusableMPgraphic{myFrame}
>> draw OverlayBox withpen pencircle scaled 1pt withcolor green;
>> draw (currentpicture enlarged 2cm) withcolor red withpen pencircle
>> scaled 2pt;
>> \stopusableMPgraphic
>>
>> \defineoverlay[myOverlay][\useMPgraphic{myFrame}]
>> \defineframedtext[myStatement][frame=off]
>> \setupframedtexts[myStatement][background=myOverlay,offset=overlay,autowidth=force]
>>
>> \starttext
>> \framed[strut=no]{\startmyStatement FIRST TEST\stopmyStatement}
>> In the first test, I would like the black box to have the dimensions
>> of the red box.
>
> \defineframed[myStatement][background=myOverlay,
> offset=overlay,width=fit]
> \dontleavehmode\framed[strut=no, offset=2cm]{\myStatement{FIRST TEST}}
> In the first test, I would like the black box to have the dimensions
> of the red box.
>
>> \blank[big,big,big,big,big,big,big,big,big,big]
>>
>> \placefigure[left,none]{}{\startmyStatement SECOND TEST\stopmyStatement}
>> In the second test, I'm going to demonstrate the issue by flowing
>> text around the framed text, the green color {\em and the red color}
>> shouldn't touch the flowing text as I want the float box to include
>> the text box {\em and the overlay box.}
>
> \placefigure[left,none]{}{\framed[strut=no,
> offset=2cm
Thanks for the help. But I'm affraid that this won't do as I won't
know/I am not supposed to know the dimensions of the bounding box of the
overlay I'll use.
:/
For the sake of the minimal example, I only enlarged the picture by 2cm,
but in real production situations,
the bounding box is going to be enlarged by random offset, because the
overlay will have various parts with weird shapes (super ellipse,
squeezed rectangles) that go beyond the original text boundaries (like
in the Zapf frametext example of the Context manual : the title is
protruding out of the main box and if you put weird stuff in there, you
won't know the dimensions).
I don't want to manually calculate those offsets, I would like metapost
to pass it's bounding box dimensions for the overlay to context so that
it automatically applies the correct offset to the text+overlay
> ]{\myStatement{SECOND TEST}}}
> ....
>
> If needed, you can hide this behind macros:
>
> \def\startmyStatement
> {\framed[struct=no, offset=2cm]\bgroup\myStatement\bgroup}
>
> \def\stopmyStatement
> {\egroup\egroup}
>
> Aditya
> ___________________________________________________________________________________
>
> If your question is of interest to others as well, please add an entry
> to the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive : http://foundry.supelec.fr/projects/contextrev/
> wiki : http://contextgarden.net
> ___________________________________________________________________________________
>
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-08-22 10:31 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-02 15:29 Struggling with ConTeXt Olivier Binda
2012-08-02 15:43 ` Aditya Mahajan
2012-08-02 15:47 ` Aditya Mahajan
2012-08-03 6:35 ` Olivier Binda
2012-08-03 10:10 ` Hans Hagen
2012-08-03 14:50 ` Sietse Brouwer
2012-08-03 16:14 ` Hans Hagen
2012-08-05 9:35 ` Thomas A. Schmitz
2012-08-20 22:27 ` Olivier Binda
2012-08-22 4:54 ` Aditya Mahajan
2012-08-22 8:21 ` Olivier Binda
2012-08-22 8:42 ` Aditya Mahajan
2012-08-22 10:31 ` Olivier Binda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).