2

When I compile the following code, I get a strange line appearing in the multicolumn for the general purpose registers under ax, bx, cx, and dx.

\documentclass[11pt,a5paper,footinclude=true,headinclude=true]{scrbook} % KOMA-Script book
\usepackage[T2A]{fontenc}                
\usepackage{multirow}

\begin{document}

\begin{center}
    \begin{tabular}{|c|c|c|c|}
        \hline
        Type & \multicolumn{2}{c|}{Register} & Purpose \\\hline\hline
        \multirow{16}{*}{General Purpose} & \multirow{2}{*}{ax} & ah & \multirow{2}{*}{Arithmetic} \\
                                        \cline{3-3}
                                        & & al & \\
                                        \cline{2-4}
                                        & \multirow{2}{*}{bx} & bh & \multirow{2}{*}{Base} \\
                                        \cline{3-3}
                                        & & bl & \\
                                        \cline{2-4}
                                        & \multirow{2}{*}{cx} & ch & \multirow{2}{*}{Counter} \\
                                        \cline{3-3}
                                        & & cl & \\
                                        \cline{2-4}
                                        & \multirow{2}{*}{dx} & dh & \multirow{2}{*}{Data} \\
                                        \cline{3-3}
                                        & & dl & \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{\multirow{2}{*}{sp}} & \multirow{2}{*}{Stack Pointer} \\
                                        & & & \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{\multirow{2}{*}{bp}} & \multirow{2}{*}{Base Pointer} \\
                                        & & & \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{\multirow{2}{*}{si}} & \multirow{2}{*}{Source Index} \\
                                        & & & \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{\multirow{2}{*}{di}} & \multirow{2}{*}{Destination Index} \\
                                        & & & \\
        \hline
        \multirow{6}{*}{Segment}        & \multicolumn{2}{c|}{ss} & Stack Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{cs} & Code Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{ds} & Data Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{es} & Extra Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{fs} & Extra Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{gs} & Extra Segment \\
        \hline
    \end{tabular}
\end{center}

\end{document}

Strange lines

Is there something I am doing wrong in the multicolumn/row

0
1

The two columns below sp to di should be replaced by:

\multicolumn{2}{c|}{}

to get rid of the vertical line.

Full example:

\documentclass[11pt,a5paper,footinclude=true,headinclude=true]{scrbook} % KOMA-Script book
\usepackage{multirow}

\begin{document}

\begin{center}
    \begin{tabular}{|c|c|c|c|}
        \hline
        Type & \multicolumn{2}{c|}{Register} & Purpose \\\hline\hline
        \multirow{16}{*}{General Purpose} & \multirow{2}{*}{ax} & ah & \multirow{2}{*}{Arithmetic} \\
                                        \cline{3-3}
                                        & & al & \\
                                        \cline{2-4}
                                        & \multirow{2}{*}{bx} & bh & \multirow{2}{*}{Base} \\
                                        \cline{3-3}
                                        & & bl & \\
                                        \cline{2-4}
                                        & \multirow{2}{*}{cx} & ch & \multirow{2}{*}{Counter} \\
                                        \cline{3-3}
                                        & & cl & \\
                                        \cline{2-4}
                                        & \multirow{2}{*}{dx} & dh & \multirow{2}{*}{Data} \\
                                        \cline{3-3}
                                        & & dl & \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{\multirow{2}{*}{sp}} & \multirow{2}{*}{Stack Pointer} \\
                                        & \multicolumn{2}{c|}{} & \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{\multirow{2}{*}{bp}} & \multirow{2}{*}{Base Pointer} \\
                                        & \multicolumn{2}{c|}{} & \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{\multirow{2}{*}{si}} & \multirow{2}{*}{Source Index} \\
                                        & \multicolumn{2}{c|}{} & \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{\multirow{2}{*}{di}} & \multirow{2}{*}{Destination Index} \\
                                        & \multicolumn{2}{c|}{} & \\
        \hline
        \multirow{6}{*}{Segment}        & \multicolumn{2}{c|}{ss} & Stack Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{cs} & Code Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{ds} & Data Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{es} & Extra Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{fs} & Extra Segment \\
                                        \cline{2-4}
                                        & \multicolumn{2}{c|}{gs} & Extra Segment \\
        \hline
    \end{tabular}
\end{center}

\end{document}

Result

And a version without vertical lines and less horizontal lines with rules of package booktabs:

\documentclass{article}
\usepackage{booktabs}
\begin{document}
  \begin{center}
    \begin{tabular}{llll}
      \toprule
      Type & \multicolumn{2}{l}{Register} & Purpose \\
      \midrule
      General Purpose & ax & ah & Arithmetic \\
      & & al & \\
      \addlinespace % \cmidrule{2-4}
      & bx & bh & Base \\
      &  & bl & \\
      \addlinespace
      & cx & ch & Counter \\
      & & cl & \\
      \addlinespace
      & dx & dh & Data \\
      & & dl & \\
      \cmidrule{2-4}
      & \multicolumn{2}{l}{sp} & Stack Pointer \\
      & \multicolumn{2}{l}{bp} & Base Pointer \\
      & \multicolumn{2}{l}{si} & Source Index \\
      & \multicolumn{2}{l}{di} & Destination Index \\
      \midrule
      Segment & \multicolumn{2}{l}{ss} & Stack Segment \\
      & \multicolumn{2}{l}{cs} & Code Segment \\
      & \multicolumn{2}{l}{ds} & Data Segment \\
      & \multicolumn{2}{l}{es} & Extra Segment \\
      & \multicolumn{2}{l}{fs} & Extra Segment \\
      & \multicolumn{2}{l}{gs} & Extra Segment \\
      \bottomrule
    \end{tabular}
  \end{center}
\end{document}

Result

2
  • Thank you. Why does that work over what I had? – Mike May 28 '17 at 1:34
  • Because there is only one vertical line in \multicolumn{2}{c|}{} at the right end of the two cells, but no line between the two cells. – Heiko Oberdiek May 28 '17 at 7:16

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.