2

I want to modify this table in this way: enter image description here

Here is my MWE, in which I tried to achieve it with no success.

\documentclass{article}
\usepackage{array}    % \extrarowheight macro
\usepackage{graphicx} % \rotatebox macro
\usepackage{multirow} % \multirow macro
\usepackage{booktabs} % for \toprule, \midrule, \bottomrule
\begin{document}


%Before

\noindent\makebox[\textwidth][c]{
\begin{minipage}[c]{\textwidth}
\centering
\begin{tabular}{@{}ccccc@{}}
\toprule
Expert & \multicolumn{4}{c@{}}{Prediction}\\
\cmidrule(l){2-5}
& Blah & BlahBlahBlahBlah & BlahBlahBlah & BlahBlahBlah \\
\midrule
Blah & $10$ & $10$ & $10$ & $10$\\ 
BlahBlahBlahBlah & $10$ & $10$ & $10$ & $10$\\ 
BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\ 
BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\ 
\bottomrule
\end{tabular}
\end{minipage}
}

\vspace{5cm}

%After
\noindent\makebox[\textwidth][c]{
\begin{minipage}[c]{\textwidth}
\centering
\begin{tabular}{c|@{}ccccc@{}}
\toprule
\parbox[t]{2mm}{\multirow{4}{*}{\rotatebox[origin=c]{90}{Expert}}} &  & \multicolumn{4}{c@{}}{Prediction}\\
\cmidrule(l){2-5}
& Blah & BlahBlahBlahBlah & BlahBlahBlah & BlahBlahBlah \\
\midrule
Blah & $10$ & $10$ & $10$ & $10$\\ 
BlahBlahBlahBlah & $10$ & $10$ & $10$ & $10$\\ 
BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\ 
BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\ 
\bottomrule
\end{tabular}
\end{minipage}
}
\end{document}

Someone knows how to get it? Thanks!

2

Since you added an additional column, you need to add an additional & to the main content to skip over the new column. To skip the vertical rule over the rows where it is not desired I used \multicolumn{2}{c}{}.

enter image description here

Code:

\documentclass{article}
\usepackage{array}    % \extrarowheight macro
\usepackage{graphicx} % \rotatebox macro
\usepackage{multirow} % \multirow macro
\usepackage{booktabs} % for \toprule, \midrule, \bottomrule
\begin{document}


\begin{tabular}{|c|ccccc@{}}
\cmidrule[0.9pt](l){3-6}
\multicolumn{2}{c}{} & \multicolumn{4}{c@{}}{Prediction}\\
\cmidrule(l){3-6}
\multicolumn{2}{c}{}& Blah & BlahBlahBlahBlah & BlahBlahBlah & BlahBlahBlah \\
\cmidrule(l){2-6}
\multirow{4}{*}{\rotatebox[origin=c]{90}{Expert}}
&Blah & $10$ & $10$ & $10$ & $10$\\ 
&BlahBlahBlahBlah & $10$ & $10$ & $10$ & $10$\\ 
&BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\ 
&BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\ 
\cmidrule[0.9pt](l){2-6}
\end{tabular}
\end{document}
0

It's easy with one supplementary column and a \rotatebox command. Let me point that your makeboxcommand is quite unnecessary and that the minpage environment produces a too tight vertical spacing. But perhaps you have serious reasons not to use a table environment.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe, nomarginpar]{geometry}

\usepackage{array} % \extrarowheight macro
\usepackage{graphicx} % \rotatebox macro
\usepackage{multirow} % \multirow macro
\usepackage{booktabs} % for \toprule, \midrule, \bottomrule

\begin{document}

Before: \\

\noindent\makebox[\textwidth][c]{
\begin{minipage}[c]{\textwidth}
\centering
\begin{tabular}{@{}ccccc@{}}
\toprule
Expert & \multicolumn{4}{c@{}}{Prediction}\\
\cmidrule(l){2-5}
& Blah & BlahBlahBlahBlah & BlahBlahBlah & BlahBlahBlah \\
\midrule
Blah & $10$ & $10$ & $10$ & $10$\\
BlahBlahBlahBlah & $10$ & $10$ & $10$ & $10$\\
BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\
BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\
\bottomrule
\end{tabular}
\end{minipage}
}

\vspace{5cm}

After: \\

\noindent
\begin{minipage}{\linewidth}
\centering
\begin{tabular}{@{}c <{\enspace }@{}ccccc@{}}
\cmidrule[\heavyrulewidth]{3-6}
 & & \multicolumn{4}{c@{}}{Prediction}\\
\cmidrule(l){3-6}
 & & Blah & BlahBlahBlahBlah & BlahBlahBlah & BlahBlahBlah \\
\cmidrule{2-6}
\multirow{5}{*}{\rotatebox{90}{\enspace Expert}} & Blah & $10$ & $10$ & $10$ & $10$\\
 & BlahBlahBlahBlah & $10$ & $10$ & $10$ & $10$\\
 & BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\
 & BlahBlahBlah & $10$ & $10$ & $10$ & $10$\\
\cmidrule[\heavyrulewidth]{2-6}
\end{tabular}
\end{minipage}

\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.