2

Any advise on this would be appreciated. I have to use a template to write up my paper but I cannot use \cline to merge cells in a table. A simple code is below:

\documentclass{cta-author}%%%%where cta-author is the template name

\begin{document}

\begin{tabular}{|c|c|c|c|c|}
\hline
\multirow{2}{*}{A $\wedge$ B}  & \multicolumn{4}{c|}{B}  \\
\cline{2-5}
     & \textbf{P} & \textbf{O} & \textbf{X} & \textbf{N} \\
\hline
\end{tabular}

\end{document}

The template can be found here: https://github.com/jubaitca/latex

2 Answers 2

2

try the following:

\documentclass{cta-author}%%%%where cta-author is the template name
\usepackage{hhline,multirow}     % <---

\begin{document}

{
\setlength\extrarowheight{2pt} % <--- (for better looking table
\begin{tabular}{|c|c| c|c|c|}
\hhline{|-----|}               % <--- (instead of \hline
\multirow{2}{*}{A $\wedge$ B}  & \multicolumn{4}{c|}{B}  \\
\hhline{|~|----|}              % <--- (instead of \cline
     & \textbf{P} & \textbf{O} & \textbf{X} & \textbf{N} \\
\hhline{|-----|}
\end{tabular}
}
\end{document}

enter image description here

0

You can easily construct that table with {NiceTabular} of nicematrix, which is compatible with your class.

\documentclass{cta-author}%%%%where cta-author is the template name
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{ccccc}[hvlines,cell-space-top-limit=2pt]
\Block{2-1}{A $\wedge$ B}  & \Block{1-4}{B}  \\
     & \textbf{P} & \textbf{O} & \textbf{X} & \textbf{N} \\
\end{NiceTabular}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .