0

I've been using tabularx and \begin{tabularx}{\textwidth}{X X} to get two equally spaced columns with text aligned to the left. Example:

\begin{table}[H]
    \begin{tabularx}{\textwidth}{X X}
        die Kleidung & clothes \\
        der Schuh & shoe
    \end{tabularx}
\end{table}

The problem is that if I create a long table, the content goes outside the bottom page margins, like this: enter image description here How can I break this table automatically while keeping exactly the same alignment?

I've tried using the packages longtable, ltablex and ltxtable, unsuccessfully. Whenever I get the break to work properly at the end of the page, the alignment does not. See below. enter image description here However, this solution is still pretty bad... not only due to the alignment I can't fix, but also because it spoils all other tabularx tables. The next image shows how a table using \begin{tabularx}{\textwidth}{@{}Y|Y|Y@{}} becomes different. See how it changes below.enter image description here

  • 2
    Welcome to TeX SX! You have the xltabular package. Its eponymous environment brings the functionalities of longtable to tabularx (with the syntax of longtable – endhead, \endfirsthead &c.) – Bernard Apr 12 '20 at 22:07
  • @Bernard thank you for the welcome and the reply! I had to upload this xltabular package on Overleaf manually, but it worked perfectly. I have spent so much time trying to solve this problem and xltabular package solved it so easily. It seems I don't even need tabularx anymore. You are awesome, thank you! Please, add this as an answer so I can accept it. :) – Ashitaka Apr 12 '20 at 23:22
  • I don't think it is useful, there are already other answers mentioning it (including by me) but I don't remember where on this site. This package loads tabularx, but it has a slightly different syntax, due to the incorporation of features from long table. I believe that, just like long table, it does not float, so tabularx still has its usefulness for shorter tables – Bernard Apr 12 '20 at 23:39
  • @Bernard I have opened a lot of stackexchange pages about it and none could help me, unfortunately. And I will keep what you said about tabularx in mind. Thank you again! BTW, how can this topic be closed as done/answered if I can't accept your comment as an answer? – Ashitaka Apr 12 '20 at 23:45
  • No idea, but don't care, someone surely will know :-) – Bernard Apr 12 '20 at 23:48

0 Answers0