4

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.

2

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}
  • 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
  • The idea of a minimal example is that it shows the problem, it's the OP's job to provide the example:-) I'll change the text and post an image – David Carlisle Dec 1 '13 at 21:22
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.