0

In this table, the two parts of the last line are not aligned. Why and how to fix it?

\documentclass{article}

\usepackage{amsfonts}
\usepackage{tabularx}
\usepackage[table]{xcolor}
\usepackage{wasysym}

\begin{document}

\begin{tabular}{@{} m{2cm} <{\hspace*{1mm}} | m{1.9cm} <{\hspace*{1mm}}}
\multicolumn{2}{c}{\cellcolor{black!20!white}{}}\\[-3mm]
\multicolumn{2}{c}{\cellcolor{black!20!white}{\footnotesize $\ \mathbf{15}$ \hspace{0pt plus 1filll} Test}}\\[1.5mm]
\scriptsize \hfill $\times \hspace{-1pt}\approx\hspace{-1pt}\checked$
& \scriptsize \hfill $\times \hspace{-1pt}\approx\hspace{-1pt}\checked$  \\                                                          
\dotfill\scriptsize $\square$\,$\square$\,$\square$ & \dotfill\scriptsize $\square$\,$\square$\,$\square$\\
\dotfill\scriptsize $\square$\,$\square$\,$\square$ & \dotfill\scriptsize $\square$\,$\square$\,$\square$\\
\dotfill\scriptsize $\square$\,$\square$\,$\square$ & \dotfill\scriptsize $\square$\,$\square$\,$\square$\\[3mm]
\end{tabular}

\end{document}

enter image description here

Log

This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=pdflatex) \write18 enabled. entering extended mode (./bac_a_sable.tex LaTeX2e <2017-04-15> Babel <3.10> and hyphenation patterns for 84 language(s) loaded. (/usr/local/texlive/2017/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/local/texlive/2017/texmf-dist/tex/latex/base/size10.clo)) (/usr/local/texlive/2017/texmf-dist/tex/latex/amsfonts/amsfonts.sty) (/usr/local/texlive/2017/texmf-dist/tex/latex/tools/tabularx.sty (/usr/local/texlive/2017/texmf-dist/tex/latex/tools/array.sty)) (/usr/local/texlive/2017/texmf-dist/tex/latex/xcolor/xcolor.sty (/usr/local/texlive/2017/texmf-dist/tex/latex/graphics-cfg/color.cfg) (/usr/local/texlive/2017/texmf-dist/tex/latex/graphics-def/pdftex.def (/usr/local/texlive/2017/texmf-dist/tex/generic/oberdiek/infwarerr.sty) (/usr/local/texlive/2017/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)) (/usr/local/texlive/2017/texmf-dist/tex/latex/colortbl/colortbl.sty)) (/usr/local/texlive/2017/texmf-dist/tex/latex/wasysym/wasysym.sty) (./bac_a_sable.aux) (/usr/local/texlive/2017/texmf-dist/tex/context/base/mkii/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] ) (/usr/local/texlive/2017/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/local/texlive/2017/texmf-dist/tex/latex/amsfonts/umsb.fd) (/usr/local/texlive/2017/texmf-dist/tex/latex/wasysym/uwasy.fd) [1{/usr/local/t exlive/2017/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./bac_a_sable.aux) )< /usr/local/texlive/2017/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb> Output written on bac_a_sable.pdf (1 page, 42174 bytes). SyncTeX written on bac_a_sable.synctex.gz. Transcript written on bac_a_sable.log.

1

The interaction between m columns and the \\[..] optional length argument was corrected in the 2018 array package release so with an up to date system you get better alignment. In general though using m especially in combination with <{\hspace*{1mm} is a rather fragile setting. (m columns are designed for multi-line paragraph boxes with line breaking within the cell, you do not have that here, and adding an \hspace just on the last line of a paragraph only does anything sensible as there is only one line here.

  • I've replaced m{2cm} by p{2cm} and it is solved. – Colas Jul 7 '18 at 17:42

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.