1

Hello everyone I am creating a table on latex, I would like to add it a title I tried:

 \multicolumn{12}{|c|}{\cellcolor[HTML]{C0C0C0}{\color[HTML]{000000}
    Training         Test}} \\\hline

the complete code looks as follows:

\begin{table}[H]
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|c|}\hline 
\multicolumn{12}{|c|}{\cellcolor[HTML]{C0C0C0}{\color[HTML]{000000}
Training         Test}} \\\hline
&EN&ES&IT&DU&EN&IT&DU&EN&ES&IT&DU\\\hline
Users&152&110&38&34&42&12&10&142&88&36&32\\\hline
18-24&58&22&&&16&&&56&18&&\\
25-34&60&56&&&16&&&58&44&&\\
35-49&22&22&&&6&&&20&18&&\\
50+&12&10&&&4&&&8&8&&\\\hline
Male&76&55&19&17&21&6&5&71&44&18&16\\
Female&76&55&19&17&21&6&5&71&44&18&16\\\hline
\end{tabular}
\end{adjustbox}
\caption{}
\label{}
\end{table}

I failed with this approach since I want that the title only cover a specific range of columns, I want that the word Training appears from the column 2 to 5 and the word Test appears from the column 9 to 12, and with my approach the title appears centered in the table, I would like to appreciate any suggestion to achieve this.

neo33
  • 1,809
  • 5
  • 18
  • 41
  • Hi! You should read [this](http://meta.tex.stackexchange.com/questions/228/ive-just-been-asked-to-write-a-minimal-example-what-is-that) ...and [this](http://tex.stackexchange.com/questions/132106/difference-between-h-and-h-in-float-position/132113#132113) also! – MattAllegro May 28 '16 at 11:48

1 Answers1

1

Again, I've quit the color[HTML] thing: as you didn't show your preamble, we don't know what package you used for it.

That said, if you change

\multicolumn{12}{|c|}{\cellcolor[HTML]{C0C0C0}{\color[HTML]{000000} Training Test}}\\\hline

or

\multicolumn{12}{|c|}{Training Test}\\\hline

to

\multicolumn{1}{|c}{} & \multicolumn{4}{c}{Training} & \multicolumn{3}{c}{} & \multicolumn{4}{c|}{Test}\\\hline

you should get what you want.

Community
  • 1
  • 1
MattAllegro
  • 6,455
  • 5
  • 45
  • 52
  • 1
    you are really wood, I forgot to add the package that I was using, this was really helpful, I really appreciate the support, thanks a lot. – neo33 May 29 '16 at 12:33