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.

My minimum working example :

\documentclass[11pt,a4paper]{article}
\usepackage[francais]{babel}
%\usepackage[latin1]{inputenc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tabularx}
\usepackage{array,multirow,makecell}
\setcellgapes{1pt}
\makegapedcells
\usepackage[table]{xcolor}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash }b{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash }b{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash }b{#1}}


\begin{document}

\begin{tabular}{m{.18\textwidth} m{.18\textwidth} m{.18\textwidth} m{.18\textwidth} m{.18\textwidth}} 
\hline \rowcolor{lightgray} Lipsum Lipsum Lipsum 1 & Lipsum Lipsum Lipsum 2 & Lipsum Lipsum Lipsum 3 & Lipsum Lipsum Lipsum 4 & Lipsum Lipsum Lipsum 5  \\
\hline Lipsum Lipsum Lipsum UNDER 1 & Lipsum Lipsum Lipsum UNDER 2 & Lipsum Lipsum Lipsum UNDER 3 & Lipsum Lipsum Lipsum UNDER 4 & Lipsum Lipsum Lipsum UNDER 5 \\
\hline
\end{tabular}


\end{document}

I am trying to align my table

  1. Centered vertically (this point seems ok)
  2. Left horizontally

However, given my above code the text is not aligned on left horizontally, but justified, which gives some horrible display with tons of word breaks. I simply want to force it aligned to left.

Issue

Thank you in advance for your help.

share|improve this question
    
Welcome to TeX.SX! –  Claudio Fiandrino Dec 1 '13 at 21:33

1 Answer 1

up vote 2 down vote accepted

You defined a raggedright column type but didn't use it?

enter image description here

\documentclass[11pt,a4paper]{article}
\usepackage[francais]{babel}
%\usepackage[latin1]{inputenc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tabularx}
\usepackage{array,multirow,makecell}
\setcellgapes{1pt}
\makegapedcells
\usepackage[table]{xcolor}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash }m{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash }m{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash }m{#1}}


\begin{document}

\begin{tabular}{L{.18\textwidth} L{.18\textwidth} L{.18\textwidth} L{.18\textwidth} L{.18\textwidth}} 
\hline \rowcolor{lightgray} Lipsum Lipsum 1 & x x x x x x x xLipsum Lipsum Lipsum 2 & Lipsum Lipsum Lipsum 3 & y y y y y y y y y  x x x x x x xLipsum Lipsum Lipsum 4 & Lipsum 5  \\
\hline Lipsum Lipsum UNDER 1 & Lipsum Lipsum UNDER 2 & Lipsum Lipsum Lipsum UNDER 3 & Lipsum Lipsum Lipsum UNDER 4 & Lipsum Lipsum g g g g gg g g Lipsum UNDER 5 \\
\hline
\end{tabular}


\end{document}
share|improve this answer
    
Yes but now it's not centered vertically, even if the align on left is working now. –  Hosare Dec 1 '13 at 21:17
    
@Hosare The vertical positioning is m as in your example, it is hard to see in the example as all entries are the same height –  David Carlisle Dec 1 '13 at 21:19
1  
I used other texts that I had to remove because of private data. If you modify it, you will notice the alignment down vertically. –  Hosare Dec 1 '13 at 21:20
1  
Sorry if I thought that it would help providing some code. Thanks for the advice, next time I will only ask for what I am looking for. –  Hosare Dec 1 '13 at 21:26
1  
Yes it works fine! Thank you very much! –  Hosare Dec 2 '13 at 10:15

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.