0

Consider the following minimal working example:

\documentclass[a4paper,10pt]{scrbook}
\usepackage{longtable}
\usepackage{arydshln}

\begin{document}
    \begin{longtable}[mc]{|c|c|cc|}
        {\itshape Head 1}
        &{\bfseries Head 2}
        &{\scshape Head 3}
        &Head 4\\
        \hline
        \endhead
        x &y &z &w\\
        \cdashline{2-4}[2pt/5pt]
        x2 &Y &z2 &w2\\
        \hdashline[2pt/5pt]
        x3 &Y &z3 &w3\\
    \end{longtable}

    \begin{table}[!ht]
        \begin{longtable}[mc]{|c|c|cc|}
            {\itshape Head 1}
            &{\bfseries Head 2}
            &{\scshape Head 3}
            &Head 4\\
            \hline
            \endhead
            x &y &z &w\\
            \cdashline{2-4}[2pt/5pt]
            x2 &Y &z2 &w2\\
            \hdashline[2pt/5pt]
            x3 &Y &z3 &w3\\
        \end{longtable}
        \caption{Same Longtable, but encased inside a Table.}
    \end{table}

    Why do the vertical lines suddenly not work?
\end{document}

The undesidered behaviour is the mysterious disappearance of vertical lines, when longtables are places inside tables. Why is this happening and how do I stop this?

Note that the vertical lines reappear, when arydshln is removed, i. e. this package is responsible for the undesirable behaviour. On the other hand, I need the arydshln package, as it is really good at dashed lines (the only other alternative I could find is tabu, but that package will require massive changes to the huge number of longtables (to longtabu) in my document. So ideally I want to keep this package and prevent this behaviour. So what do I need to do?

UPDATE: The solution, as pointed out by @David Carlisle in the comments below, is to use tabular instead of longtable.

  • 4
    why have you got a longtable inside a table? It can not possibly do anything useful there, just use a normal tabular. also what is the [mc] option to longtable? – David Carlisle Jul 13 at 20:16
  • the same problem persists with \begin{tabular}. The [mc] option is just for vertical / horizontal alignment. It does not affect anything if you change this. – Thomas Jul 13 at 22:11
  • My mistake, you're right in general of course, and using tabular worked. – Thomas Jul 13 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.