如何用不透明的颜色为表格着色以致于看不到任何文字和线条?

如何用不透明的颜色为表格着色以致于看不到任何文字和线条?

我正在迭代一个 latex 文件,并希望将所有表格涂成绿色,这样就看不到任何文本或线条了。我尝试使用“透明”,但它会随着文本一起褪色。我希望颜色是绿色,并且不应该看到任何文本?我的代码是

\documentclass[border=3.14]{standalone}
\usepackage[table]{xcolor}
\begin{document}
\colorbox{green}{
\begin{tabular}{| c | c |}
  a & b \\
  c & d \\
\end{tabular}}
\end{document}

答案1

\color{green}在表格为线条和文本着色之前

\documentclass[border=3.14]{standalone}
\usepackage[table]{xcolor}
\begin{document}
\colorbox{green}{
\color{green}
\begin{tabular}{| c | c |}
  a & b \\
  c & d \\
\end{tabular}}
\end{document}

答案2

我不确定我是否正确理解了你的问题。下面将其参数排版在一个框内,并输出一个绿色框,其大小与参数的大小相同。

\documentclass[]{article}

\usepackage{xcolor}
\usepackage{grabbox}

\newsavebox\overgreenboxBox
\newcommand*\overgreenbox
  {%
    \grabbox\overgreenboxBox\hbox
      {%
        \textcolor{green}
          {%
            \vrule
              height \ht\overgreenboxBox
              depth \dp\overgreenboxBox
              width \wd\overgreenboxBox
          }%
      }%
  }

\begin{document}
\overgreenbox{\begin{tabular}{| c | c |}a&b\\c&d\\\end{tabular}}
\end{document}

在此处输入图片描述

答案3

您可以使用相同的颜色为文本和背景着色单元格背景和文本。如果您加载大批-package,您可以定义一个新的列类型 G(代表绿色)。\arrayrulecolor给线条上色。根据您的目标;使用这种方法,您可以单独更改三种颜色的项目:

\documentclass[border=3.14]{standalone}
\usepackage[table]{xcolor}
\usepackage{array}

\newcolumntype{G}{>{\cellcolor{green}\color{green}}{c}}
\arrayrulecolor{green} % Colourise rule for all tabulars, move inside the tabular environment to limit scope

\begin{document}

\begin{tabular}{| * {2}{G|}}
a & b \\
c & d \\
\end{tabular}
\end{document}

在此处输入图片描述

相关内容