Multi-column latex problems

I am trying to build a table in latex where the five columns have a common name centered over the columns. But the generated table does not look as expected. (the common name remains justified, not centered over 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 run miktex 2.8 on Windows XP

+3
source share
2 answers

Your multi-column invoice amount is too high.

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

(instead \multicolumn{5}{c}{Hydrotalcite} \\\hline)

or actually add a fifth column; -)

+2
source

, \multicolumn , . \multicolumn.

+2

Source: https://habr.com/ru/post/1743167/


All Articles