0

I'm getting some strange behaviour with \multicolumns and dashed lines. I need a single-column \multicolumn in a document (since I need a partial-height vertical line, and that seems to be how you do those things); unfortunately, attempting to make that vertical line dashed seems to break. A two-column \multicolumn with a dashed vertical line works just fine, as does a one-column one with a solid vertical line; it only breaks when you have both a width of one column and a dashed line.

MWEs:

This works:

\documentclass{article}

\usepackage{colortbl}
\usepackage{arydshln}

\usepackage{tabu}

\begin{document}

    \begin{tabu}{X[c] X[c] | X[c] : X[c]}
        test & test & test & test\\
        test & \multicolumn{1}{|c|}{test} & test\\
    \end{tabu}

\end{document}

This does too:

\documentclass{article}

\usepackage{colortbl}
\usepackage{arydshln}

\usepackage{tabu}

\begin{document}

    \begin{tabu}{X[c] X[c] | X[c] : X[c]}
        test & test & test & test\\
        test & \multicolumn{2}{|c:}{test} & test\\
    \end{tabu}

\end{document}

This, however, doesn't:

\documentclass{article}

\usepackage{colortbl}
\usepackage{arydshln}

\usepackage{tabu}

\begin{document}

    \begin{tabu}{X[c] X[c] | X[c] : X[c]}
        test & test & test & test\\
        test & \multicolumn{1}{|c:}{test} & test\\
    \end{tabu}

\end{document}

Is there any way I can get a partial-height dashed line next to a one-column-width cell?

(Before anyone says anything, yes, I know vertical lines are normally a bad design decision. I've got a situation where I need to make it clear which cells have been merged and which haven't in a large-ish and complex table, and vertical lines are by far the clearest way to do that.)

  • Seems to me you're just one column short in the last example. In the first example too, btw. – Henk Metselaar Apr 11 '19 at 15:37
  • @HenkMetselaar Yes, but I've never had a problem with that in general (LaTeX just leaves the remaining cells blank), and that's true of the first (working) example as well. Adding that last cell doesn't solve the problem with the last example. – Sjiveru Apr 11 '19 at 15:38
  • I think you should fix your cell count. IIRC tabular lines are the first thing to get upset if your cell count is not accurate. – Bananguin Apr 11 '19 at 15:47
2

It works if you move the dotted line to the next column.

\documentclass{article}

\usepackage{colortbl}
\usepackage{arydshln}

\usepackage{tabu}

\begin{document}

    \begin{tabu}{X[c] X[c] | X[c] : X[c]}
        test & test & test & test\\
        test & \multicolumn{1}{|c}{test} & \multicolumn{1}{:c}{test}\\
    \end{tabu}

\end{document}
| improve this answer | |
  • Yup, that solves the problem. Thank you! – Sjiveru Apr 11 '19 at 16:06

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.