2

Using m columns in a tabular, I would expect to get vertically centered cells:

\documentclass[a4paper, 12pt]{article}

\usepackage{amsmath}
\usepackage{array}

\begin{document}
\normalsize
\textbf{Some title}
\newline 
\newline 
\begin{tabular}{m{0.5 cm}>{}m{10 cm}|>{}m{4 cm}@{}m{0pt}@{}}
\hline 
\textbf{1.} & $11 \times \text{?} = 9$ & & \tabularnewline [0.8cm] \hline 
\textbf{2.} & $\text{?} \times \text{?} = 72$ & & \tabularnewline [0.8cm] \hline 

\end{tabular}

\end{document}

with lualatex 1.07 (TeX Live 2018) however, I get:

Tabular with vertically top-aligned cells

while lualatex 1.0.4 (TeX Live 2017) did correctly vertically center the cells.

Is this a bug? Should I correct the tabular formatting? Or is there any workaround for the 1.07 version?

(EDIT: Goal is to get the texts vertically centered like they used to be with lualatex 1.0.4 Software versions: For the failing TeX Live 2018 / lualatex 1.07:

lualatex 2018.7.28
LaTeX2e <2018-04-01> patch level 2
array.sty    2018/04/07 v2.4g

The previous working TeX Live 2017 / lualatex 1.0.4 has following versions:

lualatex 2018.1.13
LaTeX2e <2017-04-15>
array.sty    2016/10/06 v2.4d

)

7
  • I guess this is due to the [0.8cm]. What do you try ta achieve, precisely?
    – Bernard
    Sep 5, 2018 at 14:37
  • I'd like the texts to be vertically centered. The [0.8cm] did not prevent this when using the 1.0.4 version of lualatex.
    – zezollo
    Sep 5, 2018 at 14:44
  • with recent array this not work as you desired. if you like to have more vertical space in cells, than you should use cellspace or makecell package and their possibility to add some vertical space above and below cells' contents.
    – Zarko
    Sep 5, 2018 at 14:52
  • Which versions of the LaTeX format and of the array package do you use, under TeXLive2017/LuaTeX 1.04 and TeXLive2018/LuaTeX 1.07? For what it's worth, I can reproduce the lack of vertical centering on a MacTeX2018/LuaTeX 1.07/LaTeX2e 2018-04-01 patch level 5/array 2018-04-30 v.2.4h system, but I can not reproduce the issue on a MikTeX 2.9.6600/LuaTeX 1.07/LaTeX2e 2017-04-15/array 2016-10-06 v2.4d` system. Given that both of these sstems use LuaTeX 1.07, I suspect the issue you've come across is related to the LaTeX format and/or to the array package.
    – Mico
    Sep 5, 2018 at 14:58
  • @Mico I've added the software versions in my question. Versions of LuaTex and array both change in my case. Looks like the combination LuaTeX 1.07 and array 2018-04-30 (and later) produces the problem.
    – zezollo
    Sep 5, 2018 at 15:27

2 Answers 2

3

lualatex is not relevant here, you see the same output from pdflatex or xelatex.

You are seeing the effect of a bug fix to the m column, as you can see by using the old version code with a [=2016-10-06] as below.

enter image description here

\documentclass[a4paper, 12pt]{article}

\usepackage{amsmath}
\usepackage{array}[=2016-10-06]

\begin{document}
\normalsize
\textbf{Some title}
\newline 
\newline 
\begin{tabular}{m{0.5 cm}>{}m{10 cm}|>{}m{4 cm}@{}m{0pt}@{}}
\hline 
\textbf{1.} & $11 \times \text{?} = 9$ & & \tabularnewline [0.8cm] \hline 
\textbf{2.} & $\text{?} \times \text{?} = 72$ & & \tabularnewline [0.8cm] \hline 

\end{tabular}

\end{document}
5
  • 1
    note the new version matches the specification of [0.8cm] in the document which was always documented as adding space after the row (or more exactly adding to the default depth of the row) Sep 5, 2018 at 19:22
  • So what do you recommend the OP should do, if his/her intent is to achieve vertical centering? Simply load the array package with a deliberately chosen older date?
    – Mico
    Sep 5, 2018 at 20:10
  • 1
    @Mico possibly set \arraystretch rather than use [..] more generally avoid m for one-line entries, you really want them all on the same baseline. Sep 5, 2018 at 20:12
  • Using [0.8cm] was a way to achieve another goal that I thought would not fall into this topic. I have to ask another question for further advice. Not sure which answer I should accept, as one of them explains the reason for the new behaviour and the other one may be a good workaround too.
    – zezollo
    Sep 6, 2018 at 15:53
  • as long as the tick doesn't go to @egreg I never mind not getting the tick :-) Sep 6, 2018 at 15:55
2

You can use the cellspace package, which lets you define a minimal vertical spacing at the top and bottom of cells in columns with specifier prefixed with the letter S ((C if you load siunitx, for compatibility reasons):

\documentclass[a4paper, 12pt]{article}

\usepackage{amsmath}
\usepackage{array, cellspace}
\setlength{\cellspacetoplimit}{0.6cm}
\setlength{\cellspacebottomlimit}{0.6cm}

\begin{document}
\normalsize
\textbf{Some title}
\newline
\newline
\begin{tabular}{S{m{0.5 cm}}>{}S{m{10 cm}}|>{}m{4 cm}@{}m{0pt}@{}}
\hline
 \textbf{1.}& $11 \times \text{?} = 9$ & & \\ \hline
\textbf{2.} & $\text{?} \times \text{?} = 72$ & & \\ \hline
\end{tabular}

\end{document} 

enter image description here

3
  • This looks good and like what I want to achieve. I'll try this as soon as possible. I just do not exactly understand the prefix letter when siunitx needs to be loaded too (what will happen in the real documents I use): should I simply replace the S by a C?
    – zezollo
    Sep 5, 2018 at 15:35
  • Yes. The reason for that is that siunitx defines an S column type (You may change the prefix as an option on loading cellspace).
    – Bernard
    Sep 5, 2018 at 15:46
  • Not sure which answer I should accept, because your answer is giving a possible good workaround and the other is explaining the origin of the problem. Upvoted both. Now, in order to find a workaround that will exactly match my problem required to ask another question...
    – zezollo
    Sep 6, 2018 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .