4

I would to make the table in landscape mode. To do that, I used pdflscape package. But I couldn't get the desired result. How to do that?

enter image description here

Here is the MWE:

\documentclass[12pt]{article}
\usepackage{xtab,caption}
\usepackage{pdflscape}
\newcommand\Lenv{\textsf}
\begin{document}
\begin{landscape}
\topcaption{The principal xtab package commands} \label{tab:xtab}
\tablefirsthead{\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablehead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablelasthead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
concluded from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tabletail{\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline}
\tablelasttail{\hline \hline}
\begin{center}
\begin{xtabular}{|l|p{0.5\textwidth}|}
\verb|\begin{xtabular}{...}| & This is equivalent to the normal
\verb|\begin{tabular}{...}| environment.
You supply the specification of the columns
just as for the normal \Lenv{tabular} environment.
\\
&
All commands that can be used within a \Lenv{tabular}
environment can also be used within
the \Lenv{xtabular} environment.
\\
&
Unlike the \Lenv{tabular} environment which prevents page breaking
within the tabular, the \Lenv{xtabular} allows page breaking, so that
tabulars can extend automatically across several pages.
... ... ...\\
\verb|\tablelasttail{...}| & The contents of this command are inserted before
the final (internal) \verb|\end{tabular}| of the table.
\\
&
For example, you might want to note that this is where
the table ends.
\\
\end{xtabular}
\end{center}
\end{landscape}
\end{document} 
| improve this question | | | | |
  • 1
    You can load package showframe. The page is just not big enough. – Johannes_B May 30 '14 at 7:39
  • Have a look at package booktabs. There you can find precious tips on »How to make tabular material more pleasing to the eye«. You can see, that vertical bars are discouraged. – Johannes_B May 30 '14 at 7:40
  • Please indicate what the desired look might be. – Mico May 30 '14 at 8:05
  • Your image shows the table has been rotated, so if that is not the "desired result" you need to say what you do want. – David Carlisle May 30 '14 at 14:58
3

use

 \begin{xtabular}{|l|p{0.5\linewidth}|}

lscape does not change \textwidth in the landscape environment.

| improve this answer | | | | |
  • It is already there in my MWE. I want to make the table in landscape as the paper – subham soni May 30 '14 at 12:33
  • @subhamsoni no your MWE uses \textwidth – David Carlisle May 30 '14 at 13:17
  • @subhamsoni the table in your MWE is already rotated into landscape orientation, it was just no wider than in portrat – David Carlisle May 30 '14 at 13:25
1

Another option is to use \textheight. Since with landscape, text height and text width are not swapped, the width of the table is along the text height. Put proper value in 0.9\textheight:

\documentclass[12pt]{article}
\usepackage{xtab,caption}
\usepackage{pdflscape}
\newcommand\Lenv{\textsf}
\begin{document}
\begin{landscape}
\topcaption{The principal xtab package commands} \label{tab:xtab}
\tablefirsthead{\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablehead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tablelasthead{\multicolumn{2}{c}%
{{\captionsize\bfseries \tablename\ \thetable{} --
concluded from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} \\ \hline }
\tabletail{\hline \multicolumn{2}{|r|}{{Continued on next page}} \\ \hline}
\tablelasttail{\hline \hline}
\begin{center}
\begin{xtabular}{|l|p{0.9\textheight}|}
\verb|\begin{xtabular}{...}| & This is equivalent to the normal
\verb|\begin{tabular}{...}| environment.
You supply the specification of the columns
just as for the normal \Lenv{tabular} environment.
\\
&
All commands that can be used within a \Lenv{tabular}
environment can also be used within
the \Lenv{xtabular} environment.
\\
&
Unlike the \Lenv{tabular} environment which prevents page breaking
within the tabular, the \Lenv{xtabular} allows page breaking, so that
tabulars can extend automatically across several pages.
... ... ...\\
\verb|\tablelasttail{...}| & The contents of this command are inserted before
the final (internal) \verb|\end{tabular}| of the table.
\\
&
For example, you might want to note that this is where
the table ends.
\\
\end{xtabular}
\end{center}
\end{landscape}
\end{document}

enter image description here

| improve this answer | | | | |
  • Had a thought just now. The 1 must me facing my side then it would be correct. – subham soni Jun 1 '14 at 6:29
  • @subhamsoni What is my side? – user11232 Jun 1 '14 at 6:36
  • @subhamsoni Confused. Now where does it face? Just to relate... – user11232 Jun 1 '14 at 6:38

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.