我正在尝试将阴影应用到longtabu
环境(因为我希望表格能够扩展以适应可用宽度),类似于此表格(CSS):
但是,对于我的示例 LaTeX 表,在阴影和表格之间,有一些边框和填充,我不知道如何删除它:
\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}
简而言之,我想删除边框、使阴影居中以及删除阴影和表格之间的填充,最好使用标准包或环境,但使用自定义命令也可以。
答案1
解决方案是将表放在TiKz
节点内:
\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}