2

I have a really long table and it is out of margin. I read other post about this issue but I still cannot figure it out:

\begin{table}[htbp]
\begin{center}

\begin{tabular}{|c|c|c|p{51pt}|c|p{54pt}|c|c|}

\hline
& 
Atmosphere pressure P$_{0}$& 
Wanted pressure inside(absolute) P'& 
$\mathrm{\Delta p}$ \par & 
Altitude& 
g (m$^{2}$/s) \par & 
S (m$^{2})$& 
m (g) \\
\hline
Los Angeles& 
101.2KPa& 
180Kpa& 
78.8Kpa& 
70m& 
9.83268& 
1.26*10$^{-5}$& 
100.98 \\
\hline
Lhasa (capital of Tibet)& 
65.3KPa& 
102Kpa& 
36.7Kpa& 
3650m& 
9.82143& 
1.26*10$^{-5}$& 
47.08 \\
\hline
Mt Everest Base Camp& 
46.3KPa& 
102Kpa& 
55.7Kpa& 
5550m& 
9.81558& 
1.26*10$^{-5}$& 
71.50 \\
\hline
\end{tabular}
\label{tab3}
\end{center}
\end{table}
2

2 Answers 2

2

You should consider using lscape and longtable packages.

lscape package allows you to use the landscape environment which rotate your table (90°). For pdf output, use pdflscape package.

And:

The longtable package defines a new environment, longtable, which has most of the features of the tabular environment, but produces tables which may be broken by TEX’s standard page-breaking algorithm.

Be careful : longtable replaces tabular environment.

Example :

\begin{landscape}
  \begin{longtable}{|c|c|c|c|c|}
    ...
  \end{longtable}
\end{landscape}

You could be also interested by these posts :

2

If you make your table \small, remove inessential data from it (the unit of measure can stay in the table header) and decrease a bit the intercolumn space, the table fits in the standard (345pt) text width.

\documentclass{article}
\usepackage{siunitx,booktabs}
\usepackage{caption}
\captionsetup[table]{position=top}

\begin{document}

\begin{table}
\centering\small
\addtolength{\tabcolsep}{-3pt}

\caption[Data about some places]
  {Data about some places. Notes: (1)~$P_0$ is the atmosphere pressure;
   (2)~$P'$ is the wanted pressure inside (absolute).}
\label{tab:data}

\begin{tabular}{
 l
 S[table-format=3.1]
 S[table-format=3.0]
 S[table-format=2.1]
 S[table-format=4.0]
 S[table-format=1.5]
 S[table-format=1.2e-1]
 S[table-format=3.2]
}
\toprule
& {$P_0$} & {$P'$} & {$\Delta p$} & {$A$} & {$g$} & {$S$} & {$m$} \\
& {(\si{\kilo\pascal})}
& {(\si{\kilo\pascal})}
& {(\si{\kilo\pascal})}
& {(\si[per-mode=symbol]{\meter\squared\per\second})}
& {(\si{\meter})}
& {(\si{\meter\squared})}
& {(\si{\gram})} \\
\midrule
Los Angeles             & 101.2 & 180 & 78.8 &   70 & 9.83268 & 1.26e-5 & 100.98 \\
Lhasa (capital of Tibet)&  65.3 & 102 & 36.7 & 3650 & 9.82143 & 1.26e-5 &  47.08 \\
Mt Everest Base Camp    &  46.3 & 102 & 55.7 & 5550 & 9.81558 & 1.26e-5 &  71.50 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

Note the usage of siunitx for having uniform treatment of the data and of the units (it's “kPa” rather than “KPa” or “Kpa”).

enter image description here

2
  • One can use \m instead of \meter; just to reduce the number of keystrokes a bit. :) Oct 28, 2013 at 18:17
  • 1
    @SvendTveskæg Yes, but I believe that in this way the input is more readable.
    – egreg
    Oct 28, 2013 at 18:28

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.