# How to center a text below a multicolumn enviroment

how can i fix my table? I would like to center the $$\%$$ and the two $$\msec$$.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}

\begin{document}
\begin{table}[!h]
\centering
\begin{tabular}{c|cc|cc|cc}
\toprule
$$J$$ & \multicolumn{2}{c|}{Sovraelongazione} & \multicolumn{2}{c|}{\shortstack{Tempo di \\ salita}} &  \multicolumn{2}{c}{\shortstack{Tempo di \\ assestamento}} \\
\midrule
$$Kg\cdot m^{2}$$ & &$$\%$$ & &$$msec$$ & & $$msec$$ \\
\midrule
& $$PI-diff_{\omega_{bv},J_{var}}$$ & $$PI-diff_{\omega_{bv},J_{mid}}$$ & $$PI-diff_{\omega_{bv},J_{var}}$$ & $$PI-diff_{\omega_{bv},J_{mid}}$$ & $$PI-diff_{\omega_{bv},J_{var}}$$ & $$PI-diff_{\omega_{bv},J_{mid}}$$\\
\midrule
$$0.225$$ &$$0$$ &$$0$$ & $$27$$&$$28$$ & $$69$$&$$71$$\\
$$1.390$$ &$$0.3$$ &$$0.3$$ &$$29$$ &$$29$$ &$$72$$ &$$72$$\\
$$8.406$$ & $$0.4$$&$$0.4$$ & $$33$$&$$29$$ & $$107$$&$$89$$\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

• Off-topic: If you use the line-drawing commands of the booktabs package to generate well-spaced horizontal rules, you shouldn't be using vertical rules. – Mico Aug 28 '17 at 7:51

You have to put the elements of the second row again in a \multicolumn:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}

\begin{document}
\begin{table}[!h]
\centering
\begin{tabular}{c|cc|cc|cc}
\toprule
$$J$$ & \multicolumn{2}{c|}{Sovraelongazione} & \multicolumn{2}{c|}{\shortstack{Tempo di \\ salita}} &  \multicolumn{2}{c}{\shortstack{Tempo di \\ assestamento}} \\
\midrule
$$Kg\cdot m^{2}$$ & \multicolumn{2}{c|}{$$\%$$} & \multicolumn{2}{c|}{$$msec$$} & \multicolumn{2}{c}{$$msec$$} \\
\midrule
& $$PI-diff_{\omega_{bv},J_{var}}$$ & $$PI-diff_{\omega_{bv},J_{mid}}$$ & $$PI-diff_{\omega_{bv},J_{var}}$$ & $$PI-diff_{\omega_{bv},J_{mid}}$$ & $$PI-diff_{\omega_{bv},J_{var}}$$ & $$PI-diff_{\omega_{bv},J_{mid}}$$\\
\midrule
$$0.225$$ &$$0$$ &$$0$$ & $$27$$&$$28$$ & $$69$$&$$71$$\\
$$1.390$$ &$$0.3$$ &$$0.3$$ &$$29$$ &$$29$$ &$$72$$ &$$72$$\\
$$8.406$$ & $$0.4$$&$$0.4$$ & $$33$$&$$29$$ & $$107$$&$$89$$\\
\bottomrule
\end{tabular}
\end{table}
\end{document}


• If you use the line-drawing commands of the booktabs package to generate well-spaced horizontal rules, you shouldn't be using vertical rules.

• Use \cmidrule directives to provide more visual grouping for the header cells.

• Use the \si macro of the siunitx package to typeset well-formatted scientific units.

• For table with (mostly) numerical data, use the S column type (also by the siunitx package) instead of the basic c column type.

• There doesn't seem to be any need for line breaks in the header cells.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,siunitx}
\newcommand{\mc}[1]{\multicolumn{2}{@{}c@{}}{#1}} % handy shortcut macro

\begin{document}

\begin{table}[!h]
\sisetup{table-format=3.0} % default
\begin{tabular}{@{}c *{2}{S[table-format=1.1]} *{4}{S} @{}}
\toprule
$$J$$
& \mc{Sovraelongazione} & \mc{Tempo di salita} & \mc{Tempo di assestamento} \\
(\si{\kilogram\meter\squared}) & \mc{(\%)} & \mc{(msec)} & \mc{(msec)} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(l){6-7}
& $$PI-\mathit{diff}_{\omega_{\mathrm{bv}},J_{\mathrm{var}}}$$
& $$PI-\mathit{diff}_{\omega_{\mathrm{bv}},J_{\mathrm{mid}}}$$
& $$PI-\mathit{diff}_{\omega_{\mathrm{bv}},J_{\mathrm{var}}}$$
& $$PI-\mathit{diff}_{\omega_{\mathrm{bv}},J_{\mathrm{mid}}}$$
& $$PI-\mathit{diff}_{\omega_{\mathrm{bv}},J_{\mathrm{var}}}$$
& $$PI-\mathit{diff}_{\omega_{\mathrm{bv}},J_{\mathrm{mid}}}$$\\
\midrule
0.225 & 0   & 0   & 27 & 28 &  69 & 71\\
1.390 & 0.3 & 0.3 & 29 & 29 &  72 & 72\\
8.406 & 0.4 & 0.4 & 33 & 29 & 107 & 89\\
\bottomrule
\end{tabular}