1

My table contains 10 columns and when I am running the code full table is not coming. Last two columns are not appearing.

Can you please help.

The code is as follows:

\begin{table}[H]
\begin{center}
\caption{Table 1}
\begin{tabular}{||c| c| c| c| c| c| c| c| c| c||} 
 \hline
$ \sigma $ & $V_0$ & a(1) & b(1) & (b-a)(1) & $ \hat{\tau}$(1)  & a(2) &  b(2) & (b-a)(2) & $ \hat{\tau}$(2)\\
 \hline\hline
1 &           1       & 0.4151 & 2.4093 & 1.9942 & 0 & 0.6180 & 1.6180 & 1.0000 & 3.1416 \\
\hline
5 &           2.2361  & 0.2306 & 4.3367 & 4.1061 & 0 & 0.3820 & 2.6180 & 2.2360 & 3.1416 \\
\hline
10 &          3.1623  & 0.1830 & 5.4640 & 5.2810 & 0 & 0.2897 & 3.4520 & 3.1623 & 3.1416 \\
\hline
\end{tabular}
\end{center}
\end{table}
  • Welcome to TeX.SX! Please don't post such fragments only and don't use \begin{center}...\end{center} in a float. Disregarding this, I see 10 columns in the output – user31729 Jul 10 '16 at 8:19
  • 1
    Maybe your table is just wider than the page. – Johannes_B Jul 10 '16 at 8:48
2

This depends on the margins of your document. If you load geometry, you'll have more sensible margins.

Other than that, you can play with the font size used in the table and the value of \tabcolsep.

I propose two solutions without geometry, one with the general look of your code (horizontal and vertical rules), improved with the help of hhline and cellspace, which defines minimal vertical padding at the top and bottom of cells in columns with specifiers prefixed with the letter S (Sc here, instead of c). Without geometry we have to reduce the font size to \footnotesize and \tabcolsep to 5pt.

The other solution, with only horizontal rules, uses booktabs, which defines some vertical padding around rules of varying thickness. The middle rule is slightly trimmed with the (lr) argument. The font size is \normalsize, and \tabcolsep is 3.5pt.

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{showframe}
\usepackage{mathtools}
\usepackage{array, caption, hhline, cellspace,  booktabs}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

\renewcommand*\ShowFrameLinethickness{.3pt}

\begin{document}

\begin{table}[!ht]
  \centering\footnotesize\setlength\tabcolsep{5pt}
  \caption{Table 1}
  \begin{tabular}{||*{10}{Sc|}|}
    \hline
    $ σ$ & $V₀$  & a(1)   & b(1)   & (b-a)(1) & $ \hat{τ}$(1) & a(2)   & b(2)   & (b-a)(2) & $ \hat{τ}$(2) \\
    \hhline{*{10}{=}}
    1          & 1      & 0.4151 & 2.4093 & 1.9942   & 0                & 0.6180 & 1.6180 & 1.0000   & 3.1416           \\
    \hhline{||*{10}{-}||}
    5          & 2.2361 & 0.2306 & 4.3367 & 4.1061   & 0                & 0.3820 & 2.6180 & 2.2360   & 3.1416           \\
    \hhline{||*{10}{-}||}
    10         & 3.1623 & 0.1830 & 5.4640 & 5.2810   & 0                & 0.2897 & 3.4520 & 3.1623   & 3.1416           \\
    \hline
  \end{tabular}
\end{table}
\begin{table}[!hb]
  \centering\setlength\tabcolsep{3.5pt}
  \caption{Table 1}
  \begin{tabular}{@{\,\,}*{10}{c}@{\,\,}}
    \toprule
    $ σ$ & $V₀$  & a(1)   & b(1)   & (b-a)(1) & $ \hat{τ}$(1) & a(2)   & b(2)   & (b-a)(2) & $ \hat{τ}$(2) \\
    \cmidrule(l{3pt}r{3pt}){1-10}
    1          & 1      & 0.4151 & 2.4093 & 1.9942   & 0                & 0.6180 & 1.6180 & 1.0000   & 3.1416           \\
    \addlinespace
    5          & 2.2361 & 0.2306 & 4.3367 & 4.1061   & 0                & 0.3820 & 2.6180 & 2.2360   & 3.1416           \\
    \addlinespace
    10         & 3.1623 & 0.1830 & 5.4640 & 5.2810   & 0                & 0.2897 & 3.4520 & 3.1623   & 3.1416           \\
    \bottomrule
  \end{tabular}
\end{table}

\end{document} 

enter image description here

  • @Mico: Oh! yes. Sorry for the (Freudian?) slip of my pen. Fixed now. Thanks for pointing the inconsistency! – Bernard Jul 10 '16 at 11:28
1

You should (a) declutter the table by getting rid of all vertical bars and about half of the horizontal bars and (b) ask yourself seriously if your readers really need to be shown 4 significant digits; might 3 digits (or even 2 digits?!) convey just as much information? If showing fewer digits is preferable (and, speaking for myself I believe it is preferable), I suggest you load the siunitx package and let LaTeX perform the rounding for you, along the lines of the second table shown below.

Incidentally, I use array environments instead of tabular environments in the following code because most of the tables' contents consist of math formulas and numbers.

enter image description here

\documentclass{article}
\usepackage{booktabs,caption,siunitx}

\begin{document}
\begin{table}[ht!]
\setlength\arraycolsep{3pt} % default: 5pt
\centering
\caption{Four digits of precision}
$\begin{array}{@{} *{10}{c} @{}} 
 \toprule
 \sigma  & V_0 & a(1) & b(1) & (b-a)(1) &  
 \hat{\tau}(1) & a(2) & b(2) & (b-a)(2) & \hat{\tau}(2)\\
 \midrule
1 & 1       & 0.4151 & 2.4093 & 1.9942 & 0 & 0.6180 & 1.6180 & 1.0000 & 3.1416 \\
5 & 2.2361  & 0.2306 & 4.3367 & 4.1061 & 0 & 0.3820 & 2.6180 & 2.2360 & 3.1416 \\
10 & 3.1623 & 0.1830 & 5.4640 & 5.2810 & 0 & 0.2897 & 3.4520 & 3.1623 & 3.1416 \\
\bottomrule
\end{array}$
\end{table}

\begin{table}[h!]
\sisetup{round-mode=places,round-precision=3,
         table-format=1.3}
\centering
\caption{Three digits of precision (automatic rounding)}
$\begin{array}{@{} c *{4}{S} c *{4}{S} @{}} 
 \toprule
 \sigma  & {V_0} & {a(1)} & {b(1)} & {(b-a)(1)} &  
 \hat{\tau}(1) & {a(2)} & {b(2)} & {(b-a)(2)} & {\hat{\tau}(2)}\\
 \midrule
1 &  1      & 0.4151 & 2.4093 & 1.9942 & 0 & 0.6180 & 1.6180 & 1.0000 & 3.1416 \\
5 & 2.2361  & 0.2306 & 4.3367 & 4.1061 & 0 & 0.3820 & 2.6180 & 2.2360 & 3.1416 \\
10 & 3.1623 & 0.1830 & 5.4640 & 5.2810 & 0 & 0.2897 & 3.4520 & 3.1623 & 3.1416 \\
\bottomrule
\end{array}$
\end{table}
\end{document}

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.