Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Nov 3 '11 at 14:55

This question came from our site for professional and enthusiast programmers.

1  
You should as LaTeX questions on s.tk/tex. –  Matt Ball Nov 3 '11 at 14:42
1  
You should make a small complete example (with a standard font available on every system) that demonstrates your problem. Code snippets are in general useless. –  Ulrike Fischer Nov 3 '11 at 15:41
    
I solved my problem. I put another \color{darkblue} after the \begin{table} Now I have caption, lines, and text, all in dark blue. –  grandeabobora Nov 3 '11 at 15:52
add comment

1 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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