12

I've already found this answer on how to add a shadowbox around a normal tabular environment. I'd like to add a shadowbox to a longtable environment. Is this possible at all?

\documentclass{article}
\usepackage{longtable}

\begin{document}
  \begin{longtable}{|l|l|}
    \hline
    \textbf{Ze} & \textbf{Header} \\
    \hline
    \endhead
    \hline
    \endfoot
    Lorem & ipsum \\
    dolor & sit \\
    amet & consectetur \\
    adipiscing & elit \\
    Nunc & nec \\
    sem & eu \\
    dolor & ultrices \\
    suscipit & Donec \\
    eleifend & leo \\
    a & urna \\
    vulputate & suscipit \\
    Praesent & in \\
    nunc & purus \\
    Quisque & ut \\
    nulla & varius \\
    aliquam & risus \\
    consectetur & dictum \\
    nulla & Nullam \\
    at & aliquet \\
    nisi & Suspendisse \\
    quis & mattis \\
    leo & Curabitur \\
    non & neque \\
    mollis & porta \\
    quam & feugiat \\
    molestie & mi \\
    Curabitur & ornare \\
    nibh & nec \\
    orci & euismod \\
    auctor & Nulla \\
    sagittis & nunc \\
    non & euismod \\
    porta & Morbi \\
    molestie & dictum \\
    purus & a \\
    pharetra & magna \\
    dictum & vitae \\
    Aliquam & bibendum \\
    dui & quam \\
    vitae & euismod \\
    lorem & tristique \\
    nec & Morbi \\
    lacinia & tellus \\
    et & hendrerit \\
    mollis & Cras \\
    et & sem \\
    in & sapien \\
    mattis & hendrerit \\
    ac & vitae \\
    velit & Maecenas \\
    interdum & gravida \\
    dui & fringilla \\
    vehicula & mauris \\
    adipiscing & ac \\
    Ut & dignissim \\
    sapien & dignissim \\
    semper & fermentum \\
    diam & purus \\
    mattis & dui \\
    ut & consectetur \\
    ligula & nibh \\
  \end{longtable}
\end{document}
Moriambar
  • 11,466
vwegert
  • 2,875

1 Answers1

13

enter image description here

(credit)

\documentclass{article}
\usepackage{longtable}
\usepackage{color,array}
\def\lsdw{\smash{\lower5pt\rlap{\textcolor[gray]{.9}{\vrule width 5pt height\ht\strutbox depth \dp\strutbox}}}}
\begin{document}
  \begin{longtable}{|l|l!{\vline\lsdw}}
    \hline
    \textbf{Ze} & \textbf{Header} \\
    \hline
    \endhead
    \hline
    \multispan{2}%
    \kern5pt\textcolor[gray]{.9}{\leaders \vrule height 5pt\hfill}\mbox{}\kern-5pt
    \endfoot
    Lorem & ipsum \\
    dolor & sit \\
    amet & consectetur \\
    adipiscing & elit \\
    Nunc & nec \\
    sem & eu \\
    dolor & ultrices \\
    suscipit & Donec \\
    eleifend & leo \\
    a & urna \\
    vulputate & suscipit \\
    Praesent & in \\
    nunc & purus \\
    Quisque & ut \\
    nulla & varius \\
    aliquam & risus \\
    consectetur & dictum \\
    nulla & Nullam \\
    at & aliquet \\
    nisi & Suspendisse \\
    quis & mattis \\
    leo & Curabitur \\
    non & neque \\
    mollis & porta \\
    quam & feugiat \\
    molestie & mi \\
    Curabitur & ornare \\
    nibh & nec \\
    orci & euismod \\
    auctor & Nulla \\
    sagittis & nunc \\
    non & euismod \\
    porta & Morbi \\
    molestie & dictum \\
    purus & a \\
    pharetra & magna \\
    dictum & vitae \\
    Aliquam & bibendum \\
    dui & quam \\
    vitae & euismod \\
    lorem & tristique \\
    nec & Morbi \\
    lacinia & tellus \\
    et & hendrerit \\
    mollis & Cras \\
    et & sem \\
    in & sapien \\
    mattis & hendrerit \\
    ac & vitae \\
    velit & Maecenas \\
    interdum & gravida \\
    dui & fringilla \\
    vehicula & mauris \\
    adipiscing & ac \\
    Ut & dignissim \\
    sapien & dignissim \\
    semper & fermentum \\
    diam & purus \\
    mattis & dui \\
    ut & consectetur \\
    ligula & nibh \\
  \end{longtable}
\end{document}

enter image description here

David Carlisle
  • 757,742
  • Cool solution, but it has a slight problem: there are white horizontal lines in the right-hand shadow - barely visible lines between all table lines and wider lines wherever a \hline was added to the table. Is there anything I could do about these? – vwegert Nov 03 '13 at 20:48
  • @vwegert put a bit of an overlap, change \ht\strutbox to \dimexpr\ht\strutbox+2pt\relax – David Carlisle Nov 03 '13 at 20:53
  • There's another issue: The changes to the footer creates a weird side effect with the left-hand border line - see http://imagebin.org/275667. I haven't been able to find out what exactly causes this issue - I haven't even been able to reproduce it with the MWE above. After about an hour tweaking the table, I'll take a break and try again tomorrow. I'd be glad for any suggestion, though… – vwegert Nov 03 '13 at 22:10
  • @vwegert I don't see that, see image I added to answer. You may need to post code that generates the problem (perhaps as new question) – David Carlisle Nov 03 '13 at 22:36
  • I've narrowed the issue down to the arydshln package, see http://tex.stackexchange.com/questions/142275/combine-arydshln-and-longtable-with-fake-shadowbox – vwegert Nov 04 '13 at 19:36