2

I'm using pdflatex and have some trouble: the vertical lines in my tabular environment are all scattered.

\documentclass{article}
\begin{document}

\begin{tabular}{| l | c | l |}
  \hline
  Abbreviation & Description & Relation\\
  2 & einstein & $E = m*c^2$ 
  \\\hline\\ 
  3 & pythagoras  & $c^2=\sqrt{a^2+b^2}$\\
  \hline
\end{tabular}

\end{document}

enter image description here

It's probably connected to the formula inside the cell. Any help is greatly appreaciated.

  • Just FYI, it's generally considered a Really Bad Idea to use vertical lines in tables. I'm afraid I don't have the needed citation to hand at the moment, but I'm sure another user will step in to provide it. – Brent.Longborough Nov 7 '14 at 17:13
2

You need two ampersands to create columns in the empty line.

\documentclass{article}
\begin{document}

\begin{table}
\centering
\begin{tabular}{| l | c | l |}
\hline
Abbreviation & Description & Relation\\
2 & einstein & $E = m*c^2$ \\\hline && \\
3 & pythagoras  & $c^2=\sqrt{a^2+b^2}$\\
\hline
\end{tabular}

\end{table}
\end{document}

enter image description here

0

I have provided a quick fix. See MWE below:

\documentclass{article}
\usepackage{booktabs}
\begin{document}
{%
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{| l | c | l |}
  \hline
  Abbreviation & Description & Relation\\\hline
  2 & einstein & $E = m*c^2$ 
  \\\hline
  3 & pythagoras  & $c^2=\sqrt{a^2+b^2}$\\
  \hline
\end{tabular}
}

\vspace*{1cm}
{%
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{ l  c l }
  \toprule
  Abbreviation & Description & Relation\\
  \midrule
  2 & einstein & $E = m*c^2$ 
  \\
  3 & pythagoras  & $c^2=\sqrt{a^2+b^2}$\\
  \bottomrule
\end{tabular}
}
\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.