0

I want to draw a multicolumn table, such that for every row, the second and third columns are divided into two parts, and there is a dashed line separating the two parts. Currently, I have something like this:

\documentclass[a4paper]{paper}

\usepackage{multirow}
\usepackage{makecell}
\usepackage{arydshln}

\begin{document}

\begin{table}[h]
\centering
\begin{tabular}{|*{7}{c|}}
\hline
\multirowcell{2}{Function} & \multicolumn{1}{c|}{Input(s)} & \multicolumn{1}{c|}{Output(s)} & \multicolumn{4}{c|}{Operations} \\
\cdashline{2-3} \cline{4-7}
& Type(s) & Type(s) & M & S & a & I \\
\hline
$\mathtt{j\_inv}$ & $(A, C)$ \\ $K \times K$ & $j(E)$ \\ $K$ & 3 & 4 & 8 & 1 \\ \hline
\end{tabular}
\caption{Summary of functions}
\label{tab:functions}
\end{table}

\end{document}

The point is that the table header is exactly as I want, but then in the second row when I start to actually write the values, I do not know how to make the second and third column divided into two parts like their header, and divided by a dashed line. Simply, I put the newline symbol between the two parts, but it does not give the desired effect of course. Any ideas how to achieve what I want?

  • Could you please post a code that does not throw errors? – marmot Apr 3 '18 at 15:52
  • @marmot This code is not supposed to throw error, I believe. It compiles successfully, but the end result is not what I desire. The header is all fine, take the second row which includes values, for the second column I have written $(A, C)$ \\ $K, how this should be displayed is that ` $(A, C)$` should be at the top, then a dashed line comes and then $K$ underneath the dashed line. Similar idea for the third column too. I achieve that for the headers, but don't know how to achieve that for the actual values. – pixel Apr 3 '18 at 15:54
  • Well it does not compile on my TeXLive 2017 distribution with either pdflatex, xelatex or lualatex. – marmot Apr 3 '18 at 15:56
  • @marmot How about now? I believe arydshln needs to be loaded last. – pixel Apr 3 '18 at 15:58
  • Yes, now it compiles. ;-) – marmot Apr 3 '18 at 15:59
1

Most likely I am missing something. You have already found out in the header how to split a cell. Why can't you just repeat it?

\documentclass[a4paper]{paper}

\usepackage{multirow}
\usepackage{makecell}
\usepackage{arydshln}

\begin{document}

\begin{table}[h]
\centering
\begin{tabular}{|*{7}{c|}}
\hline
\multirowcell{2}{Function} & \multicolumn{1}{c|}{Input(s)} & \multicolumn{1}{c|}{Output(s)} & \multicolumn{4}{c|}{Operations} \\
\cdashline{2-3} \cline{4-7}
& Type(s) & Type(s) & M & S & a & I \\
\hline
\multirowcell{2}{$\mathtt{j\_inv}$} & $(A, C)$ &
$K \times K$ & $j(E)$ & & &\\ 
\cdashline{2-3} \cline{4-7}
& $K$ & 3 & 4 & 8 & 1 &\\ 
\hline
\end{tabular}
\caption{Summary of functions}
\label{tab:functions}
\end{table}

\end{document}

enter image description here

If this is not the output you want, you may benefit from posting an annotated table in which you explain what you want to achieve.

  • Thanks, this is the output I want, I was trying to use \multicolumn again in the second row. That was my mistake. – pixel Apr 3 '18 at 16:08

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.