12

I am trying to make a full page table using tabularx. As far as I can understand, the second parameter specifies the entire size and the "X" columns self-stretch to fill it up. What I run into is a table that is split at the end of the page and I cannot seem to make it shift to the right. What am I doing wrong here? I should also mentioned I've tried experimeting with textheight and textwidth but could not figure out how to force the width.

Example code below:

\documentclass[a4paper,12pt]{scrartcl}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{lipsum}

\begin{document}
  \begin{landscape}

   \begin{tabularx}{290mm}{|c|c|c|X|}
   \hline
   Lorem & Lorem & Lorem & \lipsum[1] \\
   \hline
   \end{tabularx}

  \end{landscape}
\end{document}
17

you have some issues, first off the 290mm should really be \linewidth or \textwidth. Second, you should put a \noindent in front of the tabular. And finally, not so much of an issue, remove the page number.

\documentclass[a4paper,12pt]{scrartcl}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{lipsum}

\begin{document}
  \begin{landscape}
    \thispagestyle{empty}
    \noindent
    \begin{tabularx}{\linewidth}{|c|c|c|X|}
      \hline
      Lorem & Lorem & Lorem & \lipsum[1] \\
      \hline
    \end{tabularx}
  \end{landscape}
\end{document}

To address the comment, it's not how I read it, but if that is in fact the case, the following can be used (Adjusted after egreg's comment):

\centering\makebox[0pt][c]{%
  \hskip-\footskip
  \begin{tabularx}{\paperheight}{|c|c|c|X|}
    \hline
    Lorem & Lorem & Lorem & \lipsum[1] \\
    \hline
  \end{tabularx}%
  \hskip\headheight
}
| improve this answer | |
  • I think the original question specifically says that \linewidth is not an option as it keeps the table within the margins. I think the question is to get the table from edge to edge of the page ignoring margins. – ArTourter Mar 22 '12 at 15:17
  • @ArTourter: That's not how I read it, but I added an alternative for that case. – Roelof Spijker Mar 22 '12 at 15:32
  • I'd prefer \centering\makebox[0pt][c]{...} instead of the foreign command \centerline. – egreg Mar 22 '12 at 17:42
  • @egreg: Not that I disagree, but do you have any specific reason for that preference? – Roelof Spijker Mar 23 '12 at 17:09
  • 2
    @RoelofSpijker It's an unsupported command and behaves in a way that users might find surprising (for example it doesn't force horizontal mode). – egreg Mar 23 '12 at 17:12
9

You have a paragraph indent to the left of the table and the specified width is considerably more than the horizontal size, because of the margins. try

  \noindent\begin{tabularx}{\hsize}{|c|c|c|X|}
| improve this answer | |
  • Thank you - very helpful but part of the solution. – Spiros Mar 23 '12 at 13:40

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.