23

Is it possible to use tabularx inside a longtable environment?

If not, is there any way I can get the "X" funcionality of tabularx with the option of long tables ---In order for me to be able to break them in two pages? Using longtabu is not an option, as stated by @jon here:

I would recommend staying away from tabu as the package author is still fiddling with things and explicitly promised that there would not be backwards compatibility. See here for the discussion.

UPDATE:

Using the package ltxtable suggested by @Alan Munn (Writeen by @David Carlisle) I have the current Minimal Non-Working Example

Main File:

\documentclass{article}

\usepackage{array}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{ltxtable}

\begin{document}
Hello.

\LTXtable{\textwidth}{VersionOne}

\end{document}  

Where the file VersionOne goes:

\begin{longtable}{XX}
\caption{A very long table}\\
WHO                 & \hspace{5mm} World Health Organization\\[1mm]
GDP                 & \hspace{5mm} Gross Domestic Product\\[1mm]
PPP                 & \hspace{5mm} Purchasing Power Parities\\[1mm]
\label{tab:LongtableOne}
\end{longtable}

When I try to run this code, I get a Emergency Stop and a fatal error. Am I writing this correctly?

  • 5
    There is the ltxtable package by David Carlisle which combines the capabilities of both. – Alan Munn Apr 2 '13 at 4:54
  • 1
    @AlanMunn, Could you please give an example? The documentation (ftp.di.uminho.pt/pub/ctan/macros/latex/contrib/carlisle/…) is not very explicative, and I wasn't able to run anything – Mario S. E. Apr 2 '13 at 15:26
  • 2
    Just put your longtable in a separate file and include it with \LTXtable{\textwidth}{name-of-file-with-table} – David Carlisle Apr 2 '13 at 15:49
  • And what about the Xs? Should I also write a tabularx environment? – Mario S. E. Apr 2 '13 at 16:10
  • 3
    @MarioS.E. No just use X in the longtable preamble – David Carlisle Apr 2 '13 at 16:53
13

As stated in the comments for ltxtable the longtable has to be in a separate file. Processing the updated example (twice) with pdflatex produces

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.