1

I know this has been asked before, yet all solutions I found didnt work for me so far.

What I try to achieve:

A solution that allows me to centrally (!) configure all (!) tables in my document in a way that text is vertically centered in rows. Most rows will have no specified height, yet some might.

Most solutions I found proposed a per-table command or even per-row commands. We are talking a document with 200 pages and several tables here, so I'd like to do this with a central command in a cls-file.

Consider the following MWE, which uses a simple table setup, yet causes the font to "stick" to the hlines. Is there a simple and elegant solution to this?

As a fallback, a larger padding between hline and the "top" of the text would be also ok.

\documentclass[10pt,chapterinoneline,english,onehalfspacing]{article}
\usepackage{colortbl}

\begin{document}
\begin{table*}[h]
    \caption{Witty caption.}
    \label{table:bla}
    \centering
    \begin{tabular}{p{0.4\linewidth}p{0.4\linewidth}}
        \hline
        A & B \\
        \hline
        Lorem ipsum & dolor sit amet \\
        \hline
        Lorem ipsum & dolor sit amet \\[2.5ex]
        \hline
    \end{tabular}
\end{table*}
\end{document}

enter image description here

closed as off-topic by user36296, Stefan Pinnow, Phelype Oleinik, TeXnician, dexteritas Jun 12 '18 at 12:46

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    your text in cells are correct spaced. to see this, just add p to A at the first column head. See if \renewcommand\arraystretch{1.2} in document preamble can make better "centering" of text (visually, of course), or add (in preamble) \setlength\extrarowheight{2pt} – Zarko Jul 10 '17 at 13:53
  • Thanks, that "bettered" the problem, yet didn't solve it entirely. In my provided MWE (see image), second row, the top of the capital "L" is much closer to the hline as the bottom end of the letter "p" is to the next hline. \setlength\extrarowheight{3pt} seems to be a (visually) working thing for now. – Xenonite Jul 10 '17 at 14:30
  • what you like to have is deliberated disabled. You show special case, that in cells are only capital letters. Now imagine, how the table would looks your second row, if contents of cells will be vertical centered in each cell separately ... So there is not much to do beside what I mentioned in my previous comment. For \extrarowheight I wrote value which people mostly use, but you can adopt it according to your taste. – Zarko Jul 10 '17 at 15:01
  • @Zarko Would you like to write an answer or should we close the question? – CarLaTeX Dec 16 '17 at 7:21
  • 4
    I'm voting to close this question as solved in comments – user36296 Jun 12 '18 at 11:41