15

Hi I am trying the following code but only the first row (the headings) is being changed to the specified font size. How can I make the whole table's font size change?

\begin{table}[!htbp]
\fontsize{11}{9}
\centering
\begin{tabular}{p{2cm} | p{2cm} | p{2cm}}
\hline
\hline
\Result 1 & Result 2 & Result 3 \\ [0.2ex] 
\hline
22 & 34 & 12\\ 
\hline
65 & 43 & 55\\ 
\hline
42 & 76 & 23\\ [1ex] 
\hline
\end{tabular}
\end{table}
  • @MarioS.E. I tried that its still only resizing the first row – Matt9Atkins May 1 '13 at 14:04
  • Consider using the booktabs package, because it is awesome. – Werner May 1 '13 at 14:06
  • @Matt9Atkins as posted it will not resize the font at all. If you are seeing a change in the first row you must have a font selection there, such as \textbf. – David Carlisle May 1 '13 at 14:50
17

Font size settings such as \fontsize{11}{9} do not take effect until \selectfont is issued so that should be

\fontsize{11}{9}\selectfont

But that selects an 11pt font on a 9pt baseline so the text will not fit in the allocated space and you will get irregular spaced lines. Perhaps you intended

\fontsize{9}{11}\selectfont

Or better

\small
6

If you have multiple tables (using tabular) in the document, to save you from some typing you can do the following:

\documentclass{article}
\usepackage{etoolbox}
\BeforeBeginEnvironment{tabular}{\begin{center}\small}
\AfterEndEnvironment{tabular}{\end{center}}
\usepackage{booktabs}
\usepackage{float}
\floatplacement{table}{!htbp}

\begin{document}
\begin{table}
\begin{tabular}{ccc}
\toprule
Result 1 & Result 2 & Result 3 \\
\midrule
22 & 34 & 12\\ 
65 & 43 & 55\\ 
42 & 76 & 23\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

As you can see, the table construction is cleaner now =).

5

Or you can juste put a {\Large... your table... } like this...

\documentclass{article}
\begin{document}
\begin{center}
\begin{table}[!htbp]
\fontsize{11}{9}
\centering
{\Large %                                   <------ Here
\begin{tabular}{p{2cm} | p{2cm} | p{2cm}}
\hline
\hline
Result 1 & Result 2 & Result 3 \\ [0.2ex] 
\hline
22 & 34 & 12\\ 
\hline
65 & 43 & 55\\ 
\hline
42 & 76 & 23\\ [1ex] 
\hline
\end{tabular}
}%                                          <---- And here
\end{table}\end{center}
\end{document}

It's not very professional, but il works ;)

  • Why not very professional? Is there a disadvantage to using this simple method? – Pertinax Jun 1 '17 at 21:10

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.