4

I'm using this code for creating a table in LaTeX:

\documentclass[11pt]{article}
\usepackage{threeparttable}
\usepackage{multirow}
\usepackage{makecell}
\usepackage{graphicx}
\usepackage{color, colortbl}
\usepackage{rotating}

\begin{document}

\begin{table}

\begin{threeparttable}
\begin{tabular}{c c | c c | c c c | c c c c}

  % after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
  && \multicolumn{8}{c}{\textbf{PV}} & \\
   &  & F & N &  & F & N &  & F & N & \\
  \noalign{\hrule height 0.7pt}
  \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{90}{\textbf{AV}}}} & F & 8 & 9 &  & 11 & 12 &  & 150 & A & \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{270}{\scriptsize ABC}}}\\
  & NF & 14 & 15 &  & 17 & 18 &  & A & A & \\

\noalign{\hrule height 0.7pt}
    \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{90}{\textbf{AV}}}} & F & 8 & 9 &  & 11 & 12 &  & 15X & A & \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{270}{{\scriptsize dddd}}}}\\
  & NF & 14 & 15 &  & 17 & 18 &  & A & A & \\

  \noalign{\hrule height 0.7pt}
  && \multicolumn{2}{c}{\textbf{MSP}} && \multicolumn{2}{c}{\textbf{DBE}} && \multicolumn{2}{c}{\textbf{VDE}} \\
\end{tabular}


\end{threeparttable}
\end{table}

\end{document} 

Here is the output:

enter image description here

I need some modification in multicolumn and multirow. I want remove red boxes (line in red boxes) from output, convert black vertical lines to red lines (in middle) and have two black boxes in right(black boxes around ABC and dddd). How can I do this modification using multicolumn and multirow?

4

enter image description here

\documentclass[11pt]{article}
\usepackage{threeparttable}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{colortbl}

\begin{document}

\begin{table}

\begin{threeparttable}
\begin{tabular}{c c | c c | c c | c c| c|}


 \multicolumn{2}{c}{}& \multicolumn{6}{c}{\textbf{PV}} &\multicolumn{1}{c}{} \\
 \multicolumn{2}{c}{} & F & 
\multicolumn{1}{c}{N} &   F &
\multicolumn{1}{c}{N} &  F & 
\multicolumn{1}{c}{N} &\multicolumn{1}{c}{}\\
\hline
  \multirow{2}{*}{\rotatebox[origin=c]{90}{\textbf{AV}}} & F & 8 & 9 &  11 & 12 &  150 & A & \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{270}{\scriptsize ABC}}}\\
  & NF & 14 & 15 &  17 & 18 &  A & A & \\

\hline
  \multirow{2}{*}{\rotatebox[origin=c]{90}{\textbf{AV}}} & F & 8 & 9 &  11 & 12 &  15X & A & \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{270}{{\scriptsize dddd}}}}\\
  & NF & 14 & 15 &  17 & 18 &  A & A & \\
\hline
 \multicolumn{2}{c}{}& \multicolumn{2}{c}{\textbf{MSP}} & \multicolumn{2}{c}{\textbf{DBE}} & \multicolumn{2}{c}{\textbf{VDE}} \\
\end{tabular}


\end{threeparttable}
\end{table}

\end{document} 
3

A solution based on your initial code, with coloured vertical lines as requested. I added the caption for a correct vertical spacing between caption and table. I had to use \hhline for technical reasons:

\documentclass[11pt]{article}
\usepackage{threeparttable}
\usepackage{multirow}
\usepackage{makecell, hhline}
\usepackage{graphicx}
\usepackage{xcolor, colortbl}
\usepackage{textcomp}
\usepackage{rotating}
\usepackage{caption}

\begin{document}

\begin{table}
\centering\setlength\arrayrulewidth{0.7pt}
\caption{MM}
\begin{threeparttable}
\begin{tabular}{c c | c c !{\color{red}\vrule width0.7pt}c c !{\color{red}\vrule width0.7pt} c c c}
 \multicolumn{9}{c}{\textbf{PV}} \\
\multicolumn{2}{c}{}& F & \multicolumn{1}{c}{N} & F & \multicolumn{1}{c}{N} & F & N & \\
\hhline{~-------~}
 \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{90}{\textbf{AV}}}} & F & \cellcolor{gray!12}{8} & 9 & \cellcolor{gray!12}{11} & 12 & \cellcolor{gray!12}{150} & A & \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{270}{\scriptsize ABC}}}\\
 & NF & 14 & \cellcolor{gray!12}{15} & 17 & \cellcolor{gray!12}{18} & A & \cellcolor{gray!12}{A} & \\
\hhline{~-------~}
 \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{90}{\textbf{AV}}}} & F & \cellcolor{gray!12}{8} & 9 & \cellcolor{gray!12}{11} & 12 & \cellcolor{gray!12}{15X} & A & \parbox[t]{2mm}{\multirow{2}{*}{\rotatebox[origin=c]{270}{{\scriptsize dddd}}}}\\
 & NF & 14 & \cellcolor{gray!12}{15} & 17 & \cellcolor{gray!12}{18} & A & \cellcolor{gray!12}{A} & \\
 \cline{2-8}
 \multicolumn{2}{c}{}& \multicolumn{2}{c}{\textbf{MSP}} & \multicolumn{2}{c}{\textbf{DBE}} & \multicolumn{2}{c}{\textbf{VDE}} \\
\end{tabular}
\begin{tablenotes}
\footnotesize
\item[\textdagger]BBBddddd
\end{tablenotes}
\end{threeparttable}
\end{table}

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