I know this problem has been discussed many times, and the proposed solutions were to use yet nested parboxes inside table cells, but I would like to avoid that. Up to now, I was using my table with each column defined with the X option. The newlines statements were taken into account and this was working nicely. enter image description here

Then, I decided that the first column was a bit too large and I replaced the X column statement by l for the left column. However the result I got now is not properly aligned. As you see, I got unnecessary blank spaces and the newlines were discarded.

enter image description here

The minimal working code I have:

% Add extra space for proper alignement between table rows
\tabulinesep = 3pt


    \begin{tabu}{X X X}\toprule
        Catégories & Objectifs de la vue & Exemples de vue\\\midrule

        \adjustbox{margin=1ex 0.5\baselineskip}{\includegraphics[width=0.05\textwidth]{example-image-a}} & Afficher un type particulier de contenu comme une image ou un texte & Image view, label\\


        \adjustbox{margin=1ex 0.5\baselineskip}{\includegraphics[width=0.05\textwidth]{example-image-b}} & Afficher des collections ou un groupe de vues & Collection view (conteneur), table view (ableau)\\

        Contrôles utilisateurs

        \adjustbox{margin=1ex 0.5\baselineskip}{\includegraphics[width=0.05\textwidth]{example-image-c}} & Effectuer des actions pour afficher des éléments & Bouton, un slider (barre glissante), switch (interrupteur ON-OFF)\\


        \adjustbox{margin=1ex 0.5\baselineskip}{\includegraphics[width=0.05\textwidth]{example-image-a}} & Naviger dans les vues ou effectuer des actions & Barre d'outils, barre de navigation, barre d'onglets\\


        \adjustbox{margin=1ex 0.5\baselineskip}{\includegraphics[width=0.05\textwidth]{example-image-b}} & Recevoir une entrée de l'utilisateur généralement à partir du clavier & Barre de recherche, text view\\


        \adjustbox{margin=1ex 0.5\baselineskip}{\includegraphics[width=0.05\textwidth]{example-image-c}} & Serveur de conteneurs pour d'autres vues & Simple vue, scroll view\\

        Modal & Interrompre le flux de l'application pour autoriser l'utilisateur à effectuer une action particulière & \enquote{Action sheet} (feuille d'actions), \enquote{alert view} (boites de dialogues d'avertissement)\\\bottomrule

  • 1
    This is by design. "l" columns is not in paragraph mode. Use a p{2cm} or something, but why not use tabu's advance and easy way to adjust column width in fraction of "X" {0.8X 1.1X 1.1X}? That is tabu's strength. Since I do not have your picture, it is to much work to provide you with a MWE. Basically, you change the column definition until it suits you: \begin{tabu}{0.8X 1.1X 1.1X}\toprule – Sveinung Mar 18 '15 at 10:45
  • @Sveinung Thanks. I wasn't aware of such a feature from tabu. After having read the documentation, the exact syntax seems to be \begin{tabu}{X[0.8] X[1.1] X[1.1]}\toprule but this has no effect on the problem I'm experiencing on the second and third columns. :-/ – wget Mar 18 '15 at 10:52
  • Try some of the tricks in this answer: tex.stackexchange.com/a/74928/9632 – Sveinung Mar 18 '15 at 11:36
  • Or here: tex.stackexchange.com/a/66942/9632 Your example is not compilable for anyone beside yourself, because we do not have access to the pictures. – Sveinung Mar 18 '15 at 11:53
  • \\ ends the table row and starts the next row of the table, your red boxes just show the cells that are not in the short row. – David Carlisle Mar 18 '15 at 12:25

First of all, you are using manual carriage return/line feed to insert linebreaks for the images in the first column. Please replace them by \newline and do not use \\ since your table environment will then consider you are trying to make a new row and the text in the second and third column will be shifted to the bottom, with a blank space added (see the space I marked in red in the following screenshot).

enter image description here

In the code this would give (example just of the first content row):

Contenu\newline\adjustbox{margin=1ex 0.5\baselineskip}{\includegraphics[width=0.05\textwidth]{example-image-a}} & Afficher un type particulier de contenu comme une image ou un texte & Image view, label\\

As @Sveinung clearly suggested in the comments of your question, this is due to the l parameter which doesn't defined columns in paragraph mode: \newline is not interpreted.

Fortunately, tabu does provide X columns with a coefficient (cf. point 2.3 from the documentation). You basically just need to replace the line with \begin{tabu}{X X X}\toprule by \begin{tabu}{X[0.8] X[1.1] X[1.1]}\toprule for example.

This is now working like expected (notice how the first column has been resized but carriage returns have been kept):

enter image description here

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.