Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex multicolumn problems

I am trying to build a table in latex where five columns have a common title centered above the columns. But the generated table does not appear as expected. (the common title is left justified instead of centered above the columns)

The code looks like

\documentclass{article}

\begin{document}

\begin{table}
\centering
\begin{tabular}{|l|c|c|c|r|}
\multicolumn{5}{c}{Hydrotalcite} \\
\hline
kalhsdfsa & 1 asdf asf asfa &7as dfas fasdf as0 & 003  \\
kalhsdfsa & 1 asdf asf asfa &7as dfas fasdf as0 & 003  \\
kalhsdfsa & 1 asdf asf asfa &7as dfas fasdf as0 & 003 
\end{tabular}
\caption{lala}
\label{tabTableRefereaSDasdnce}
\end{table}

\end{document}

And I'm running miktex 2.8 on Windows XP

like image 872
midtiby Avatar asked Apr 07 '26 10:04

midtiby


1 Answers

your multicolumn amount is one too high

change to \multicolumn{4}{c}{Hydrotalcite} \\\hline

(in stead of \multicolumn{5}{c}{Hydrotalcite} \\\hline)

or actually add the fifth column ;-)

like image 144
NomeN Avatar answered Apr 10 '26 18:04

NomeN



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!