1

Assuming the case that I would like to change the font-size of the table given below with adding \Large to the beginning of the table.

Somehow this doesn't apply to the theads and so the font size differs. One obvious solution is to go into every thead and add \Large ->

\thead{\Large Text1 and \\ \Large Text2} & A & B\\

Might there be a single line solution or lets say a proper way of doing it as it is getting quite annoying after some changes, e.g. in a bigger table?

Code:

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{makecell}

\begin{document}    

{\renewcommand{\arraystretch}{2}%
\begin{table}
\Large % for demonstration purpose 
\centering
\begin{tabular}{@{}ccc@{}}
\toprule
& \multicolumn{2}{c}{Text} \\
\cmidrule(r){2-3}
\thead{Text1 and \\ Text2} & A & B\\
\midrule
C & \thead{1\\and 1}& 2 \\
D & 3 & \thead{4\\ and 4} \\
\bottomrule
\end{tabular}
\end{table}} \quad

\end{document}
1

Using the trick from https://tex.stackexchange.com/a/409956

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{makecell}

\makeatletter
\newcommand{\currentfsize}{\f@size pt}
\makeatother

\newdimen\fsize
\newcommand{\setfsize}{\setlength{\fsize}{\currentfsize}}


\begin{document}    

{\renewcommand{\arraystretch}{2}%
\begin{table}
\Large % for demonstration purpose 
\renewcommand\theadfont{\setfsize}
\centering
\begin{tabular}{@{}ccc@{}}
\toprule
& \multicolumn{2}{c}{Text} \\
\cmidrule(r){2-3}
\thead{Text1 and \\ Text2} & A & B\\
\midrule
C & \thead{1\\and 1}& 2 \\
D & 3 & \thead{4\\ and 4} \\
\bottomrule
\end{tabular}
\end{table}} \quad

\end{document}
  • Funfact: One can't accept answers within six minutes. Thanks! – KLJ Dec 7 '18 at 12:27

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.