I am trying to implement a code using tabularx and multicolumn along with head, but I keep on getting an error. The code is as follows:
\begindocumnet{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{ragged2e}
\newcolumntype{L}{ >{\RaggedRight}X }
\usepackage{siunitx}
\usepackage{makecell}
\renewcommand\theadfont{\normalfont\bfseries}
\setlength\parindent{0pt}
\newcolumntype{Y}{ >{\Centering}X}
\usepackage[justification=centering]{caption}
\noindent
\newcolumntype{Y}{ >{\Centering}X}
\begin{tabularx}{\textwidth}{@{} lYYY @{}}
\toprule
\thead[lc]{Category} & \multicolumn{2}{c}{\thead{Forecasting Horizon}}&
& \multicolumn{2}{c}{\thead{1 Period}} & {\multicolumn{2}{c}{1 Period}} &
\multicolumn{2}{c}{\thead{3 Period}} \\
& \thead{TSMOM (1,1)} & \thead{TSMOM (3,3)}
& \thead{TSMOM (1,1)} & \thead{TSMOM (3,3)} & \thead{TSMOM (1,1)}
& \thead{TSMOM (3,3)} \\
\midrule
Test-Statistic & 0 & 1.00 & 1.00 \\ \addlinespace
P-value & 0 & 0.59 & 1.00 \\ \addlinespace
\bottomrule
\end{tabularx}
To provide an idea, I basically want to make a chart with the following content
except I would like to have the layout in the following format :
However, I get the following error such as: "extra alignment tab has been change to \cr" could someone please help advise me where I am making a mistake with the code ? Thank you
Best Answer
You have mismatch in MWE (one
multicolum
is probably accidentally repeated). Corrected (and slightly improved) code is: