# Synchronise data spanning over two side-by-side pages in ConTeXt

I am working on a three-language glossary. The idea is having three columns (German, English, Italian) spanning on two pages side-by-side. The data are stored in an XML file whose structure is the following

<root>
<row>
<mainD>Altern (n)</mainD>
<mainE>ageing (En)</mainE>
<mainI>Invecchiamento</mainI>
<desD>Änderung der Eigenschaften eines Werkstoffs bei oder in der Nähe der Raumtemperatur in Abhängigkeit von der Zeit (Natürliche Alterung bei Raumtemperatur; künstliche bei erhöhter Temperatur)</desD>
<desE>A change in properties with time that may occur gradually at room temperature (natural ageing) and more rapidly at higher temperatures (artificial ageing)</desE>
<desI>Modifica nel tempo delle proprietà; può avvenire a temperatura ambiente (invecchiamento naturale) oppure a temperatura elevata (invecchiamento artificiale)</desI>
<norm>VDI 3137</norm>
</row>
...
</root>


After reading a lot of posts on SX, I ended up working on ConTeXt.

At present I am working on three alternative solutions, using different approaches.

# 1

The first one simply works with paragraphs as described here. Here I am showing an example with only two languages, German and Italian. The approach is taking advantage o the synchronisation between paragraphs through \obeylines in order to provide the desired structure. Nevertheless I was not able to extend this approach to span over three columns with three different languages and, hence, using two pages side-by-side.

\startxmlsetups xml:root
\defineparagraphs[GermanItalian][n=2,before={\blank},after {\blank},tolerance=verystrict,align=flushleft]
\setupparagraphs [GermanItalian][1][width=.5\textwidth]
\setupparagraphs [GermanItalian][2][width=.5\textwidth]
\starttext
\startGermanItalian
\bf{German}
\GermanItalian
\bf{Italian}
\stopGermanItalian
\xmlflush{#1}
\endtext
\stopxmlsetups

\startxmlsetups xml:row
\startGermanItalian
\obeylines
{\bf \xmltext{#1}{./mainD}}  \break \xmltext{#1}{./desD}
\nextGermanItalian
\obeylines
{\bf \xmltext{#1}{./mainI} }    \break \xmltext{#1}{./desI}
\stopGermanItalian
\xmlflush{#1}
\stopxmlsetups

\starttext
\xmlprocessfile{dict}{test01sx.xml}{}
\stoptext


# 2

The second approach uses simple tables instead of paragraphs. Here I show the three languages structure but I am not able to let them span over two pages side-by-side.

\startxmlsetups xml:root
\bTABLE[split=repeat,option=stretch]% head on every page, stretch columns
\bTR
\bTH German \eTH
\bTH  English \eTH
\bTH  Italian \eTH
\eTR
\bTABLEnext
\bTR
\bTH German \eTH
\bTH  English \eTH
\bTH  Italian \eTH
\eTR
\eTABLEnext
\bTABLEbody
\xmlflush{#1}
\eTABLEbody
\eTABLE
\stopxmlsetups

\startxmlsetups xml:row
\bTR
\bTC  {\bf \xmltext{#1}{./mainD}}  \\ \indentation \xmltext{#1}{./desD}
\eTC
\bTC  {\bf \xmltext{#1}{./mainE} } \\ \indentation \xmltext{#1}{./desE}
\eTC
\bTC  {\bf \xmltext{#1}{./mainI} } \\ \indentation \xmltext{#1}{./desI}
\eTC
\eTR
\stopxmlsetups

\starttext
\xmlprocessfile{dict}{test01sx.xml}{}
\stoptext


# 3

The last approach is an attempt to address the two-page issue using \linetableas shown in the context documentation. I tested the \linetable approach with numbers and it seems working, although I need to learn how to trigger specific needs. Nevertheless, when putting text inside of the cell it seems failing. The desired spacing is not respected and also the synchronisation between the adjoined pages. Here is the example.

\startxmlsetups xml:root
\defineparagraphs [mypar][n=1,tolerance=verystrict,align=flushleft]
\setupparagraphs [mypar][1] [width=0.4\textwidth]
\setuplinetable[n=3][split=yes]
\setuplinetable[c][3] [width=\textwidth]
\startlinetable
\BH
\BC German \EC
\BC English \EC
\BC Italian  \EC
\EH
\xmlflush{#1}
\stoplinetable
\stopxmlsetups

\startxmlsetups xml:row
\NC \startmypar
{\bf \xmltext{#1}{./mainD}} \break \xmltext{#1}{./desD}
\stopmypar
\NC \startmypar
{\bf \xmltext{#1}{./mainE}} \break \xmltext{#1}{./desE}
\stopmypar
\NC \startmypar
{\bf \xmltext{#1}{./mainI} }   \break \xmltext{#1}{./desI}
\stopmypar
\NC
\NR
\xmlflush{#1}
\stopxmlsetups

\starttext
\xmlprocessfile{dict}{test01sx.xml}{}
\stoptext


Is anybody able to provide any suggestion?

• That's a hard problem. For LaTeX there is reledmac for this kind of stuff. I'm not aware of any ConTeXt solution to this problem. Consider asking this question on the mailing list. – Henri Menke Jul 16 '17 at 21:14
• I found a thread on the mailing list which might be interesting for you (warning: it's very long). – Henri Menke Jul 16 '17 at 21:17
• @henri unfortunately having a left page with two synchronised columns and a right page with other columns is not possible in reledmac, this has been discussed here (tex.stackexchange.com/questions/340622/…) – Michele Jul 17 '17 at 1:30
• a short update, an approximate solution exists , an example can be found here (github.com/maieul/ledmac/issues/415) using \multicolpar. I tested but has some issues, if the longest of the paragraph is in the multicol part, then the multi-pass approach of reledmac fails in reshaping the two pages correctly. – Michele Jul 17 '17 at 13:40
• – Henri Menke Jul 19 '17 at 21:03