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}
ShreevatsaR
  • 45,428
  • 10
  • 117
  • 149
  • have you tried the solutions from these questions: http://tex.stackexchange.com/questions/71419/how-to-fit-a-wide-table or http://tex.stackexchange.com/questions/16582/center-figure-that-is-wider-than-textwidth – ArTourter Oct 28 '13 at 16:04
  • 4
    Welcome to TeX.SX! Please make your code compilable, starting with \documentclass{...} and ending with \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to help you. Help them help you: remove that one hurdle between you and a solution to your problem. – Mensch Oct 28 '13 at 16:05

2 Answers2

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 :

ppr
  • 8,994
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

egreg
  • 1,121,712