0

I'm trying to apply a shadow to a longtabu environment (because I want the table expands to fit the available width), similar to this table (CSS):

enter image description here

But, for my sample LaTeX` table, between the shadow and the table, there's some border and padding and I don't know how to remove it:

\documentclass[11pt]{article}

\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{geometry}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage[skins]{tcolorbox}
\usepackage{tabu}
\usepackage{longtable}

\definecolor{lightgray}{RGB}{180, 180, 180}

\geometry{
  a4paper,
  margin=1cm,
  top=1.3cm,
}

\begin{document}

\begin{tcolorbox}[enhanced,size=fbox,drop shadow]
  \begin{longtabu} to \textwidth {cXc}
    \rowcolor{Maroon}
    Imagen & Producto & Total\\
    \rowcolor{lightgray}
    A & B & C
  \end{longtabu}
\end{tcolorbox}

\end{document}

enter image description here

In short, I want to remove the borders, to center the shadow, and to remove the padding between the shadow and the table, preferably with using standard packages or environments, but using custom commands is also fine.

4
  • Please provide a compilable document code, not just fragments
    – user31729
    Commented Jan 31, 2017 at 0:04
  • The longtabu is not necessary here
    – user31729
    Commented Jan 31, 2017 at 0:10
  • @ChristianHupfer But it must be a "longtable" environment, because the table could span more than one page when images add added to the table in the first column.
    – ABu
    Commented Jan 31, 2017 at 0:15
  • 1
    No, even in tcolorbox with breakable, the longtabu won't break any longer!
    – user31729
    Commented Jan 31, 2017 at 0:16

1 Answer 1

1

The solution was to put the table inside a TiKz node:

\begin{tikzpicture}
  \node[draw=none,shade,blur shadow={shadow blur steps=20, shadow xshift=0ex,shadow yshift=0ex, shadow blur radius=1ex},inner sep=0pt]
       {
         \begin{tabu}{>{\centering}m{0.2\textwidth}p{0.5\textwidth}>{\centering}p{0.2\textwidth}}
           \rowcolor{Maroon}
           \rowfont{\large\color{white}}
           & Producto & Total\\[0.8ex]
           \rowcolor{lightgray}
           \includegraphics[height=80px, width=0.18\textwidth,keepaspectratio]{icon.png} & B & J
         \end{tabu}
     };
\end{tikzpicture}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .