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 am editing a frame of a presentation in beamer. This frame has 2 parts side by side. The left side is a program by tabbing containing 5 lines:

\begin{frame}
  \frametitle{A motivating example}
  \begin{columns}
    \begin{column}{0.48\textwidth}
      \begin{framed}
        \resizebox{0.85\textwidth}{!}{%
          \begin{minipage}{\textwidth}
            \begin{tabbing}
              \quad \= \hspace{-0.3cm} \quad \= \hspace{-0.1cm} \quad \= \hspace{-0.1cm} \quad \= \hspace{-0.1cm} \quad \= \hspace{0cm} \= \\[-\baselineskip]\kill
              1 \> \> line 1 \\
              2 \> \> line 2 \\
              3 \> \> line 3 \\
              4 \> \> line 4 \\
              5 \> \> line 5
            \end{tabbing}
          \end{minipage}}
      \end{framed}
    \end{column}
    \begin{column}{0.48\textwidth}
    ...
    \end{column}
  \end{columns}
\end{frame}

I would like to make Lines 3, 4 and 5 in blue, instead of black. I try to put \color{blue} in front of 3, but it doesn't color things after 3. I try to put \textcolor{blue}{...line 3...line 4...line 5...}, but it gives an error.

Does anyone know if it is possible to color 3 lines together?

share|improve this question
    
each tabbing cell is a separate box, so you can put \color in each cell –  David Carlisle Aug 14 '12 at 10:03
    
sure, I am wondering if it is possible to color a block, because I have more than 5 lines, and i will change colors quite often... –  SoftTimur Aug 14 '12 at 10:38

1 Answer 1

up vote 4 down vote accepted

Clearly this is gross abuse of syntax, and you didn't hear this from me...

enter image description here

\documentclass{article}

\usepackage{color}

\begin{document}

\begin{tabbing}
              \quad \= \hspace{-0.3cm} \quad \= \hspace{-0.1cm} \quad \= \hspace{-0.1cm} \quad \= \hspace{-0.1cm} \quad \= \hspace{0cm} \= \\[-\baselineskip]\kill
              1 \> \> line 1 \\
              2 \> \> line 2 \\[0pt \color{red}]
              3 \> \> line 3 \\
              4 \> \> line 4 \\[0pt \color{green}]
              5 \> \> line 5
\end{tabbing}

\end{document}
share|improve this answer

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.