I am looking for a way have white text on black background in the PDF output of PDFLaTeX applied to a document containing a basic table with dividing lines and some colored links. Using
\usepackage{xcolor}
\pagecolor[rgb]{0.,0.,0.}
\color[rgb]{1,1,1}
I gain the desired effect but only outside of the table.
I can put
\color[rgb]{1,1,1}
in every cell, but that is not practical and table lines are still black and hence do not show up.
EDIT: Here is a MWE; the tabular
makes room for a paragraph and lcr specification.
\documentclass[11pt,letterpaper]{article}
\usepackage[table]{xcolor}
\usepackage{array}
\begin{document}
\begin{table}[H]
\caption{Caption}
\label{Table1}
\begin{center}
\arrayrulecolor{white}
\newcolumntype{B}{>{\columncolor{black}\color{white}}c}
\begin{tabular}{ B l | B p{6in} }
\hline\hline
Text 1 & Text 2 \\
\hline\hline
Text 3 & Text 4 \\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}
Best Answer
You can do this with the
[table]
option ofxcolor
(which usescolortbl
):You can use the
array
package to define column types whose colour is black. E.g.defines a
B
column which is identical to ac
column, but black with white text. You can also define similar column types for the other types of columns (l
,p
andm
, for example). Forp
column types, you need to addhspace{0pt}
at the beginning of the cell to avoid odd spacing issues.Here's an example using each type.