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 would like to define a few table columns with fixed width, just like p{2cm}, but I prefer the text to be flushed left, instead of justified. So basically something like l{2cm}.

Is there a way to achieve that without having to touch every cell?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted
\documentclass{article}
\usepackage[english]{babel}
\usepackage{array,ragged2e}
\usepackage{blindtext}

\newcolumntype{L}[1]{>{\RaggedRight}p{#1}}% with hyphenation
\newcolumntype{M}[1]{>{\raggedright\arraybackslash}p{#1}}% without hyphenation
\begin{document}

\begin{tabular}{L{5cm}M{5cm}}
\blindtext & \blindtext
\end{tabular}

\end{document}

enter image description here

share|improve this answer
    
remember \arraybackslash or ` \\ ` will not work (can someone please markup \\? –  daleif Jun 30 '11 at 7:33
    
right, I edited the answer –  Herbert Jun 30 '11 at 7:38
    
I would do it in both, then the order does not matter for the user –  daleif Jun 30 '11 at 10:54
    
@daleif: it is one of the nice features of ragged2e that \RaggedRight does it for me ... ;-) –  Herbert Jun 30 '11 at 12:08
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.