制作颜色表格时,怎么使用透明的颜色填充?

发布于 2021-04-17 20:00:32

制作颜色表格时,怎么使用透明的颜色填充?
code:

\documentclass[a4paper]{ctexart}
\usepackage[landscape, right = 0.5cm, left =0.5cm, top = 0.5cm, bottom = 0.5cm]\{geometry}
\newcommand{\cweeek}[1]{#1}
\newcommand{\cday}[1]{#1}
\begin{document}
\begin{tabularx}{\textwidth}{|@{}X|@{}X|@{}X|@{}X|@{}X|@{}X|@{}X|}
\hline
\rowcolor{lightgray}
\cweak{周日}&\cweak{周一}&\cweak{周二}&\cweak{周三}&\cweak{周四}&\cweak{周五}&\cweak{周六}\\
\hline
\textcolor{red}{cday{1}}&\cday{2}&\cday{3}&\cday{4}&\cday{5}&\cday{6}&\cday{textcolor{red}{7}}
\\[1.65cm]
\hline
\textcolor{red}{\cday{8}}&\cday{9}&10&11&12&13&14\\[1.65cm]
\hline
\textcolor{red}{15}&16&17&18&19&20&21\\[1.65cm]
hline
\textcolor{red}{22}&23&24&25&26&27&28\[1.65cm]
\hline
\textcolor{red}{29}&30&31& & & &\\[1.65cm]
\hline
\end{tabularx}
\end{document}

example:

image.png

查看更多

关注者
0
被浏览
1.2k
LaTeXStudio
LaTeXStudio 2021-04-17
这家伙很懒,什么也没写!

透明的填充推荐借助tikz,去看看 tcolorbox 里表格制作,有透明度的例子。
https://tex.stackexchange.com/questions/473364/color-table-rows-and-columns

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}
\begin{NiceTabular}{ccc}
\CodeBefore
  \begin{tikzpicture}
  \fill [gray!10] (2-|1) rectangle (3-|last) 
                  (4-|1) rectangle (5-|last) ;
  \fill [blue,fill opacity = 0.2] (1-|2) rectangle (last-|3) ;
  \end{tikzpicture}
\Body
    a   & b   & c     \\ \hline
    1   & 2   & 3     \\
    4   & 5   & 6     \\
    7   & 8   & 9     \\
\end{NiceTabular}
\end{document}

image.png

1 个回答

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览