Search code examples
latexfont-sizepdflatex

The font size of tables is way too small in Latex


I am generating tables in latex. But the text's font is way too small compared to the main text size, which is 12 pt. Here is the Latex code

\begin{table}[htp]
\renewcommand{\arraystretch}{2}
\large
\resizebox{1\textwidth}{!}{%
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\textbf{Air pollutant}    & \textbf{Detection limit} & \textbf{Concentration range to expect 
by EPA} & \textbf{Concentration  range in Bristol, UK} & \textbf{Range in Bristol, UK} \\[3ex] 
\hline
 \textbf{Ozone (O$_{3}$) }       & \textbf{10 ppb}          & \textbf{0--150 ppb }                           
&       \textbf{0--100 ppb}                              &                      \\[3ex] \hline
\textbf{Nitrogen dioxide}  & \textbf{10 ppb}          & \textbf{0--50 ppb}                             
& \textbf{20--55  ppb}                              &                      \\[3ex] \hline
\textbf{PM$_{2.5}$}            & \textbf{5 }              & \textbf{0--40 \SI{} 
 {\micro\gram/m^3}}                            & \textbf{0--40    \SI{}{\micro\gram/m^3}  }                         
 &                      \\[3ex] \hline
 \textbf{PM$_{10}$}              & \textbf{10}              & \textbf{0--100   \SI{} 
 {\micro\gram/m^3} }                            & \textbf{0--100  \SI{}{\micro\gram/m^3}}                             
  &                      \\[3ex] \hline
 \textbf{Temperature  range} & -----           & ------                               & ---- 
      --                              & \textbf{3--$ 21 ^\circ C $}                 \\[3ex] 
 \hline
 \textbf{Humidity }         & -----           & -----                                & ----- 
    --                             & \textbf{50\%--75\% }               \\[3ex] \hline
 \end{tabular}%
 }
 \end{table}

and here is a screenshot of part of PDF to compare the main text and table font

enter image description here

I have this issue for several tables, so any help would be greatly appreciated.


Solution

  • Can I suggest a few things?

    You should avoid long headings with narrow content like numbers, unless cells contain long paragraphs, as well. Find the way to shorten the headings, e.g. by adding line breaks.

    Repeated content can be grouped and move to separate cells, which can also help with excessive widths.

    As you load siunitx, I would recommend to use \qtyrange{}{}{}. Typing them takes the same space and time but in case you need to make changes e.g. you have to change a range marker from -- to to you will appreciate to only have to do it in one place via siunitx. If you repeat long units, it is also possible to define your own units, for the same reason to make changes in one place. I think \SI{}{} is deprecated and should be changed to qty{}{}, although I am not entirely sure about it.

    This is my personal taste but IMO tables can look much better without vertical bars. I also added booktabs for improved horizontal rules.

    Here's a different version of your table

    enter image description here

    and the code

    \documentclass{article}
    \usepackage{array}
    \usepackage{siunitx}
    \usepackage{multirow}
    \usepackage{makecell}
    \usepackage{rotating}
    \usepackage{booktabs}
    
    \sisetup{
      range-units=single,
      range-phrase={\,--\,},
    }
    \DeclareSIUnit\ppb{ppb}
    \newcommand\nullval{---}
    
    \renewcommand\theadfont{\normalfont\bfseries}
    \renewcommand\theadgape{\Gape[0pt][0pt]}
    
    
    \begin{document}
    \begin{sidewaystable}
      \renewcommand\arraystretch{1.2}
      \caption{Caption of the table}
      \label{tab:table}
      \centering
      \begin{tabular}{
          wc{4cm}
          wc{2cm} @{\hspace{1em}}
          *3{wc{3cm}}
          wc{2cm}
        }
        \toprule
        \multirow{3}*{\thead*{Air\\pollutant}}
        & \multirow{3}*{\thead{Detection\\limit}}
        & \multicolumn{2}{c}{\thead{Concentration range:}}
        & \multirow{3}*{\thead{Range\\in Bristol, UK}} \\
        \cmidrule(lr){3-4}
        & & \thead{to expect\\by EPA} & \thead{in Bristol\\UK} &  \\
        \midrule
        \thead{Ozone (O\textsubscript{3})}
        & \qty{10}{\ppb} & \qtyrange{0}{150}{\ppb}    & \qtyrange{0}{100}{\ppb}    & \nullval \\
        \thead{Nitrogen dioxide}
        & \qty{10}{\ppb} & \qtyrange{0}{50}{\ppb}     & \qtyrange{20}{55}{\ppb}    & \nullval \\
        \thead{PM\textsubscript{2.5}}
        &  5             & \qtyrange{0}{40}{\mg/m^3}  & \qtyrange{0}{40}{\ug/m^3}  & \nullval \\
        \thead{PM\textsubscript{10}}
        & 10             & \qtyrange{0}{100}{\ug/m^3} & \qtyrange{0}{100}{\ug/m^3} & \nullval \\
        \thead{Temperature range}
        & \nullval       & \nullval                   & \nullval                   & \qtyrange{3}{21}{\degreeCelsius} \\
        \thead{Humidity}
        & \nullval       & \nullval                   & \nullval                   & \qtyrange{50}{75}{\%} \\
        \bottomrule
      \end{tabular}
    \end{sidewaystable}
    \end{document}