Graphics, Figures & TablesColored Text in Paragraph Column of Table causes Line Break

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
aquasonic
Posts: 1
Joined: Sat Aug 27, 2011 7:17 pm

Colored Text in Paragraph Column of Table causes Line Break

Post by aquasonic »

Hello,

I would like to make my table header row with colored text. But if I try to give the text the color green with the \color command it makes ma a linebreak before the text. Only when I use the "p" style for the column. See following example:

Code: Select all

\documentclass[11pt]{article}
\usepackage{array}
\usepackage{color}

\begin{document}
\begin{table}[H]
\begin{tabular}{p{0.13\textwidth} p{0.75\textwidth}} 
\hline
	\color{green}Header 1 & Header 2 \\
\hline
	Row 1 & Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat \\
	Row 2 & Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat \\ 
		\end{tabular}
\end{table}
\end{document}
I know I could make it with \textcolor. But I will set the color in a new enviroment called \tableheader, in which I use the \rowstyle command explained in this topic. Because I don't know the text to give at the second argument on \textcolor I cannot use this.

Does anyone has an idea to get rid of the newline?

Thank you very much and greets,
aquasonic

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply