Re: [NTG-context] Change the dots of the macro \periods[n]
Hi Hans and Wolfgang, Thank you for your suggestions. It meets my expectations, but I'll try to understand the codes later! Fabrice ___ 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 ___
Re: [NTG-context] Problem with MkIV and TikZ picture remembering
On 3/7/2015 1:08 PM, Jörg Weger wrote: Metapost’s learnig curve seems to be a lot steeper to me. It is really a pity that ConTeXt mkiv does not save the node coordinates correctly as Wolfgang found out. Is that really an mkiv issue? If I understood well tikz has its own way of keeping track of positions independent of context. 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 ___
Re: [NTG-context] Problem with MkIV and TikZ picture remembering
Is that really an mkiv issue? If I understood well tikz has its own way of keeping track of positions independent of context. Normally yes. But there is TikZ’ “remember picture” mode. You can produce several independent TikZ pictures on a ConTeXt/LaTeX/plain text page. TikZ tells ConTeXt (or LaTeX or plain TeX) to give back the coordinates of those pictures on the page after the page has been typeset. TikZ can then draw interconnections between those images which are rendered in an extra run. In my example the rounded rectangles with the words inside are TikZ images which are put inline into the ConteXt text by the command \tikz[baseline] \node[form of node, draw, anchor=text] {text content} When I use \tikz[baseline, remember picture] … instead I activate the mode explained above and the arrows can be drawn according to the “remembered” coordinates after ConTeXt’s first typesetting run. According to Wolfgang Schuster in the first reply in this thread when using ConTeXt mkiv – other than mkii – file the coordinates given back after the first typesetting run look strange in TikZ’ auxiliary so there seems to be a mistake somnewhere between ConTeXt and TikZ in this regard. Greetings Jörg On 07.03.2015 15:52, Hans Hagen wrote: On 3/7/2015 1:08 PM, Jörg Weger wrote: Metapost’s learnig curve seems to be a lot steeper to me. It is really a pity that ConTeXt mkiv does not save the node coordinates correctly as Wolfgang found out. Is that really an mkiv issue? If I understood well tikz has its own way of keeping track of positions independent of context. 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 ___ ___ 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 ___
Re: [NTG-context] Problem with MkIV and TikZ picture remembering
Am 07.03.2015 um 18:30 schrieb Jörg Weger joerg73@googlemail.com: Is that really an mkiv issue? If I understood well tikz has its own way of keeping track of positions independent of context. Normally yes. But there is TikZ’ “remember picture” mode. You can produce several independent TikZ pictures on a ConTeXt/LaTeX/plain text page. TikZ tells ConTeXt (or LaTeX or plain TeX) to give back the coordinates of those pictures on the page after the page has been typeset. TikZ can then draw interconnections between those images which are rendered in an extra run. Tikz uses the pdftex commands \pdfsavepos, \pdflastxpos and \pdflastypos to save the position of the graphics on the page. ConTeXt isn’t involved in this process which provides its own interface for this mechanism but Tikz doesn’t use it. In my example the rounded rectangles with the words inside are TikZ images which are put inline into the ConteXt text by the command \tikz[baseline] \node[form of node, draw, anchor=text] {text content} When I use \tikz[baseline, remember picture] … instead I activate the mode explained above and the arrows can be drawn according to the “remembered” coordinates after ConTeXt’s first typesetting run. According to Wolfgang Schuster in the first reply in this thread when using ConTeXt mkiv – other than mkii – file the coordinates given back after the first typesetting run look strange in TikZ’ auxiliary so there seems to be a mistake somnewhere between ConTeXt and TikZ in this regard. The problem is the \write command which differs in MkII and MkIV and Tikz way to prevent the expansion of a command which is written to the auxiliary file. The following example demonstrates the difference between MkII and MkIV. In MkII the \noexpand prevents the expansion of \dummytext when writes content is written to the external file but in MkIV \write is redefined and this doesn’t work anymore. begin example \newwrite\testwrite \starttext \immediate\openout\testwrite=\jobname-dummytext.tmp \def\dummytext{First sample text.} \immediate\write\testwrite{\noexpand\dummytext} \def\dummytext{Second sample text.} \immediate\write\testwrite{\noexpand\dummytext} \immediate\closeout\testwrite \stoptext end example Wolfgang ___ 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 ___
[NTG-context] Update text variables inside metapost
Why the metapost not updated the value of text variables that are generated inside luacode environment? In the code below, If I have \startitemize[columns,two] then metapost draw: 1. \Bolha[size=6cm]{text1}{text2}{text3}, 2. and four \Bolha[size=4cm]{text1}{text2}{text3}, but text1, text2 and text3 is not updated in every call; If I omit the itemize environment or with \startitemize metapost only draw: 1. the first call of Bolha that is: \Bolha[size=6cm]{text1}{text2}{text3} 2. and four call of \Bolha[size=6cm]{text1}{text2}{text3} %% all new information is omited Jorge % code \def\Bolha[#1]#2#3#4% {\setupMPvariables[bolha][#1]% \setMPtext{labelcima}{#3}% \setMPtext{labelesquerda}{#2}% \setMPtext{labeldireita}{#4}% \useMPgraphic{bolha}} \startuniqueMPgraphic{bolha} path p, q, cima, esquerda, direita, vertical; pair A, B, C; p:=fullcircle scaled \MPvar{size}; A:= (point 4 of p); B:= (point 8 of p); C:= (point 6 of p); q:=A--B; vertical := .5[A,B]--C; cima := buildcycle(q, subpath(4,8) of reverse p); esquerda := buildcycle(subpath(4,6) of p, vertical, subpath(0,.5) of q); direita := buildcycle(subpath(6,8) of p, subpath(0,.5) of reverse q, vertical); draw p; draw q; draw vertical; label(textext( \MPstring{labelcima} ), center cima); label(textext( \MPstring{labelesquerda} ), center esquerda); label(textext( \MPstring{labeldireita} ), center direita); \stopuniqueMPgraphic \starttext \placefigure[center, nonumber]{}{ \Bolha[size=6cm]{$C_m$ (g/dm\high{3})}{mass (g)}{V\low{s} (dm\high{3})} } \startitemize[columns,two] %% try only \startitemize \startluacode flasks={20,25,50,100,200,250,500,1000} k=1 repeat Cm=math.random(1,10)/10 Vs=flasks[math.random(1,8)]/1000 mass=Cm*Vs --incognita=math.random(1,3) incognita=1 context.item() if incognita==1 then context(\\Bolha[size=4cm]{$C_m$}{%.2f g}{%.1f dm\\high{3}} mass=%.2f g, mass, Vs, mass) elseif incognita==2 then context(\\Bolha[size=5cm]{%.1f g/dm\\high{3}}{m}{%.1f dm\\high{3}} mass= hidde, Cm, Vs, mass) elseif incognita==3 then context(\\Bolha[size=5cm]{%.1f g/dm\\high{3}}{%.2f g}{V\\low{s}} mass=%.2f g, Cm ,mass, mass) end k=k+1 until k==5 \stopluacode \stopitemize \stoptext %%% stop code ___ 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 ___
Re: [NTG-context] page breaks before titles
On 03/07/2015 12:46 AM, mf wrote: Hello, I'm trying to typeset a book made of letters with ConTeXt. Every letter has a title a subtitle and a date, before it starts with Dear ... Like this: - Title subtitle where, when Dear ..., the rest of the letter ... - The letters are very different in length -- some are long, some are made of a couple of lines --, so I'd like to typeset them continuously, without skipping to a new page every new letter (\setuphead[LetterTitle][page=no]). This way a letter could finish beyond the half of a page, and the next one could have no space left to get the part from Title to the first lines of the body on the same page. That's why I disabled page breaks from Title to the first paragraph after Dear ...: it would be ugly having only the title in one page and the rest in the next ones. But there's a side effect: the title of the new letter pulls the last two lines (the penalties are set to avoid one-line widows) of the previous letter to the new page, even when there's room for them on the previous page. In this case I would like ConTeXt to break the page at the end of the previous letter, before the next letter title. That's why I've set before={\blank[2*line]\page[preference]} in LetterTitle. But it does not work. Hi Massi, how about before={\blank[2*line]\page[bigpreference]}? As Wolgang noted before, a minimal sample is essential to be able to provide a solution. Pablo -- http://www.ousia.tk ___ 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 ___
Re: [NTG-context] page breaks before titles
You can use the \testpage command where you can set how many lines should remain on the page before a page breaks happens. \setuphead[LetterTitle][before={\testpage[8]\blank[2*line]}] If this doesn’t help you should make a *working* minimal example. Wolfgang Thanks Wolfgang (and Pablo), \testpage[lines] solved the problem. Massi ___ 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 ___
Re: [NTG-context] page breaks before titles
Am 07.03.2015 um 00:46 schrieb mf mass...@fastwebnet.it: Hello, I'm trying to typeset a book made of letters with ConTeXt. Every letter has a title a subtitle and a date, before it starts with Dear ... Like this: - Title subtitle where, when Dear ..., the rest of the letter ... - The letters are very different in length -- some are long, some are made of a couple of lines --, so I'd like to typeset them continuously, without skipping to a new page every new letter (\setuphead[LetterTitle][page=no]). This way a letter could finish beyond the half of a page, and the next one could have no space left to get the part from Title to the first lines of the body on the same page. That's why I disabled page breaks from Title to the first paragraph after Dear ...: it would be ugly having only the title in one page and the rest in the next ones. But there's a side effect: the title of the new letter pulls the last two lines (the penalties are set to avoid one-line widows) of the previous letter to the new page, even when there's room for them on the previous page. In this case I would like ConTeXt to break the page at the end of the previous letter, before the next letter title. That's why I've set before={\blank[2*line]\page[preference]} in LetterTitle. But it does not work. Example: - - text of the previoustext of the previous letter with room to be letter with room to be all typeset hereall typeset here page 11 last two lines of the [room for 2 lines] the previous letter page break--- == --- last two lines of the Title the previous letter subtitle ... page 12 Title subtitle ... Is there a way to know the vertical location where the previous letter ends, to decide whether to skip to a new page? You can use the \testpage command where you can set how many lines should remain on the page before a page breaks happens. \setuphead[LetterTitle][before={\testpage[8]\blank[2*line]}] If this doesn’t help you should make a *working* minimal example. Wolfgang ___ 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 ___
Re: [NTG-context] Problem with MkIV and TikZ picture remembering
Thank you very much Hans and Aditya for your efforts and sorry for only replying now — momentarily I am writing a paper (of course typeset with ConTeXt :-) ) that has to get finished. For now I have dropped the idea of using that certain type of illustration in the paper as your METAPOST examples are working, but I had forgotten to say that I need effectively two arrows from one part of a sentence two two others (I am trying to illustrate a linguistic ambiguity problem) and I did not manage to get that working starting from your examples. Then I need a shape other than a tight frame to surround the words, TikZ’ rounded rectangles were too nice for that. In the moment I don’t have the time to dive deeper into METAPOST which seems to be a mighty beast from what I see in the Metafun manual, but in future I shurely will. The nice thing about TikZ are that you can use the self explaining commands rather intuitively (at least having some experience in Lilypond and now ConTeXt), that there are many different building blocks predefined that you can use and that there are hundreds of examples in the internet that you can use as starting point. So I managed to get some things working after a self-tought one day crash course – Metapost’s learnig curve seems to be a lot steeper to me. It is really a pity that ConTeXt mkiv does not save the node coordinates correctly as Wolfgang found out. Greetings Jörg On 03.03.2015 20:28, Aditya Mahajan wrote: On Tue, 3 Mar 2015, Hans Hagen wrote: On 3/3/2015 6:12 PM, Aditya Mahajan wrote: 2. The metafun alternative is a bit inconvenient. Suppose you want to draw a bunch of such graphics (words connected by arrows). Then, you will need to ensure that node names are unique. (Is there a way to get around that?) \newcounter\connectedwordcounter \starttexdefinition unexpanded fromword [#1]#2 \expandafter\pushmacro\csname cwc#1\endcsname % nesting hack \doglobal\increment\connectedwordcounter \setxvalue{cwc#1}{\connectedwordcounter}% \startpositionoverlay{highlightoverlay} \setMPpositiongraphic {\getvalue{cwc#1}f} {highlightgraphic} {from=\getvalue{cwc#1}f,to=\getvalue{cwc#1}t} \stoppositionoverlay \hpos{\getvalue{cwc#1}f}{#2}% \stoptexdefinition \starttexdefinition unexpanded toword [#1]#2 \hpos{\getvalue{cwc#1}t}{#2} \expandafter\popmacro\csname cwc#1\endcsname % nesting hack \stoptexdefinition Thanks. 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 ___
Re: [NTG-context] paragraph footnotes line height
On 03/07/2015 10:59 AM, Wolfgang Schuster wrote: Am 07.03.2015 um 00:08 schrieb mf: I'd like to know how I can set the line height of paragraph footnotes. [...] \startsetups[footnote:interlinespace] \setupinterlinespace[line=10pt] \stopsetups \setupnote[footnote][setups=footnote:interlinespace] Wolfgang, this doesn’t work with paragraph footnotes: \startsetups[setups:footnote] \setupinterlinespace[line=8ex] \stopsetups \setupnotation[footnote][ alternative=serried, numbercommand=\high, numberconversion=a, way=bypage, width=0pt, ] \setupnote[footnote][ paragraph=yes, inbetween= \emdash{} , setups=setups:footnote, ] \starttext \dorecurse{2}{These are footnotes\footnote{\input knuth}. } \stoptext Is it a bug? Pablo -- http://www.ousia.tk ___ 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 ___
Re: [NTG-context] paragraph footnotes line height
Am 07.03.2015 um 00:08 schrieb mf mass...@fastwebnet.it: Hello, I'd like to know how I can set the line height of paragraph footnotes. They get the line height set with \setupinterlinespace, whether I use the grid or not. Here's my configuration: \setupnotation[footnote][ alternative=serried, numbercommand=, numberstopper=, numbercommand=\high, numberconversion=a, way=bypage, width=0pt, location=page ] \setupnote[footnote][ paragraph=yes, inbetween= \emdash{} , location=page ] \startsetups[footnote:interlinespace] \setupinterlinespace[line=10pt] \stopsetups \setupnote[footnote][setups=footnote:interlinespace] Wolfgang ___ 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 ___
Re: [NTG-context] paragraph footnotes line height
Am 07.03.2015 um 00:08 schrieb mf mass...@fastwebnet.it: Hello, I'd like to know how I can set the line height of paragraph footnotes. They get the line height set with \setupinterlinespace, whether I use the grid or not. Here's my configuration: \setupnotation[footnote][ alternative=serried, numbercommand=, numberstopper=, numbercommand=\high, numberconversion=a, way=bypage, width=0pt, location=page ] \setupnote[footnote][ paragraph=yes, inbetween= \emdash{} , location=page ] \startsetups[footnote:interlinespace] \setupinterlinespace[line=10pt] \stopsetups \setupnote[footnote][setups=footnote:interlinespace] Wolfgang Comment out the paragraph=yes and it works. But paragraph footnotes don't seem to work with it, as also Pablo pointed out. Anyway, thank you both. ___ 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 ___
Re: [NTG-context] Update text variables inside metapost
Aditaya, thanks for the clarification. Now it works perfectly. Jorge 2015-03-07 23:57 GMT+00:00 Aditya Mahajan adit...@umich.edu: On Sat, 7 Mar 2015, DesdeChaves wrote: Why the metapost not updated the value of text variables that are generated inside luacode environment? In the code below, If I have \startitemize[columns,two] then metapost draw: 1. \Bolha[size=6cm]{text1}{text2}{text3}, 2. and four \Bolha[size=4cm]{text1}{text2}{text3}, but text1, text2 and text3 is not updated in every call; Use useMPgraphic instead of uniqueMPgraphic. uniqueMPgraphic recomputes the graphic only when the dimensions of figure has changed; otherwise, it reuses the previously drawn graphic. This behavior was useful for drawing page-backgrounds etc in MkII where calling metapost was slow. 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 ___ -- Atentamente DesdeChaves ___ 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 ___
Re: [NTG-context] Update text variables inside metapost
On Sat, 7 Mar 2015, DesdeChaves wrote: Why the metapost not updated the value of text variables that are generated inside luacode environment? In the code below, If I have \startitemize[columns,two] then metapost draw: 1. \Bolha[size=6cm]{text1}{text2}{text3}, 2. and four \Bolha[size=4cm]{text1}{text2}{text3}, but text1, text2 and text3 is not updated in every call; Use useMPgraphic instead of uniqueMPgraphic. uniqueMPgraphic recomputes the graphic only when the dimensions of figure has changed; otherwise, it reuses the previously drawn graphic. This behavior was useful for drawing page-backgrounds etc in MkII where calling metapost was slow. 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 ___