Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
> On 1 May 2020, at 13:28, Hans Hagen wrote: > > On 5/1/2020 10:21 AM, Gerben Wierda wrote: >> code it back to a \ ? E.g. something like >>{ ‘\U{XXX}', '\' }, > \utfchar{100} > \Uchar 100 Yes, but the question was: how do I code this in the XML and get it through my XML-lua-METAPOST-textext() path so that e.g. or in the XML end up as \ in my textext() string? E.g. a in XML becomes a \n when lmtx XML handling has read the XML (so gets transformed on read). I’ve been thinking about the route -> \r -> \ (so, misusing \r to code a TeX-\ in the XML, but that would probably not robust. The question is more: what is a good UTF8 character to use (the first 32 would be good candidates if they would work and end in the strings that xml.foo() of lmtx produces). G > > - > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
> On 1 May 2020, at 09:38, Hans Hagen wrote: > > On 5/1/2020 1:44 AM, Gerben Wierda wrote: >>{ ‘\n', ‘\\strut' }, > often a \zwj or \zwno also works ok (has zero dimensions, contraty to strut; > you could also try \crlf I tried \crlf{} and that worked too (the “{}” because I do not know what comes after even if I think any whitespace is eaten and to influence any catcode trickery, just feels it is more robust than a space). Hans, an additional question about lmtx’s XML interface. As I want the TeX special characters to be able to be part of a label, I replace all of them. That works. But what if I would like a way to introduce TeX commands again by using some other UTF8 character, would there be a character that curvies the pass through lmtx, can be used in a lua table so that I can (in a preferred order) get unescaped characters passed that flow? E.g. code a \ as some weird UTF8 character in the XML file, and in that table I use local rep = lpeg.replacer { { '\n', '\\crlf{}' }, { '{', '{\\textbraceleft}' }, { '}', '{\\textbraceright}' }, { '#', '{\\texthash}' }, { '$', '{\\textdollar}' }, { '&', '{\\textampersand}' }, { '%', '{\\textpercent}' }, { '\\','{\\textbackslash}' }, { '|', '{\\textbar}' }, { '_', '{\\textunderscore}' }, { '~', '{\\textasciitilde}' }, { '^', '{\\textasciicircum}' }, { '"', "\"&\"" }, } code it back to a \ ? E.g. something like { ‘\U{XXX}', '\' }, > > Hans > > - > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
On 5/1/2020 1:45 PM, Gerben Wierda wrote: On 1 May 2020, at 13:28, Hans Hagen wrote: On 5/1/2020 10:21 AM, Gerben Wierda wrote: code it back to a \ ? E.g. something like { ‘\U{XXX}', '\' }, \utfchar{100} \Uchar 100 Yes, but the question was: how do I code this in the XML and get it through my XML-lua-METAPOST-textext() path so that e.g. or in the XML end up as \ in my textext() string? E.g. a in XML becomes a \n when lmtx XML handling has read the XML (so gets transformed on read). I’ve been thinking about the route -> \r -> \ (so, misusing \r to code a TeX-\ in the XML, but that would probably not robust. The question is more: what is a good UTF8 character to use (the first 32 would be good candidates if they would work and end in the strings that xml.foo() of lmtx produces). you could try \xmltexentity{foo}{[overloaded foo]} - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
On 5/1/2020 1:45 PM, Gerben Wierda wrote: On 1 May 2020, at 13:28, Hans Hagen wrote: On 5/1/2020 10:21 AM, Gerben Wierda wrote: code it back to a \ ? E.g. something like { ‘\U{XXX}', '\' }, \utfchar{100} \Uchar 100 Yes, but the question was: how do I code this in the XML and get it through my XML-lua-METAPOST-textext() path so that e.g. or in the XML end up as \ in my textext() string? E.g. a in XML becomes a \n when lmtx XML handling has read the XML (so gets transformed on read). I’ve been thinking about the route -> \r -> \ (so, misusing \r to code a TeX-\ in the XML, but that would probably not robust. The question is more: what is a good UTF8 character to use (the first 32 would be good candidates if they would work and end in the strings that xml.foo() of lmtx produces). did you try the attached approach? (a recent lmtx) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - strings-001.tex Description: Binary data ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
On 5/1/2020 10:21 AM, Gerben Wierda wrote: code it back to a \ ? E.g. something like { ‘\U{XXX}', '\' }, \utfchar{100} \Uchar 100 - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
On 5/1/2020 1:44 AM, Gerben Wierda wrote: { ‘\n', ‘\\strut' }, often a \zwj or \zwno also works ok (has zero dimensions, contraty to strut; you could also try \crlf Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
> On 30 Apr 2020, at 22:54, Wolfgang Schuster > wrote: > > Gerben Wierda schrieb am 30.04.2020 um 22:47: >> In normal TeX, when I type >> AapAap >> I get something like >> Aap >> Aap >> But inside a \framed[align=]{} the empty line disappears. How do I get it >> back? >> Minimal example: >> \starttext >> TestingTesting >> \page >> \framed[align=flushleft]{TestingTesting} >> \stoptext > > Use \blank Too happy too soon. And I recall I ran into this earlier a while ago in another setting ago. But I thought of a solution. Background: I am automatically converting input from an XML file to METAPOST/ConTeXt. The input may contain one or more newlines.The text must end up in \framed[align=??, width=??] to be typeset. I use lua to convert and make it safe to pass to METAPOST as a string argument that METAPOST can pass on to textext(), using the following function: function doubleQuotableEscapedConTeXtString( str) local rep = lpeg.replacer { { '\n', '\\blank ' }, { '{', '{\\textbraceleft}' }, { '}', '{\\textbraceright}' }, { '#', '{\\texthash}' }, { '$', '{\\textdollar}' }, { '&', '{\\textampersand}' }, { '%', '{\\textpercent}' }, { '\\','{\\textbackslash}' }, { '|', '{\\textbar}' }, { '_', '{\\textunderscore}' }, { '~', '{\\textasciitilde}' }, { '^', '{\\textasciicircum}' }, { '"', "\"&\"" }, } return rep:match(str) end Where it now says \\blank, it used to say . Problem gets me what I want if there is one \n (it turns into one new line), but with two \n in succession it still gets me only a single ’newline' \\blank gets me what I want if there are multiple newlines, but gets me an extra empty line when I only want ’next line’ and multiple \blanks do not work But I found the solution by using \strut\\ instead of \blank. In the above table: { ‘\n', ‘\\strut' }, This fools ConTeXt in thinking there actually is something on that line and so multiple \\ will work. G___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
> On 30 Apr 2020, at 22:51, Henning Hraban Ramm wrote: > > > >> Am 30.04.2020 um 22:47 schrieb Gerben Wierda : >> >> In normal TeX, when I type >> >> AapAap >> >> I get something like >> >> Aap >> >> Aap >> >> But inside a \framed[align=]{} the empty line disappears. How do I get it >> back? > > Try \framedtext instead; multi line text needs a \vbox, and \framedtext does > that. (If I understood correctly.) > > Maybe you need to set the align option. I did set the align option to get a vbox. G > > Best, Hraban > ___ > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
Brilliant! Thank you! > On 30 Apr 2020, at 22:54, Wolfgang Schuster > wrote: > > Gerben Wierda schrieb am 30.04.2020 um 22:47: >> In normal TeX, when I type >> AapAap >> I get something like >> Aap >> Aap >> But inside a \framed[align=]{} the empty line disappears. How do I get it >> back? >> Minimal example: >> \starttext >> TestingTesting >> \page >> \framed[align=flushleft]{TestingTesting} >> \stoptext > > Use \blank > > 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
Gerben Wierda schrieb am 30.04.2020 um 22:47: In normal TeX, when I type AapAap I get something like Aap Aap But inside a \framed[align=]{} the empty line disappears. How do I get it back? Minimal example: \starttext TestingTesting \page \framed[align=flushleft]{TestingTesting} \stoptext Use \blank 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] How do I get an empty line in a \framed[align=flushleft]{} item?
> Am 30.04.2020 um 22:47 schrieb Gerben Wierda : > > In normal TeX, when I type > > AapAap > > I get something like > > Aap > > Aap > > But inside a \framed[align=]{} the empty line disappears. How do I get it > back? Try \framedtext instead; multi line text needs a \vbox, and \framedtext does that. (If I understood correctly.) Maybe you need to set the align option. Best, Hraban ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___