0

as part of an article, I am translating a text from an oriental language to German. I am writing the short introductiona and then follows the text. Thus, I wanted to place it in a table with two columns and two lines. My problem: I am using xltabular and it does not make an automatic pagebreak. How can I fix it? For the oriental languages, it is important to avoid line breaks. Here is my MWE:

\documentclass{article} \usepackage{xltabular} \keepXColumns \usepackage{blindtext} \begin{document} In the next lines, the text will be translated into German: \begin{xltabular}[l]{0.75\linewidth}{@{} lX @{}} \caption{The \texttt{xltabular} environment with \texttt{longtable} property and left aligned by setting the optional argument.}\\[\belowcaptionskip]\hline Arabic & German\\ \hline Left column & At first a line with some nonsense text to show how long this line is. The caption has the same width as the text. At first a line with some nonsense text to show how long this line is. The caption has the same width as the text At first a line with some nonsense text to show how long this line is. The caption has the same width as the text At first a line with some nonsense text to show how long this line is. The caption has the same width as the text At first a line with some nonsense text to show how long this line is. The caption has the same width as the text At first a line with some nonsense text to show how long this line is. The caption has the same width as the text At first a line with some nonsense text to show how long this line is. The caption has the same width as the text At first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the textAt first a line with some nonsense text to show how long this line is. The caption has the same width as the text\\ t\\\hline \end{xltabular} \end{document} 
1
  • Welcome to TeX.SX! Well, longtable (or xltabular which does more or less the same) can break tables so that they can span over several pages, but it does not break the contents of cells. Commented Aug 17, 2022 at 19:19

1 Answer 1

0

While it is possible to split tables over several pages, you cannot split a single cell. This is due to the fact that a cell is an unbreakable box and therefore holds true for xltabular as well as for longtable and in general for every tabular environment.

I therefore suggest a different approach, although it comes with certain restrictions, too: You can use a description environment and style this according to your needs using the enumitem package. This way, at least the right "column" which contains the description text is breakable over several pages.

The left "column" that holds the label (which is now placed inside a \parbox) cannot break across pages, though. Also, if the text in the left "column" is longer than the text in the right "column", it will overlap the following row.

\documentclass{article} \usepackage{enumitem} \newlist{translation}{description}{1} \setlist[translation]{align=parleft, labelwidth=*, leftmargin=14em, font=\normalfont, before=\raggedright} \usepackage{lipsum} \begin{document} \begin{translation} \item[\textbf{English}] \textbf{German} \item[One morning, as Gregor Samsa was waking up from anxious dreams, he discovered that in bed he had been changed into a monstrous verminous bug. He lay on his armour-hard back and saw, as he lifted his head up a little, his brown, arched abdomen divided up into rigid bow-like sections.] Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem ungeheueren Ungeziefer verwandelt. Er lag auf seinem panzerartig harten Rücken und sah, wenn er den Kopf ein wenig hob, seinen gewölbten, braunen, von bogenförmigen Versteifungen geteilten Bauch, auf dessen Höhe sich die Bettdecke, zum gänzlichen Niedergleiten bereit, kaum noch erhalten konnte. Seine vielen, im Vergleich zu seinem sonstigen Umfang kläglich dünnen Beine flimmerten ihm hilflos vor den Augen. \item[``What's happened to me,'' he thought. It was no dream.] \lipsum[1-2] \end{translation} \end{document} 

enter image description here


Some notes:

In case you want to use square brackets [] inside the argument for \item, you need to place the whole argument between curly braces {}. So, it should look like this: \item[{something with [square] brackets}]

If you wish to have the text in the first column centered or right aligned, you can do this by defining a new align style using \SetLabelAlign and then use this style with the option align:

\SetLabelAlign{parcenter}{\strut\smash{\parbox[t]\labelwidth{\centering #1}}} \newlist{translation}{description}{1} \setlist[translation]{align=parcenter, labelwidth=*, leftmargin=14em, font=\normalfont, before=\raggedright} 
8
  • Thanks for the answer. The problem with this solution is that I had some additions or clarifications of my translation and I had to put them in square brackets "[...]". How can this be fixed? Commented Aug 17, 2022 at 21:15
  • @into You mean that you need to use square brackets inside of \item[]? You should then place curly braces {...} around everything: \item[{something with [square] brackets}]. Commented Aug 17, 2022 at 21:18
  • Yes, exactly; problem solved. Next problem: How can I make the first column centered and the last one left-aligned? Commented Aug 17, 2022 at 21:37
  • @into See my edit. Remove before=\raggedright if you want the right column to have justified (last line left aligned) text. Commented Aug 17, 2022 at 21:44
  • Thanks again. I made a mistake: The first column should not be centered, but justified - what should be changed for that. Another question: I have several of such smaller translations and I want to know if it is possible not to standardize the measure of the leftmargin, but changed it in some cases? Commented Aug 17, 2022 at 21:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.