1

My table used to work before and all of a sudden I am having an error that says I misplaced \noalign when I changed some inputs into my tables.

Would someone please help me take a look at the code please ?

An example is as follows:

\documentclass{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}
\setlength\parindent{0pt}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
\renewcommand\theadfont{\normalfont\bfseries}
\newcommand\mc[1]{\multicolumn{2}{c}{#1}}
\setlength\parindent{0pt}
\begin{document}
\begin{tabularx}{\textwidth}{@{} lYYYYYY @{}}   

\toprule   

\thead[lc]{Category }& \thead{Strategies}& {\thead{Annualized \\ Mean}} & {\thead{Annualized \\ Volatility}} & {\thead{Skew}} & {\thead{kurtosis}} & {\thead{Sharpe \\ Ratio}}

    \midrule   

    \multirow{2}{*}{ Momentum } & TSMOM(1,1) & 3.18 &  3.84 & -0.26 & 20.06 & 0.00  \\   
                                & TSMOM(3,3) & 11.85 &  7.76 & -1.96 & 24.72 & 0.00  \\ \addlinespace  
    \multirow{5}{*}{ Size } & Top Decile & 12.70 & 9.26 & 1.44 & 1.44 & 15.80  \\
    & 9\textsuperscript{th} Decile & 0.11 & 8.49 & 0.49 & 12.73 & 0.00\\
    & Bottom Decile & 0 & 1.00 & 1.00 \\
    & 2\textsuperscript{nd} Decile & 0 & 0.23 & 1.00\\

    & Top minus Bottom & 0 & 1.00 & 1.00\\ 

    \addlinespace

    \multirow{7}{*}{ Value } & Top Decile & 0 & 1.00 & 1.00\\
    & Bottom Decile & 0 & 1.00 & 1.00 \\
    & Top Minus Lowest (Decile) & 0 & 1.00 & 1.00 \\
    & Top 30\textsuperscript{th} Percentile & 0 & 1.00 & 1.00 \\
    & Mid 40\textsuperscript{th} Percentile & 0 & 0.29 & 1.00 \\
    & Bottom 30\textsuperscript{th} Percentile & 0 & 1.00 & 1.00 \\
    & Highest Minus Lowest 30\textsuperscript{th} & 0 & 1.00 & 1.00 \\   

\bottomrule 

\end{tabularx}
\end{document}

Any advice is appreciated.

Thank you

3

Your problem is simple typing error. Error message quit clear indicate, that \midrule you haven't command end of line.

Anyway that problem is allready solved by comments, I sugest you to check your preamble again. In it you have many dušlicates of definition, some are also wrong. SO, see my clean-up of your code belos:

\documentclass{article}
    \usepackage{booktabs,makecell,multirow,tabularx}
    \usepackage{ragged2e}
\renewcommand\theadfont{\normalfont\bfseries}
%\newcolumntype{L}{>{\RaggedRight}X }% duplicate, wrong, missing \arraybackslash
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
%\newcolumntype{Y}{>{\Centering}X}% duplicate, wrong, missing \arraybackslash, 
%\renewcommand\theadfont{\bfseries}% default settings is ok
\newcommand\mc[1]{\multicolumn{2}{c}{#1}}

    %\setlength\parindent{0pt}% duplicate
    %\setlength\parindent{0pt}% duplicate
    \setlength\parindent{0pt}
\usepackage[justification=centering]{caption}
\usepackage{siunitx}
\usepackage[margin=30mm,showframe]{geometry}% added for better column layout


\begin{document}
    \setlength{\tabcolsep}{4pt}
\begin{tabularx}{\textwidth}{@{} l L *{5}{S[table-format=3.3]} @{}}
    \toprule
\thead[b]{Category}
    &   {\thead[b]{Strategies}}
        &   {\thead[b]{Annualized \\ Mean}} 
            &   {\thead[b]{Annualized \\ Volatility}} 
                &   {\thead[b]{Skew}} 
                    &   {\thead[b]{Kurtosis}} 
                        &   {\thead[b]{Sharpe \\ Ratio}}   \\
\midrule
    \multirow{2}{*}{ Momentum } & TSMOM(1,1) & 3.18 &  3.84 & -0.26 & 20.06 & 0.00  \\
                                & TSMOM(3,3) & 11.85 &  7.76 & -1.96 & 24.72 & 0.00  \\ \addlinespace
    \multirow{5}{*}{ Size } & Top Decile & 12.70 & 9.26 & 1.44 & 1.44 & 15.80  \\
    & 9\textsuperscript{th} Decile & 0.11 & 8.49 & 0.49 & 12.73 & 0.00\\
    & Bottom Decile & 0 & 1.00 & 1.00 \\
    & 2\textsuperscript{nd} Decile & 0 & 0.23 & 1.00\\
    & Top minus Bottom & 0 & 1.00 & 1.00\\
\addlinespace
    \multirow{7}{*}{ Value } & Top Decile & 0 & 1.00 & 1.00\\
    & Bottom Decile & 0 & 1.00 & 1.00 \\
    & Top Minus Lowest (Decile) & 0 & 1.00 & 1.00 \\
    & Top 30\textsuperscript{th} Percentile & 0 & 1.00 & 1.00 \\
    & Mid 40\textsuperscript{th} Percentile & 0 & 0.29 & 1.00 \\
    & Bottom 30\textsuperscript{th} Percentile & 0 & 1.00 & 1.00 \\
    & Highest Minus Lowest 30\textsuperscript{th} & 0 & 1.00 & 1.00 \\
\bottomrule
    \end{tabularx}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.