3

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
  \bTABLEhead
    \bTR
      \bTH German \eTH
      \bTH  English \eTH
      \bTH  Italian \eTH
    \eTR
    \eTABLEhead
    \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

Example with <code>\linetable</code>

Is anybody able to provide any suggestion?

Thank you in advance. Michele

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.