# Problem with tables: no vertical lines are appearing

For some reason I can't get any vertical lines to show in any of my tables. Attached below is an example code and an image of the produced table with no vertical lines. Some help would be much appreciated.

\documentclass{mnras}
\begin{document}

\begin{table}

\caption{Orbital parameters for the Kepler-16 circumbinary system} %title of the table
\centering % centering table

\begin{tabular}{| c | c | c | c |} % creating eight columns
\hline\hline %inserting double-line
parameter & unit & value & uncertainty \\
[0.5ex]
\hline % inserts single-line
$M_{\rm A}$ & $M_{\odot}$ & 0.6897 & 0.0035 \\
$M_{\rm B}$ & $M_{\odot}$ & 0.20255 & 0.00065 \\
$P_{\rm bin}$ & day & 41.079 & 0.000078 \\
$a_{\rm bin}$ & AU & 0.224 & 0.00035 \\
$I_{\rm bin}$ & deg & 90.3401 & 0.0019 \\
$e_{\rm bin}$ & & 0.15944 & 0.0006 \\
$M_{\rm p}$ & $M_{\rm Jup}$ & 0.333 & 0.016 \\
$P_{\rm p}$ & day & 228.776 & 0.037 \\
$a_{\rm p}$ & AU & 0.7048 & 0.001 \\
$e_{\rm p}$ &  & 0.00685 & 0.00146 \\
$I_{\rm p}$ & deg & 90.0322 & 0.0023 \\
Vmag & & 12.0 & \\
RA & & 19:16:18.0 & \\
Dec & & +51:45:27  &\\
\hline % inserts single-line
\end{tabular}
\label{tab:orbital_data}
\end{table}
\end{document}

• Welcome to TeX.SX! Can you make a complete example that demonstrates the problem? When I add your code to a minimal example (\documentclass{article}\begin{document}<your table>\end{document}) I get the vertical lines. That said, the table looks much better without them, so I wouldn't use them in the first place. (I'd also drop the double \hline.) – Torbjørn T. Oct 5 '16 at 13:04
• By a "complete example" @TorbjørnT. means a minimal working example. In particular, the code should compile. – user30471 Oct 5 '16 at 13:07
• Hello, thank you for your advice. A minimum working example is simply the code above surrounded by \documentclass[useAMS,usenatbib]{mn2e} \begin{document} \end{document} Using the MNRAS style guide that can be found here: cita.utoronto.ca/~matzner/svc/tex/mn2e.cls Perhaps the style guide is the problem here... Regarding how good the table looks, I agree here that vertical columns are not wanted but I have some other more complicated tables (where they also don't work now) where I need some vertical lines to separate various bits of information – David Vance Martin Oct 5 '16 at 13:20
• @DavidVanceMartin you can (and please do) edit the question to add these extra lines of code directly. This way people can copy a single chunk of code and paste it directly into an editor to be compiled. – Dai Bowen Oct 5 '16 at 13:24
• I see from ctan.org/tex-archive/macros/latex/contrib/mnras?lang=en that mn2e.cls is considered deprecated, and that mnras should be used instead. – Torbjørn T. Oct 5 '16 at 13:42

The class includes the following code

\def\tabular{\def\@halignto{}
\def\hline{\noalign{\ifnum0=}\fi
\vskip 3pt
\hrule \@height \arrayrulewidth
\vskip 3pt
\futurelet \@tempa\@xhline}
\def\fullhline{\noalign{\ifnum0=}\fi
\vskip 3pt
\hrule \@height \arrayrulewidth
\vskip 3pt
\futurelet \@tempa\@xhline}
\def\@xhline{\ifx\@tempa\hline
\vskip -6pt
\vskip \doublerulesep
\fi
\ifnum0={\fi}}
%                                  \vrule \@width \arrayrulewidth
\hskip .5\arrayrulewidth}}
\@tabular
}


where the definition of \@arrayrule is a redefinition so that it does not add a rule.

As this is a deliberate choice by the publisher, it seems best not to try to over-ride that.

Note however that if you load array package (or tabularx or any other package based on array then \tabular will anyway be redefined and the rules will come back)

• note that this definition of \tabular adds 4 spaces before every tabular so completely breaks the use of tabular in horizontal mode. there should be a % at the end of every line that ends with } – David Carlisle Oct 5 '16 at 14:51
• Does this answer hold for the mn2e class the OP is using (from comment on the question), the mnras class he is being encouraged to use or both? – Dai Bowen Oct 5 '16 at 16:06
• @DaiBowen yes it's the same class just minor differences ending with the comment % Package renamed from 'mn2e' to 'mnras' after % discussion with the TeX Users Group % Numerous small tweaks and improvements following testing I used that one as it's in texlive and installed but I checked the older one on ctan has the same lines – David Carlisle Oct 5 '16 at 16:07

As Torbjørn T. pointed in his comment, vertical lines are showed in minimal working example, however more "profesional look" you will achieve without them and with use of booktabs rules and siunitx packages for S column type:

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

\begin{document}
\begin{table}
\caption{Orbital parameters for the Kepler-16 circumbinary system} %title of the table
\label{tab:orbital_data}
\centering % centering table
\begin{tabular}{>{$}c<{$} c S[table-format=3.5]
S[table-format=1.6]} % creating 4 columns
\toprule
\text{parameter}& unit          & {value}   & {uncertainty} \\
\midrule
M_\mathrm{A}    & $M_{\odot}$   & 0.6897    & 0.0035        \\
M_\mathrm{B}    & $M_{\odot}$   & 0.20255   & 0.00065       \\
P_\mathrm{bin}  & day           & 41.079    & 0.000078      \\
a_\mathrm{bin}  & AU            & 0.224     & 0.00035       \\
I_\mathrm{bin}  & deg           & 90.3401   & 0.0019        \\
e_\mathrm{bin}  &               & 0.15944   & 0.0006        \\
M_\mathrm{p}    & $M_\mathrm{Jup}$ & 0.333  & 0.016         \\
P_\mathrm{p}    & day           & 228.776   & 0.037         \\
a_\mathrm{p}    & AU            & 0.7048    & 0.001         \\
e_\mathrm{p}    &               & 0.00685   & 0.00146       \\
I_\mathrm{p}    & deg           & 90.0322   & 0.0023        \\
\text{Vmag}     &               & 12.0      &               \\
\text{RA}       &               & {19:16:18.0}  &           \\
\text{Dec}      &               & {+51:45:27}   &           \\
\bottomrule
\end{tabular}
\end{table}
\end{document}


If you persist to heve vertical lines, the change table code to:

    \begin{tabular}{|>{$}c<{$} | c | S[table-format=3.5] |
| S[table-format=1.6] |} % creating 4 columns
\hline\hilne
\text{parameter}& unit          & {value}   & {uncertainty} \\
\hline
M_\mathrm{A}    & $M_{\odot}$   & 0.6897    & 0.0035        \\
M_\mathrm{B}    & $M_{\odot}$   & 0.20255   & 0.00065       \\
P_\mathrm{bin}  & day           & 41.079    & 0.000078      \\
a_\mathrm{bin}  & AU            & 0.224     & 0.00035       \\
I_\mathrm{bin}  & deg           & 90.3401   & 0.0019        \\
e_\mathrm{bin}  &               & 0.15944   & 0.0006        \\
M_\mathrm{p}    & $M_\mathrm{Jup}$ & 0.333  & 0.016         \\
P_\mathrm{p}    & day           & 228.776   & 0.037         \\
a_\mathrm{p}    & AU            & 0.7048    & 0.001         \\
e_\mathrm{p}    &               & 0.00685   & 0.00146       \\
I_\mathrm{p}    & deg           & 90.0322   & 0.0023        \\
\text{Vmag}     &               & 12.0      &               \\
\text{RA}       &               & {19:16:18.0}  &           \\
\text{Dec}      &               & {+51:45:27}   &           \\
\hline
\end{tabular}


and you will get (to general opinion ugly) table:

• @Mico, yes, I simply overlooked this. Now this is corrected. Thank you! – Zarko Oct 5 '16 at 13:41
• this is general advice on tables but doesn't answer the question (the MWE does not produce rules with mnras) – David Carlisle Oct 5 '16 at 14:30
• @DavidCarlisle, yes, it is. If OP will clarify his question, I will try to provide more specific answer (if I will know, how to solve his problem). Hopefully this general advice will help him to resolve his problem. and in question is not mentioned "mnras" ... – Zarko Oct 5 '16 at 14:37
• ah sorry actually I'd forgotten that the OP only put the mnras (mn2e) reference in a comment not the main text. (to solve the problem he should just do as you advise if the publishers allow that, or just use the publisher provided table style whatever it looks like if that is all that is allowed, so it's not really a technical question:-) – David Carlisle Oct 5 '16 at 14:42
• now I see this in comment, but in time of uploading my answer, this comment wasn't visible to me. I see, that you provide explanation of OP problem, Now is up to him, how he will design his tables :-) – Zarko Oct 5 '16 at 14:48

The journal is mnras (http://mirrors.ctan.org/macros/latex/contrib/mnras/mnras.cls).

Replace | by @{\vline}, thus

\begin{tabular}{@{\vline} c @{\vline} c @{\vline} c @{\vline} c @{\vline}} % creating eight columns


For single or a few columns, One can combine multiline and vline.

\multicolumn{1}{@{\vline}l@{\vline}}{day}


The @{...}` construct defines the column separator. One can put here additional padding.