Text Formattingcolor package conflicts with tabular environment?

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
luoyi
Posts: 4
Joined: Sat Oct 24, 2009 5:17 am

color package conflicts with tabular environment?

Post by luoyi »

the code is:

Code: Select all

\documentclass{article}
\usepackage[usenames]{color}
\begin{document}

\begin{tabular}{@{}p{10em}@{}p{10em}@{}}%
    aaa &bbb\\
    {\color{red} aaa} &bbb
\end{tabular}

\end{document}
it'll give me the result as the attachment, the red letters "abc" is obviously below than the normal "bbb". does anyone know how to resolve this issue?
Attachments
color_tabular_confict.JPG
color_tabular_confict.JPG (3.64 KiB) Viewed 1619 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

color package conflicts with tabular environment?

Post by localghost »

You are using the wrong command.

Code: Select all

\documentclass{article}
\usepackage[usenames]{xcolor}

\begin{document}
  \begin{tabular}{@{}p{10em}@{}p{10em}@{}}%
    aaa & bbb \\
    \textcolor{red}{aaa} & bbb
  \end{tabular}
\end{document}
And it's better to use the xcolor package.


Best regards and welcome to the board
Thorsten¹
Post Reply