[Tex/LaTex] Font color in XeLaTeX tables

fontsxetex

I defined the font and color of my text in the document preamble with the commands

\setmainfont{ConduMoveReg.otf}
\setmathfont{ConduMoveReg.otf}
\definecolor{darkblue}{cmyk}{1.00, 0.50, 0.00, 0.40}
\color{darkblue}

All my text, tables, and equations have the custom font I want, but only the normal text and equations are dark blue. My table's font and lines still black. Even if I change the color for red, for example, the table remains black. How can I fix it?

Best Answer

This way you could set the desired color globally in your preamble, also valid for tables:

\makeatletter
\AtBeginDocument{\color{darkblue}\global\let\default@color\current@color}
\makeatother

If you just mean tables in addition, you could redefine the table environment to get all lines and text such as captions in the desired color, such as:

\documentclass{article}
\usepackage{fontspec}
\usepackage{color}
\definecolor{darkblue}{cmyk}{1.00, 0.50, 0.00, 0.40}
\let\originaltable\table
\let\endoriginaltable\endtable
\renewenvironment{table}[1][ht]{%
  \originaltable[#1]
  \color{darkblue}}%
  {\endoriginaltable}   
\begin{document}
\color{darkblue}
text
\begin{table}
  \centering
  \begin{tabular}{|c|}
    \hline
    1 \\\hline
    2 \\\hline
  \end{tabular}
  \caption{Test table}
\end{table}
\end{document}​

So you need to do it just once in your preamble, and if you decide to change the color later you can adjust it at this single place. Also, you could include \centering in this redefinition if you center all tables.