Missing <break/> while exporting to xml before <highlight>
Hi! See the following minimal example: %%% start example \setupbackend[export=yes] \definehighlight[emph][style=italic] \starttext Hey, hello! \emph{Hello world!} \stoptext %%% stop example And the output is: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <!-- input filename : prova --> <!-- processing date : Sun Nov 6 14:50:01 2011 --> <!-- context version : 2011.11.04 14:15 --> <!-- exporter version : 0.30 --> <document language="en" file="prova" date="Sun Nov 6 14:50:01 2011" context="2011.11.04 14:15" version="0.30" xmlns:m="http://www.w3.org/1998/Math/MathML"> Hey, hello! <highlight detail="emph">Hello world!</highlight> </document> Best regards -- Marco
Hi! The highlight seems to act strangely. In addition to the previous report, I get an unwanted <break/>: %%% start example \setupbackend[export=yes] \definehighlight[emph][style=italic] \starttext \section{test} \emph{Hello} world! \stoptext %%% stop example And the output is: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <!-- input filename : prova --> <!-- processing date : Sun Nov 6 21:35:51 2011 --> <!-- context version : 2011.11.04 14:15 --> <!-- exporter version : 0.30 --> <document language="en" file="prova" date="Sun Nov 6 21:35:51 2011" context="2011.11.04 14:15" version="0.30" xmlns:m="http://www.w3.org/1998/Math/MathML"> <section detail="section" location='aut:1'> <sectionnumber>1</sectionnumber> <sectiontitle>test</sectiontitle> <sectioncontent> <highlight detail="emph">Hello</highlight> <break/> world! </sectioncontent> </section> </document> Am I doing it wrong? Best wishes -- Marco
On 6-11-2011 21:38, Marco Pessotto wrote:
Hi!
The highlight seems to act strangely. In addition to the previous report, I get an unwanted<break/>:
%%% start example \setupbackend[export=yes] \definehighlight[emph][style=italic]
\starttext
\section{test}
\emph{Hello} world!
\stoptext %%% stop example
It has to do with the way grouping interferes with the start of a paragraph \dontleavehmode \emph ... I'll make highlights horizontal by default 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 -----------------------------------------------------------------
Hans Hagen
On 6-11-2011 21:38, Marco Pessotto wrote:
Hi!
The highlight seems to act strangely. In addition to the previous report, I get an unwanted<break/>:
%%% start example \setupbackend[export=yes] \definehighlight[emph][style=italic]
\starttext
\section{test}
\emph{Hello} world!
\stoptext %%% stop example
It has to do with the way grouping interferes with the start of a paragraph
\dontleavehmode \emph ...
I'll make highlights horizontal by default
It works, thanks a bunch. The previous missing <break/> seems to be fixed wrapping the paragraph with \startparagraph \stopparagraph. I assume this is the right thing to do for a proper export, isn't it? Btw, is there a way to run context just for the xml output (as I'm doing conditional runs, and I discard the pdf which comes with the xml as a side effect). context --help doesn't seem to have an option for that. Well, not so important, just asking. Thanks again Best wishes -- Marco
On 7-11-2011 08:53, Marco wrote:
Hans Hagen
writes: On 6-11-2011 21:38, Marco Pessotto wrote:
Hi!
The highlight seems to act strangely. In addition to the previous report, I get an unwanted<break/>:
%%% start example \setupbackend[export=yes] \definehighlight[emph][style=italic]
\starttext
\section{test}
\emph{Hello} world!
\stoptext %%% stop example
It has to do with the way grouping interferes with the start of a paragraph
\dontleavehmode \emph ...
I'll make highlights horizontal by default
It works, thanks a bunch. The previous missing<break/> seems to be fixed wrapping the paragraph with \startparagraph \stopparagraph. I assume this is the right thing to do for a proper export, isn't it?
Indeed. On and off I'm trying to make the automatic recognition more clever but too much guessing is bad too.
Btw, is there a way to run context just for the xml output (as I'm doing conditional runs, and I discard the pdf which comes with the xml as a side effect). context --help doesn't seem to have an option for that. Well, not so important, just asking.
Currently not. It would also complicate matters as we need to flush some information in the pdf backend that is needed in following passes. 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 -----------------------------------------------------------------
I think I'm hitting another bug with highlights: See this following example: %%% start example \setupbackend[export=yes] \definehighlight[emph][style=italic] \starttext \startparagraph Published on \dontleavehmode\emph{Dissonanze} vol. I \stopparagraph \startparagraph Published on vol. I Published on vol. I Published on vol. I Published on \dontleavehmode\emph{Dissonanze} vol. I \stopparagraph \stoptext %%% stop example Output: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <!-- input filename : prova --> <!-- processing date : Mon Nov 7 09:32:00 2011 --> <!-- context version : 2011.11.04 14:15 --> <!-- exporter version : 0.30 --> <document language="en" file="prova" date="Mon Nov 7 09:32:00 2011" context="2011.11.04 14:15" version="0.30" xmlns:m="http://www.w3.org/1998/Math/MathML"> <paragraph>Published on <highlight detail="emph">Dissonanze</highlight> vol. I</paragraph> <paragraph>Published on vol. I Published on vol. I Published on vol. I Published on <highlight detail="emph">Dissonanze</highlight>vol. I</paragraph> </document> As you can see, in the first case the space after "Dissonanze" is preserved, while in the second paragraph the space is eaten and there's no way to add it. The only thing that changes is the lenght of the paragraph. (Oh, and thanks for the previous reply). Best wishes -- Marco
Well, after some trial and errors, I think I get what is going on with the highlight. When on the generated pdf the </highlight> is at the edge of the paper, the space is eaten. Hacky workaround follows: %% start example \setupbackend[export=yes] \definehighlight[emph][style=italic] \startmode[huge] \definepapersize[huge][width=4000mm] \setuppapersize[huge][huge] \setupbodyfont[8pt] \stopmode \starttext \startparagraph Published on \dontleavehmode\emph{Dissonanze} vol. I \stopparagraph \startparagraph Published on vol. I Published on vol. I Published on vol. I Published on \dontleavehmode\emph{Dissonanze} vol. I \stopparagraph \startparagraph Published on vol. I Published on vol. I Published on vol. I Published on blablabla \dontleavehmode\emph{Dissonanze} vol. I \stopparagraph \stoptext %%% stop example Compiled with context prova.tex, the space is eaten on the second paragraph. See produced pdf. <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <!-- input filename : prova --> <!-- processing date : Mon Nov 7 17:43:10 2011 --> <!-- context version : 2011.11.04 14:15 --> <!-- exporter version : 0.30 --> <document language="en" file="prova" date="Mon Nov 7 17:43:10 2011" context="2011.11.04 14:15" version="0.30" xmlns:m="http://www.w3.org/1998/Math/MathML"> <paragraph>Published on <highlight detail="emph">Dissonanze</highlight> vol. I</paragraph> <paragraph>Published on vol. I Published on vol. I Published on vol. I Published on <highlight detail="emph">Dissonanze</highlight>vol. I</paragraph> <paragraph>Published on vol. I Published on vol. I Published on vol. I Published on blablabla <highlight detail="emph">Dissonanze</highlight> vol. I</paragraph> </document> With `context --mode=huge prova.tex` everything is fine (As the paper is 4 meters long on 8pt!) <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <!-- input filename : prova --> <!-- processing date : Mon Nov 7 17:44:02 2011 --> <!-- context version : 2011.11.04 14:15 --> <!-- exporter version : 0.30 --> <document language="en" file="prova" date="Mon Nov 7 17:44:02 2011" context="2011.11.04 14:15" version="0.30" xmlns:m="http://www.w3.org/1998/Math/MathML"> <paragraph>Published on <highlight detail="emph">Dissonanze</highlight> vol. I</paragraph> <paragraph>Published on vol. I Published on vol. I Published on vol. I Published on <highlight detail="emph">Dissonanze</highlight> vol. I</paragraph> <paragraph>Published on vol. I Published on vol. I Published on vol. I Published on blablabla <highlight detail="emph">Dissonanze</highlight> vol. I</paragraph> </document> So, my impression is that for exporting the modal compilation is not an option. Is there a way to set the paper width to infinity? (Even if, speaking about impression, I believe the 4 meters are enough for the average usage). Best wishes -- Marco
On Mon, 7 Nov 2011, Marco Pessotto wrote:
So, my impression is that for exporting the modal compilation is not an option.
So far, that has been my impression as well. I need a lot of tweaks to get the right XML output (and I also need (multiple) PDF output). I have set a separate mode for XML export, and use something equivalent to context --mode=screen --result=s-filename filename to get a screen version of the document, context --mode=handout --result=h-filename filename to get a handout version of the document, and context --mode=export filename to get an xml version.
Is there a way to set the paper width to infinity? (Even if, speaking about impression, I believe the 4 meters are enough for the average usage).
TeX does finite precision arithematics, so infinity is not possible. But you can set paper width (and paper height) to \maxdimen, which is the maximum dimension TeX can handle. \definepapersize[max][paperwidth=\maxdimen, paperheight=\maxdimen] \setuppapersize[max] Aditya
Aditya Mahajan
TeX does finite precision arithematics, so infinity is not possible. But you can set paper width (and paper height) to \maxdimen, which is the maximum dimension TeX can handle.
\definepapersize[max][paperwidth=\maxdimen, paperheight=\maxdimen] \setuppapersize[max]
Thanks! -- Marco
On 7-11-2011 17:48, Marco Pessotto wrote:
Well, after some trial and errors, I think I get what is going on with the highlight. When on the generated pdf the</highlight> is at the edge of the paper, the space is eaten. Hacky workaround follows:
i rewrote some of the 'heuristics' so best test the next beta 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 -----------------------------------------------------------------
Hans Hagen
On 7-11-2011 17:48, Marco Pessotto wrote:
Well, after some trial and errors, I think I get what is going on with the highlight. When on the generated pdf the</highlight> is at the edge of the paper, the space is eaten. Hacky workaround follows:
i rewrote some of the 'heuristics' so best test the next beta
I will for sure. Looking forward to the beta. Thanks Best wishes -- Marco
Hans Hagen
On 7-11-2011 17:48, Marco Pessotto wrote:
Well, after some trial and errors, I think I get what is going on with the highlight. When on the generated pdf the</highlight> is at the edge of the paper, the space is eaten. Hacky workaround follows:
i rewrote some of the 'heuristics' so best test the next beta
In my testing the latest beta (2011.11.08 15:20) works well, and it fixes some other problems (random <break/>, space eaten before <highlight> which I noticed only now diff'ing the output and which my infamous hacky workaround didn't fix). Thanks a lot! Best wishes -- Marco
participants (4)
-
Aditya Mahajan
-
Hans Hagen
-
Marco
-
Marco Pessotto