5

I use quite a lot of (simple) tabular tables. Unfortunately the last column is always a little bit wonky: the text is a few mm higher than in the other columns, just enough to really notice it. How do I evenly center my text horizontally and vertically in my tables?

\documentclass[a4paper,12pt,numbers=endperiod]{scrartcl}
\usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=2cm,footskip=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage{tipa}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{array,booktabs}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{N}{@{}m{0pt}@{}}

\begin{document}

\begin{table}[htbp]
    \centering
    \caption{Analogie zwischen Phonologie und Graphematik}
    \renewcommand{\arraystretch}{1.3}
\begin{tabular}{ | M{4.9cm} | M{4.9cm} | M{4.9cm} | N }
\hline
    &
    \textit{Signifié} &
    \textit{Signifiant} \\[5pt]
\hline
    Sprechsprache &
    \textipa{/a/} (Phonem) &
    \textipa{[a]} (Phon) \\[5pt]
\hline
    Schriftsprache &
    \flq a\frq\space (Graphem) &
    \textvertline a\textvertline\space (Graph) \\[5pt]
\hline
\end{tabular}
    \label{phonographe}
\end{table}

\end{document}

Edit: here is the table with the \tipa{} as it looks for me now: Problem Table

\documentclass[a4paper,12pt,numbers=endperiod]{scrartcl}

\usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=2cm,footskip=1cm]{geometry}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{caption}
\usepackage{filecontents}
\usepackage{lipsum}
\usepackage{array,booktabs}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{lmodern}
\usepackage{CJKutf8}
\usepackage[footnote,printonlyused]{acronym}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage[russian,ngerman]{babel}
\usepackage{tipa}
\usepackage{csquotes}

\begin{document}

\begin{table}[htbp]
    \centering
    \caption{Konsonantische Alternationen bei der Pluralbildung}
    \newcommand{\heightadjustment}{\rule[-12pt]{0pt}{2.5\normalbaselineskip}}
\begin{tabular}{ | M{2.7cm} | M{6cm} | M{6cm} | }
\hline
     &
    Singular &
    Plural \\
\hline
    \glqq Wolf\grqq &
    \flq lup\frq\space\textipa{/lup/} \textipa{[lup]} &
    \flq lupi\frq\space\textipa{/lupi/} \textipa{[lup\textsuperscript{j}]} \\[5pt]
\hline
    \glqq Bär\grqq &
    \flq urs\frq\space\textipa{/urs/} \textipa{[urs]} &
    \flq urși\frq\space\textipa{/ursi/} \textipa{[urS\textsuperscript{j}]} \\[5pt] 
\hline
    \glqq Elefant\grqq &
    \flq elefant\frq\space\textipa{/ElEfant/} \textipa{[ElEfant]} &
    \flq elefanți\frq\space\textipa{/ElEfanti/} \textipa{[ElEfan\texttoptiebar{ts}\textsuperscript{j}]} \\[5pt]
\hline
    \glqq junger Bock\grqq &
    \flq ied\frq\space\textipa{/ied/} \textipa{[\textsubarch{i}ed]} &
    \flq iezi\frq\space\textipa{/iedi/} \textipa{[\textsubarch{i}ez\textsuperscript{j}]} \\[5pt]
\hline
    \glqq Krebs\grqq &
    \flq rac\frq\space\textipa{/rak/} \textipa{[rak]} &
    \flq raci\frq\space\textipa{/raki/} \textipa{[ra\texttoptiebar{tS}\textsuperscript{j}]} \\[5pt]
\hline
    \glqq Hamster\grqq &
    \flq hârciog\frq\space\textipa{/h\textbari r\texttoptiebar{tS}og/} \textipa{[h\textbari r\texttoptiebar{tS}og]} &
    \flq hârciogi\frq\space \textipa{/h\textbari r\texttoptiebar{tS}ogi/} \textipa{[h\textbari r\texttoptiebar{tS}o\texttoptiebar{dZ}\textsuperscript{j}]} \\[5pt]
\hline
\end{tabular}
    \label{konalt}
\end{table}

\end{document}
2

You want to use p (or b) columns for such a table not m as m loses baseline alignment. Also your specified widths made the table wider than the text width, so I reduced them a bit.

enter image description here

\documentclass[a4paper,12pt,numbers=endperiod]{scrartcl}

\usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=2cm,footskip=1cm]{geometry}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{caption}
\usepackage{filecontents}
\usepackage{lipsum}
\usepackage{array,booktabs}
\newcolumntype{M}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{lmodern}
\usepackage{CJKutf8}
\usepackage[footnote,printonlyused]{acronym}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage[russian,ngerman]{babel}
\usepackage{tipa}
\usepackage{csquotes}

\begin{document}

\begin{table}[htbp]
    \centering
  \setlength\extrarowheight{6pt}
    \caption{Konsonantische Alternationen bei der Pluralbildung}
\begin{tabular}{ | M{2.7cm} | M{5.9cm} | M{5.9cm} | }
\hline
     &
    Singular &
    Plural \\
\hline
    \glqq Wolf\grqq &
    \flq lup\frq\space\textipa{/lup/} \textipa{[lup]} &
    \flq lupi\frq\space\textipa{/lupi/} \textipa{[lup\textsuperscript{j}]} \\[5pt]
\hline
    \glqq Bär\grqq &
    \flq urs\frq\space\textipa{/urs/} \textipa{[urs]} &
    \flq urși\frq\space\textipa{/ursi/} \textipa{[urS\textsuperscript{j}]} \\[5pt] 
\hline
    \glqq Elefant\grqq &
    \flq elefant\frq\space\textipa{/ElEfant/} \textipa{[ElEfant]} &
    \flq elefanți\frq\space\textipa{/ElEfanti/} \textipa{[ElEfan\texttoptiebar{ts}\textsuperscript{j}]} \\[5pt]
\hline
    \glqq junger Bock\grqq &
    \flq ied\frq\space\textipa{/ied/} \textipa{[\textsubarch{i}ed]} &
    \flq iezi\frq\space\textipa{/iedi/} \textipa{[\textsubarch{i}ez\textsuperscript{j}]} \\[5pt]
\hline
    \glqq Krebs\grqq &
    \flq rac\frq\space\textipa{/rak/} \textipa{[rak]} &
    \flq raci\frq\space\textipa{/raki/} \textipa{[ra\texttoptiebar{tS}\textsuperscript{j}]} \\[5pt]
\hline
    \glqq Hamster\grqq &
    \flq hârciog\frq\space\textipa{/h\textbari r\texttoptiebar{tS}og/} \textipa{[h\textbari r\texttoptiebar{tS}og]} &
    \flq hârciogi\frq\space \textipa{/h\textbari r\texttoptiebar{tS}ogi/} \textipa{[h\textbari r\texttoptiebar{tS}o\texttoptiebar{dZ}\textsuperscript{j}]} \\[5pt]
\hline
\end{tabular}
    \label{konalt}
\end{table}

\end{document}
2

Instead of specifying a per-row spacing adjustment using \\[<len>], we can add a strut to each entry of a particular column. The strut could stretch vertically below and above the baseline in order to stretch the line spacing exactly as needed:

enter image description here

\documentclass{article}

\usepackage{array}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}

\newcommand{\heightadjustment}{\rule[-12pt]{0pt}{2.5\normalbaselineskip}}
\begin{tabular}{ | >{\heightadjustment}M{49mm} | M{49mm} | M{49mm} | }
  \hline
  & \textit{Something} & \textit{Something else} \\
  \hline
  Sprechsprache & (Phonem) & (Phon) \\
  \hline
  Schriftsprache & (Graphem) & (Graph) \\
  \hline
\end{tabular}

\end{document}

Here are the struts visualized in the first column (obtained by using a 1pt width for the \rule, rather than 0pt):

enter image description here

  • Thank you so much! But there is still a problem in one of my tables that include \tipa{} elements. They still have the problem that the text in the last column is slightly higher than the rest. – LajosH Jul 20 '16 at 6:34
  • @LajosH: You should play around with the lengths in the strut. – Werner Jul 20 '16 at 7:08
  • I did, but there is no change. No matter if I change the 0 to a 1 or a 10 or a 50 =/ – LajosH Jul 20 '16 at 7:24

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.