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.

When I used color in a cell of a take, then this cell become wider. How to solve it?

enter image description here

The code is here:

\documentclass{beamer}

\usepackage[utf8x]{inputenc}
\usepackage{default}

\mode<presentation> {
  \usetheme{Warsaw}
  \usecolortheme{crane}
}

\newcommand{\green}[1]{\begingroup\color{green}#1\endgroup}
\begin{document} 
\begin{frame}

 \begin{table}
   \begin{tabular}{|p{2.5cm}|p{2.5cm}|p{3.5cm}|}
      \hline
                      & CCCC &  UUUUU\\
      \hline

      \hline
        AAAAAAAA &   itself &  \green{BBBBBBBBBBBBB}\\ 
      \hline
       AAAAAAAA &   itself &  BBBBBBBB\\ 
     \hline
   \end{tabular}   
 \end{table} 
\end{frame} 
\end{document}
share|improve this question
    
This code doesn't work. It contains lots of errors starting with the 1 in newcommand. Beside this use \textcolor{green}{#1} or \leavevmode\color{green} –  Ulrike Fischer Jul 3 at 8:42
    
strange, the code works for me. Thank you, I think your sugguestion works well. –  Ginger Jul 3 at 8:51
    
Now it will probably work (apart from the fact that I don't have the "default" package. But before the edit it had some error. –  Ulrike Fischer Jul 3 at 8:57

1 Answer 1

use

\newcommand{\green}[1]{\textcolor{green}{#1}}
share|improve this answer
    
this works, thanks! –  Ginger Jul 3 at 8:51

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.