* XML question regarding special characters @ 2005-01-07 18:35 Zeljko Vrba 2005-01-07 19:23 ` Adam Lindsay 0 siblings, 1 reply; 10+ messages in thread From: Zeljko Vrba @ 2005-01-07 18:35 UTC (permalink / raw) Hi! I'm trying to design a "universal" markup that will be easy to convert both to PDF and HTML. I've come to code and equations. I don't want to use MathML and I want to output (and use in my documents!) verbatim TeX code of equations to HTML. What worries me is the following: I want to be able to write and run through Context XML processing: <formula label="fm:whatever> x^{2} < y </formula> or, for typesetting computer programs: <code> if((x&y) >= 3) { do_something(); } </code> (this would translate to \starttyping\stoptyping) How do I define XML environments that can handle XML special characters (<>&, etc., I don't know all of them..) gracefully? (i.e. so that I don't have to type <code> if((x&y) >= 3) </code> and similar for formulas) Thanks! ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: XML question regarding special characters 2005-01-07 18:35 XML question regarding special characters Zeljko Vrba @ 2005-01-07 19:23 ` Adam Lindsay 2005-01-09 14:06 ` m-letter.tex -- backslash interpretation error Rob Ermers 0 siblings, 1 reply; 10+ messages in thread From: Adam Lindsay @ 2005-01-07 19:23 UTC (permalink / raw) Zeljko Vrba said this at Fri, 7 Jan 2005 19:35:27 +0100: >I'm trying to design a "universal" markup that will be easy to convert both >to PDF and HTML. Hi there. Sounds as if we're after similar things. I've been working on similar stuff, expanding on the existing x-contml module with code in this project: <http://oo2contml.sourceforge.net/> (The source code link may be instructive.) ><formula label="fm:whatever> > x^{2} < y ></formula> I use the following, as "heavily influenced" by Hans: %D Recommended by Hans as a variant of \type{\XMLtex}: \unprotected\def\XMLtexdata#1% {\begingroup \disableXML \scantokens\@EA\@EA\@EA{\csname\@@XMLdata:#1\endcsname}% \endgroup} %D Display|| and in||line math using \TeX\ syntax: \defineXMLenvironmentsave [context:dispformula] [label=] {} {\startformula[\XMLop{label}] \XMLtexdata{context:dispformula} \stopformula} \defineXMLenvironmentsave [context:formula] [] {} {\mathematics{\XMLtexdata{context:formula}}} -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Adam T. Lindsay, Computing Dept. atl@comp.lancs.ac.uk Lancaster University, InfoLab21 +44(0)1524/510.514 Lancaster, LA1 4WA, UK Fax:+44(0)1524/510.492 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
* m-letter.tex -- backslash interpretation error 2005-01-07 19:23 ` Adam Lindsay @ 2005-01-09 14:06 ` Rob Ermers 2005-01-09 20:04 ` h h extern 0 siblings, 1 reply; 10+ messages in thread From: Rob Ermers @ 2005-01-09 14:06 UTC (permalink / raw) Dear Friends, It seems I am really having a problem. The backslash in my import document yields “. \startsetups[letter:content] \input brieftekst \stopsetups My document (brieftext.tex) among other things contains the following string: ge\"interesseerde, which yields --> ge“”interesseerde I am unable to use any normal code in my text, which is very problematic! Kind regards, Robert ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: m-letter.tex -- backslash interpretation error 2005-01-09 14:06 ` m-letter.tex -- backslash interpretation error Rob Ermers @ 2005-01-09 20:04 ` h h extern 2005-01-10 17:10 ` Rob Ermers 0 siblings, 1 reply; 10+ messages in thread From: h h extern @ 2005-01-09 20:04 UTC (permalink / raw) Rob Ermers wrote: > Dear Friends, > > It seems I am really having a problem. The backslash in my import > document yields “. > > \startsetups[letter:content] > \input brieftekst > \stopsetups > > My document (brieftext.tex) among other things contains the following > string: > > ge\"interesseerde, which yields --> ge“”interesseerde > > I am unable to use any normal code in my text, which is very problematic! ... a minimal example ... looks like an encoding mismatch or so Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: m-letter.tex -- backslash interpretation error 2005-01-09 20:04 ` h h extern @ 2005-01-10 17:10 ` Rob Ermers 2005-01-10 18:08 ` Hans Hagen 0 siblings, 1 reply; 10+ messages in thread From: Rob Ermers @ 2005-01-10 17:10 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 2164 bytes --] Hans, thanks for your reaction! Here is the minimal example: 1. brief-test.tex is the letter. 2. brief-inhoud-test is the letter content. 3. test-data.xml contains some addresses The problem is that any backslash in the letter content is changed into `` in the pdf file. In the "reference" I also put a backslash (after the item "concerns"), but this one survives. To get that result I use: \startsetups[letter:content] \input brief-inhoud-test.tex \stopsetups If I use \startbuffer[texletter] \input brief-inhoud-test.tex \stopbuffer the content is not loaded into the letter at all; the result is then ``input brief-inhoud-test.tex instead of the content of the file. The encoding problem with \ is described in one of your manuals, but I really don't know where to repair it. A second problem is that the first address slides down to the content much more than it should. I tried to circumvent that by inserting a dummy address. Thanks in advance, Robert Ermers h h extern wrote: > Rob Ermers wrote: > >> Dear Friends, >> >> It seems I am really having a problem. The backslash in my import >> document yields “. >> >> \startsetups[letter:content] >> \input brieftekst >> \stopsetups >> >> My document (brieftext.tex) among other things contains the following >> string: >> >> ge\"interesseerde, which yields --> ge“”interesseerde >> >> I am unable to use any normal code in my text, which is very problematic! > > > ... a minimal example ... > > looks like an encoding mismatch or so > > Hans > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com > | www.pragma-pod.nl > ----------------------------------------------------------------- > > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context > > [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: test-data.xml --] [-- Type: text/xml; name="test-data.xml", Size: 2295 bytes --] <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> <start> <ref name="contacts"> </start> <define name="contacts"> <element name="contacts"> <zeroOrMore> <choice> <ref name="contacts.contact"/> <ref name="contacts.contactgroup"/> <ref name="contacts.contactfile"/> </choice> </zeroOrMore> </element> </define> <define name="contacts.contactgroup"> <element name="contactgroup"> <zeroOrMore> <ref name="contactgroup.member"> </zeroOrMore> <attribute name="label"/> </element> </define> <define name="contactgroup.member"> <element name="member"> <text/> </element> </define> <define name="contacts.contact"> <element name="contact"> <interleave> <optional><ref name="contact.address"/></optional> <optional><ref name="contact.opm"/></optional> </interleave> <attribute name="label" name="regio" name="num"/> </element> </define> <!-- <contact label=`marle.k.van'> <initials>K. van</initials> <formalname>Marle</formalname> <informalname>Kees</informalname> <title>Ir.</title> <prefix>Heer van</prefix> <address> <p>K. van Marle</p> <p>PRAGMA POD</p> <p>Ridderstraat 27</p> <p>8061GH Hasselt NL</p> </address> </contact> --> <contacts> <contact num="297" regio="n3" label=`num297'> <address> <p>Dummy</p> <p>Dummy</p> <p>test</p> <p>test</p> </address> </contact> <contact num="1" regio="z3" label=`num1'> <address> <p>J. Jansen</p> <p>Langeweg 66</p> <p>Aalsterweg 29</p> <p>1234 AB Eindhoven</p> </address> </contact> <contact num="2" regio="z3" label=`num2'> <address> <p>J. Pietersen</p> <p>Korteweg 66</p> <p>Aalsterweg 29</p> <p>B-1234 Zonhoven</p> </address> </contact> <contact num="3" regio="z3" label=`num3'> <address> <p>J. van den Berg</p> <p>Laan der Drie\"eenheid</p> <p>1234 AB Beginhoven</p> </address> </contact> <!-- 334 records written --> <contactgroup label=`n'> <member>num297</member> <member>num1</member> <member>num3</member> <member>num3</member> </contactgroup> </contacts> [-- Attachment #3: brief-inhoud-test.tex --] [-- Type: text/plain, Size: 122 bytes --] Hierbij deel ik u mede dat we hier erg effici\"ent werken en niet ge\"interesseerd zijn in ge\"evolueerde dieselmotoren. [-- Attachment #4: brief-test.tex --] [-- Type: text/plain, Size: 1624 bytes --] %starttext \setups [letter:place] \stoptext \endinput \setupoutput[pdftex] %\tracelayerstrue %\usemodule[xtag-ini] \usemodule[corres] \usemodule[letter-re] \mainlanguage[nl] \setupbodyfont[ss] %\setvariables[letter:head][graphic=briefpapier-mo-p.010.pdf] \definelayer [letternext] [state=next, % graphic=briefpapier-mo-p.011.pdf, width=\paperwidth, height=\paperheight] \setvariables [letter:reference] [line=2, noflines-min=2, noflines-max=5, noflines=\getvariable{letter:reference}{noflines-max} ] \setvariables [letter:style] [opening=formal, closing=formal] %\setvariables % [letter:data] % [opening=, % initials=, % prefix=, % suffix=, % informalname=, % formalname=] % noflines=10] \setvariables[letter:address][line=6, hoffset=100mm,width=70mm] %\startsetups[contact:handle] %\XMLflush{address} \endgraf %\stopsetups %\startbuffer[texletter] %\input brieftekst-pol-jan2005 %\stopbuffer \startsetups[letter:content] \input brief-inhoud-test.tex \stopsetups \setvariables [letter:data] [address=\XMLflush{address}, %prefix=\XMLflush{prefix}, %initials=\XMLflush{initials}, %formalname=\XMLflush{formalname}, %informalname=\XMLflush{informalname} %content={\getbuffer[texletter]}, %,content=\getbuffer concerns=Ge\"interesseerd?, date=10 januari 2005, author=Dr. R.J.H.M. Ermers ] \setvariables[contacts][selection=n, file=test-data.xml] \startsetups[contact:handle] \setups[letter:place] \stopsetups \XMLprocesscontacts[test-data.xml] \starttext %\setups[letter:place] \stoptext [-- Attachment #5: Type: text/plain, Size: 139 bytes --] _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: m-letter.tex -- backslash interpretation error 2005-01-10 17:10 ` Rob Ermers @ 2005-01-10 18:08 ` Hans Hagen 2005-01-10 19:34 ` Rob Ermers 2005-01-11 7:48 ` Christopher Creutzig 0 siblings, 2 replies; 10+ messages in thread From: Hans Hagen @ 2005-01-10 18:08 UTC (permalink / raw) The problem is that the letter content is processed in xml mode, so you need: \startsetups[letter:place:content] \bgroup \disableXML \endgraf \setups[letter:content] \endgraf \egroup \stopsetups (beware, don't redefine a module m-letter-re since only the first 8 chars count; better put your local variant in an environment % re-letter.tex \startenvironment re-letter \usemodule[letter] .... \stopenvironment and then \environment re-letter Hans ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: m-letter.tex -- backslash interpretation error 2005-01-10 18:08 ` Hans Hagen @ 2005-01-10 19:34 ` Rob Ermers 2005-01-11 10:15 ` Hans Hagen 2005-01-11 7:48 ` Christopher Creutzig 1 sibling, 1 reply; 10+ messages in thread From: Rob Ermers @ 2005-01-10 19:34 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 630 bytes --] Hans, Thanks for your quick reply. I adapted the file, according to your suggestion. The letter now comes out right! Thank you for that. I immediately tried an items list, which also works! Still, if there is any \ code in the xml file, it does not seem to work. Changing \"e to ë in Drie\"eenheid makes the ë disappear. <contact ...> ... <p>Laan der Drie\"eenheid</p> ... </contact> comes out as: ... Laan der Drie“”eenheid ... I also found out that \usemodule[m-letter] works much better than \usemodule[letter], which is not evident from the way is Context set up. Thanks again, Robert [-- Attachment #2: brief-test.tex --] [-- Type: text/plain, Size: 1747 bytes --] %starttext \setups [letter:place] \stoptext \endinput \setupoutput[pdftex] %\tracelayerstrue %\usemodule[xtag-ini] \usemodule[corres] \usemodule[m-letter] \mainlanguage[nl] \setupbodyfont[ss] %\setvariables[letter:head][graphic=briefpapier-mo-p.010.pdf] \definelayer [letternext] [state=next, % graphic=briefpapier-mo-p.011.pdf, width=\paperwidth, height=\paperheight] \setvariables [letter:reference] [line=2, noflines-min=2, noflines-max=5, noflines=\getvariable{letter:reference}{noflines-max} ] \setvariables [letter:style] [opening=formal, closing=formal] %\setvariables % [letter:data] % [opening=, % initials=, % prefix=, % suffix=, % informalname=, % formalname=] % noflines=10] \setvariables[letter:address][line=6, hoffset=100mm,width=70mm] %\startsetups[contact:handle] %\XMLflush{address} \endgraf %\stopsetups %\startbuffer[texletter] %\input brieftekst-pol-jan2005 %\stopbuffer \setvariables [letter:data] [address=\XMLflush{address}, %prefix=\XMLflush{prefix}, %initials=\XMLflush{initials}, %formalname=\XMLflush{formalname}, %informalname=\XMLflush{informalname} %content={\getbuffer[texletter]}, %,content=\getbuffer concerns=Ge\"interesseerd?, date=10 januari 2005, author=Dr. R.J.H.M. Ermers ] \setvariables[contacts][selection=n, file=test-data.xml] \startsetups[contact:handle] \setups[letter:place] \stopsetups \startsetups[letter:content] \input brief-inhoud-test.tex \stopsetups \startsetups[letter:place:content] \bgroup \disableXML \endgraf \setups[letter:content] \endgraf \egroup \stopsetups \XMLprocesscontacts[test-data.xml] \starttext %\setups[letter:place] \stoptext [-- Attachment #3: Type: text/plain, Size: 139 bytes --] _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: m-letter.tex -- backslash interpretation error 2005-01-10 19:34 ` Rob Ermers @ 2005-01-11 10:15 ` Hans Hagen 0 siblings, 0 replies; 10+ messages in thread From: Hans Hagen @ 2005-01-11 10:15 UTC (permalink / raw) Rob Ermers wrote: > Thanks for your quick reply. I adapted the file, according to your > suggestion. The letter now comes out right! Thank you for that. I > immediately tried an items list, which also works! > > Still, if there is any \ code in the xml file, it does not seem to work. > Changing \"e to ë in Drie\"eenheid makes the ë disappear. > > <contact ...> > ... > <p>Laan der Drie\"eenheid</p> > ... > </contact> > > comes out as: > > ... > Laan der Drie“”eenheid > ... > > I also found out that \usemodule[m-letter] works much better than > \usemodule[letter], which is not evident from the way is Context set up. maybe your local m-letter-re gets loaded otherwise Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: m-letter.tex -- backslash interpretation error 2005-01-10 18:08 ` Hans Hagen 2005-01-10 19:34 ` Rob Ermers @ 2005-01-11 7:48 ` Christopher Creutzig 2005-01-11 9:52 ` Hans Hagen 1 sibling, 1 reply; 10+ messages in thread From: Christopher Creutzig @ 2005-01-11 7:48 UTC (permalink / raw) Hans Hagen wrote: > (beware, don't redefine a module m-letter-re since only the first 8 > chars count; better put your local variant in an environment BTW: Is this anachronistic limitation to 8 characters planned to disappear? With the additional t- or u- at the front, we've got a limitation to six characters, which is really extremely little. Christopher ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: m-letter.tex -- backslash interpretation error 2005-01-11 7:48 ` Christopher Creutzig @ 2005-01-11 9:52 ` Hans Hagen 0 siblings, 0 replies; 10+ messages in thread From: Hans Hagen @ 2005-01-11 9:52 UTC (permalink / raw) Christopher Creutzig wrote: > Hans Hagen wrote: > >> (beware, don't redefine a module m-letter-re since only the first 8 >> chars count; better put your local variant in an environment > > > BTW: Is this anachronistic limitation to 8 characters planned to > disappear? With the additional t- or u- at the front, we've got a > limitation to six characters, which is really extremely little. i dunno if there are dos users out there ... in practice it is no real problem, since context can map longer names (see cont-fil.tex) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-01-11 10:15 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2005-01-07 18:35 XML question regarding special characters Zeljko Vrba 2005-01-07 19:23 ` Adam Lindsay 2005-01-09 14:06 ` m-letter.tex -- backslash interpretation error Rob Ermers 2005-01-09 20:04 ` h h extern 2005-01-10 17:10 ` Rob Ermers 2005-01-10 18:08 ` Hans Hagen 2005-01-10 19:34 ` Rob Ermers 2005-01-11 10:15 ` Hans Hagen 2005-01-11 7:48 ` Christopher Creutzig 2005-01-11 9:52 ` Hans Hagen
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).