2

Following this thread, I have used the array package and \setlength\extrarowheight{3pt} to slightly heighten the rows in the table below in order to make room for the diacritical marks.

\documentclass{article}
\usepackage{array}
\begin{document}
\setlength\extrarowheight{3pt}
\begin{table}[!h]
\begin{tabular}{|c|c|}
\hline
\"Ostersund & Married\\
\cline{1-1}
\'Orlaith & Couple\\
\hline
Twin & \AA m\aa l\\
\cline{2-2}
Peaks & O\'O\"O\H{O}\\
\hline
\'Acs & Anders\\
\cline{1-1}
\H{O}riszentp\'eter & Jonas\\
\cline{1-1}
\'Ujsz\'asz & \AA ngstr\"om\\
\hline
\end{tabular}
\end{table}
\end{document}

image

This, however, resulted in the somewhat inconvenient side effects, that in vertically merged cells subsequent rows are now (1) too far away from each other and (2) the contents are not vertically centered (as the rows are now closer to the (perhaps hidden) cell-separator immediately below them).

How can I specify the text height between the lines of the vertically merged cells and have their contents vertically (and horizontally) centered?


Related: How to vertically-center the text of the cells?

  • You can do a patch by creating an invisible line, say \def\trule#1#2{\vrule height #1 depth #2 width 0ex}, with the desired depth and height like \trule{3ex}{1ex} and add this to all rows that require a change in row height but using \renewcommand{\arraystretch}{1.3} would do. Note that the command \trule{<height>}{<depth>} will only affect the rows in which you apply it. – azetina May 12 '16 at 23:09
4

You can use the makecellpackage, and its multirowcell command, which allow for multiline cells. I added cellspace, which define minimal vertical padding at the top and bottom of cells in column with specifier prefixed with the letter. And finally, using utf8 encoding for your code and a T1` encoded font, you can directly type accented letters.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{cellspace}
\setlength\cellspacetoplimit{3pt}
\setlength\cellspacebottomlimit{3pt}
\usepackage{makecell}
\usepackage{multirow, array}

\begin{document}

\begin{table}[!h]
  \begin{tabular}{|Sc|Sc|}
    \hline
    Östersund & Married \\
    \cline{1-1}
    Órlaith & Couple \\
    \hline
    \multirowcell{2}[-1.2pt]{Twin \\Peaks} &Åmål \\
    \cline{2-2}
    & OÓÖŐ \\
    \hline
    Ács & \multirowcell{3}[-3pt]{Anders \\ Jonas\\ Ångström} \\
    \cline{1-1}
    Őriszentpéter & \\
    \cline{1-1}
    Újszász & \\
    \hline
  \end{tabular}
\end{table}

\end{document} 

enter image description here

  • This looks elegant. However, may I suggest a light edit to your text? It seems that a backtick might be missing, and as you switched to unicode there are some unnecessary spaces in the word Amal (cf. rendered output). – Matsmath May 13 '16 at 14:21
  • @Matsmath: It's corrected now. Thanks for pointing it! – Bernard May 13 '16 at 18:13

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.