简体   繁体   中英

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

在此处输入图像描述

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

You should never use \resizebox for elements which contain text.

Instead you could save some space by using multiple lines for your header cells and restructure your table a bit:

\documentclass[12pt]{article}
\usepackage[text-series-to-math=true]{siunitx}
\usepackage{tabularray}
\usepackage{geometry}
\begin{document}

\begin{table}[htp]
\caption{... The temperature range in Bristol, UK was 3--\SI{21}{\degree C} and the humidity 50\%--75\% during the measurement.}
\begin{tblr}{
 colspec={XXXXX},
 columns={halign=c,valign=m},
 row{1}={font=\bfseries},
 column{1}={font=\bfseries},
 stretch=0, 
 rows={ht=2\baselineskip},
 hlines,
 vlines
}
Air pollutant & Detection limit & Concentration range to expect 
by EPA & Concentration range in Bristol, UK \\
Ozone (O\textsubscript{3}) & 10 ppb & 0--150 ppb & 0--100 ppb  \\
Nitrogen dioxide & 10 ppb & 0--50 ppb & 20--55 ppb  \\
PM\textsubscript{2.5} & 5 & 0--40 \SI{}{\micro\gram/m^3} & 0--40 \SI{}{\micro\gram/m^3}  \\
PM\textsubscript{10} & 10 & 0--100 \SI{}{\micro\gram/m^3}  & 0--100 \SI{}{\micro\gram/m^3}  \\
\end{tblr}%
\end{table}

\end{document}

在此处输入图像描述

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, eg 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 eg 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

在此处输入图像描述

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}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM