4

I am iterating a latex file and want to colour all the tables green such that no text or no lines are visible. I tried using "transparent" but it fades the colour along with the text. I want the colour to be the green and no text should be visible? My code is

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

\color{green} before the table will color the lines and text

\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}
3

I'm not sure whether I understood your question correctly or not. The following typesets its argument inside a box and outputs a green box which has the same size as the argument would have had.

\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}

enter image description here

2

You can colourise both cell background and text using the same colour for text and background. If you load the array-package, you can define a new column type G (for green). \arrayrulecolor colourise the lines. Depending of your goals; with this approach you can change each of the three coloured item individually:

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.