Dear Thomas, Many thanks for your My Way about « Getting Web Content and pdf-Output from One Source »: first of all I must say that you are « un grand pédagogue »! Thanks to you, I dared to begin to learn how to use the same file on the web and as a ConTeXt source, and had a look to the manual written by Hans, xml-mkiv.pdf, which is indeed great, like all other manuals written by him. (By the way, without participating to the thread on ConTeXt documentation, when I was reading Hans' manual on xml-mkiv, I noticed that only on my computer there are more than 80 different manuals, ranging from manuals for beginners to high level documentation for experts... For all everyday matters these manuals contain what I, or an ordinary user, may need). Regarding the tutorial you have written, although the typo may be corrected by any cautious reader, I think that, on page 2, lines 5 and 6 of your My Way it should be </body> </html> I don't know whether the following observation is correct or not: I had to add at the beginning of the file « ourenvironment.tex » which must contain the xml setups, the command \startenvironment ourenvironment and at the end of that file: \stopenvironment before being able to get what you describe. The curious thing is that even when I didn't add \startenvironment ourenvironment but I did add \stopenvironment the xml file was processed by ConTeXt. For beginners like me, I think this should be said clearly somewhere. Also, in order to have a better PDF in your examples, at some point I understood that in order to have appropriate white space between paragraphs and tables one could, or should, add the tag for preformatted text: <pre> </pre> and transform it into \blank by ConTeXt. To this end one has to add the tag pre to \xmlsetup: \xmlsetsetup{\xmldocument}{html|body|h1|h2|p|em|q|b|table|tr|th|td|pre}{xml:*} and then \startxmlsetups xml:pre \xmlflush{#1}\blank[big] \stopxmlsetups to the environment. Finally a qusetion: is there a way to obtain an xml file from a rather simple TeX source, written with ConTeXt commands? Here by simple I mean something which contains text and math formulas, such as a list of problems and exercises. Best regards: OK
Hi Otared, thanks for the feedback and the kind words! On Mar 10, 2010, at 12:54 PM, Otared Kavian wrote:
Regarding the tutorial you have written, although the typo may be corrected by any cautious reader, I think that, on page 2, lines 5 and 6 of your My Way it should be </body> </html>
Of course! Thanks for spotting this.
I don't know whether the following observation is correct or not: I had to add at the beginning of the file « ourenvironment.tex » which must contain the xml setups, the command \startenvironment ourenvironment
and at the end of that file: \stopenvironment
before being able to get what you describe. The curious thing is that even when I didn't add \startenvironment ourenvironment but I did add \stopenvironment the xml file was processed by ConTeXt. For beginners like me, I think this should be said clearly somewhere.
Really? No, I don't think you need to have this. When I process context --environment=ourenvironment ourfile.xml it gets processed even without the \start \stop pair you describe.
Also, in order to have a better PDF in your examples, at some point I understood that in order to have appropriate white space between paragraphs and tables one could, or should, add the tag for preformatted text: <pre>
</pre>
and transform it into \blank by ConTeXt. To this end one has to add the tag pre to \xmlsetup: \xmlsetsetup{\xmldocument}{html|body|h1|h2|p|em|q|b|table|tr|th|td|pre}{xml:*}
and then \startxmlsetups xml:pre \xmlflush{#1}\blank[big] \stopxmlsetups
to the environment.
Yes, I was bothered by the lack of whitespace too, but I wanted to keep it simple. adding <pre> would be one way; another way would be to add something like \blank[line]\par at the end of the setup commands. But I wasn't sure what would be more confusing to beginners: the somewhat ugly output or these additions.
Finally a qusetion: is there a way to obtain an xml file from a rather simple TeX source, written with ConTeXt commands? Here by simple I mean something which contains text and math formulas, such as a list of problems and exercises.
That's a very interesting question. Hans has this intriguing paragraph in the older manual, example.pdf: "In ConTEXt we use a strange but charming way to handle this conversion: we simply typeset xml. The typeset document (with lots of angle brackets) is then converted into raw text. A complication is math, but given that you can embed MathML in your document, this can be passed on directly." The question how this can be done has been asked several time on the list, but so far, I haven't seen an answer. Maybe you need to buy Hans lots of beer at the next ConTeXt meeting, and he will finally fess up! Thanks, and best wishes Thomas
On 10-3-2010 13:50, Thomas A. Schmitz wrote:
That's a very interesting question. Hans has this intriguing paragraph in the older manual, example.pdf: "In ConTEXt we use a strange but charming way to handle this conversion: we simply typeset xml. The typeset document (with lots of angle brackets) is then converted into raw text. A complication is math, but given that you can embed MathML in your document, this can be passed on directly." The question how this can be done has been asked several time on the list, but so far, I haven't seen an answer. Maybe you need to buy Hans lots of beer at the next ConTeXt meeting, and he will finally fess up!
\def\chapter#1{\par<h1>#1</h1>\par} \def\bTABLE{\par<table>\crlf} \def\eTABLE{</table>\par} \def\bTR{<tr>} \def\eTR{</tr>\crlf} \def\bTD{<td>} \def\eTD{</td>} \prependtoks <html><body>\to\everystarttext \prependtoks</body><html>\to\everystoptext \setupwhitespace[line] \setuplayout [page] \setupbodyfont [tt] % 1pt \starttext \chapter{First} \input tufte \chapter{Second} \input tufte \bTABLE \bTR \bTD test \eTD \eTR \eTABLE \stoptext and then pdftotext on the result but it's sort of a joke (some day i will cook up a nice mkiv variant which does not demand redefinitions) 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 -----------------------------------------------------------------
On Wed, 10 Mar 2010 18:21:13 +0100
Hans Hagen
\prependtoks <html><body>\to\everystarttext \prependtoks</body><html>\to\everystoptext
\prependtoks</body></html>\to\everystoptext
\setupwhitespace[line]
[...]
(some day i will cook up a nice mkiv variant which does not demand redefinitions)
Hans
Hm, I did not follow the thread. Where can I read "My Way ..." - I am interested in Context -> HTML |& PDF.
----------------------------------------------------------------- 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 ----------------------------------------------------------------- ___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- René Bastian www.pythoneon.org www.musiques-rb.org http://www.soundsurvey.org.uk/
On Wed, Mar 10, 2010 at 2:36 PM, R. Bastian
Hm, I did not follow the thread. Where can I read "My Way ..." - I am interested in Context -> HTML |& PDF.
participants (5)
-
Fernan Aguero
-
Hans Hagen
-
Otared Kavian
-
R. Bastian
-
Thomas A. Schmitz