在乳胶中形成页面和表格

在乳胶中形成页面和表格

在下面的代码中,我试图将表格全部放在一页上,但最后两列不适合该页面。我正在寻求一些帮助来解决这个问题,谢谢!我附上了一张截图

在此处输入图片描述

\documentclass{article}
\usepackage{graphicx}
\usepackage{booktabs, multirow}
\usepackage{siunitx}
\usepackage{amsmath}
 \setlength{\extrarowheight}{2pt}
\begin{document}
\begin{tabular}{l>{$}c<{$}llc} \toprule
& \text{Symbol}
        & \hfil Description                   & Units     & Estimated Value\\
\midrule
Parameters
& \mu_{H-YF}     & Human per capita mortality rate from YF                  & \si{1/days}  & \\
& \mu_H     & Human per capita mortality rate        & \si{1/days}  &  \\
& \mu_{H-AVD}     & Human per capita mortality rate from YEL-AVD      & \si{1/days} &  \\
& \mu_{H-AND}     & Human per capita mortality rate from YEL-AND & \si{1/days} &  \\
& \mu_{M}     & Mosquito per capita mortality rate & \si{1/days} &  \\
& \alpha_{M}     & Mosquito per capita birth rate & \si{1/days} &  \\
& \beta     & Mosquito per capita transmission rate (exposed to infectious) & \si{1/days} &  \\
& r     & Human per capita recovery rate (infectious to recovered) & \si{1/days} &  \\
& b    & Mosquito per capita biting rate on humans & \si{1/days} & \\
& p_H    & Probability that an infective bite generates new infection in humans  & \si{1/days} & \\
& p_M   & Probability that a new infection in the mosquito is generated  & \si{1/days} & \\
& \sigma    & Human per capita recovered to susceptible transition rate & \si{1/days} & \\
& e    & Vaccine efficiency & unitless & \\
& \gamma    & Human per capita rate of vaccination & \si{1/days} & \\
& w    & Human per capita rate of waning immunity & \si{1/days} & \\
\midrule
Initial Conditions
& V(0)  & initial volume of water above the hole    & \si{mL}   & 776.15 \\ \midrule
Variables
& S_H & Number of susceptible humans & number   & $S_H \geq 0 $ \\
& I_H & Number of infected humans & number   & $I_H \geq 0 $ \\
& R_H & Number of recovered humans & number   & $R_H \geq 0 $ \\
& N_H & Number of total human population & number   & $N_H \geq 0 $ \\
& S_M & Number of susceptible mosquitoes & number   & $S_M \geq 0 $ \\
& E_M & Number of exposed mosquitoes & number   & $E_M \geq 0 $ \\
& I_M & Number of infected mosquitoes & number   & $I_M \geq 0 $ \\
& N_M & Number of total mosquito population & number   & $S_M \geq 0 $ \\
\bottomrule
\end{tabular}

\end{document}

答案1

表格的第一列除了“参数”、“初始条件”和“变量”这三个项目外,大部分都是空的。将这些项目设为标题可以节省一整列,从而节省大量空间。我还建议您 (a) 使用环境tabularx并允许在第三列(以前称为第四列)换行,以及 (b) 通过在标题单元格中的两个单词之间引入换行符来缩小最后一列的宽度。

在此处输入图片描述


附录。为了保险起见,这里有一个额外的解决方案。它与上面的解决方案类似,因为它 (a) 使用环境tabularx,并且 (b) 重新排列材料以删除整个第一列。主要的变化是通过在每四行后插入一点空白来对表格材料进行更直观的分组。此外,最后两列的内容不是居中设置而是左对齐。

在此处输入图片描述

%% Code for first solution
%% -----------------------
\documentclass{article}
\usepackage{booktabs,siunitx,amsmath,
            geometry,tabularx,ragged2e}
\setlength{\extrarowheight}{2pt}
\newcolumntype{L}{>{$}l<{$}}
\newcolumntype{Y}{>{\RaggedRight}X}
\newlength\mylen
\settowidth\mylen{Estimated}
\begin{document}

\noindent
\begin{tabularx}{\textwidth}{@{} LYlp{\mylen} @{}} 
\toprule
\text{Symbol} & Description & Units & Estimated Value\\
\midrule
\multicolumn{4}{@{}l}{Parameters} \\ 
\mu_{H\text{-YF}}  & Human per capita mortality rate from YF       & \si{1/days} \\
\mu_H              & Human per capita mortality rate               & \si{1/days} \\
\mu_{H\text{-AVD}} & Human per capita mortality rate from YEL-AVD  & \si{1/days} \\
\mu_{H\text{-AND}} & Human per capita mortality rate from YEL-AND  & \si{1/days} \\
\mu_{M}            & Mosquito per capita mortality rate            & \si{1/days} \\
\alpha_{M}         & Mosquito per capita birth rate                & \si{1/days} \\
\beta              & Mosquito per capita transmission rate (exposed to infectious) & \si{1/days} \\
r                  & Human per capita recovery rate (infectious to recovered) & \si{1/days} \\
b                  & Mosquito per capita biting rate on humans     & \si{1/days} \\
p_H                & Probability that an infective bite generates new infection in humans & \si{1/days} \\
p_M                & Probability that a new infection in the mosquito is generated  & \si{1/days} \\
\sigma             & Human per capita recovered to susceptible transition rate & \si{1/days} \\
e                  & Vaccine efficiency                            & unitless \\
\gamma             & Human per capita rate of vaccination          & \si{1/days} \\
w                  & Human per capita rate of waning immunity      & \si{1/days} \\ 
\addlinespace
\multicolumn{4}{@{}l}{Initial Conditions}\\
V(0)               & initial volume of water above hole & \si{\milli\liter} & 776.15 \\ 
\addlinespace
\multicolumn{4}{@{}l}{Variables}\\
S_H & Number of susceptible humans     & number   & $S_H \geq 0 $ \\
I_H & Number of infected humans        & number   & $I_H \geq 0 $ \\
R_H & Number of recovered humans       & number   & $R_H \geq 0 $ \\
N_H & Number of total human population & number   & $N_H \geq 0 $ \\
S_M & Number of susceptible mosquitoes & number   & $S_M \geq 0 $ \\
E_M & Number of exposed mosquitoes     & number   & $E_M \geq 0 $ \\
I_M & Number of infected mosquitoes    & number   & $I_M \geq 0 $ \\
N_M & Number of total mosquito population & number& $S_M \geq 0 $ \\
\bottomrule
\end{tabularx}

\end{document}



%% Code for second solution
%% ------------------------
\documentclass{article}
\usepackage{booktabs,siunitx,amsmath,geometry,tabularx}
\newcolumntype{L}{>{$}l<{$}}
\begin{document}

\noindent
\begin{tabularx}{\textwidth}{@{} LXcc @{}} 
\toprule
$Symbol$ & Description & Units & Estimated\\
& & & Value\\
\midrule
\multicolumn{4}{@{}l}{Parameters} \\ 
\mu_H                & Human per capita mortality rate              & \si{1/days} \\
\mu_{H\textrm{-YF}}  & Human per capita mortality rate from YF      & \si{1/days} \\
\mu_{H\textrm{-AVD}} & Human per capita mortality rate from YEL-AVD & \si{1/days} \\
\mu_{H\textrm{-AND}} & Human per capita mortality rate from YEL-AND & \si{1/days} \\
\addlinespace
\mu_{M}            & Mosquito per capita mortality rate             & \si{1/days} \\
\alpha_{M}         & Mosquito per capita birth rate                 & \si{1/days} \\
\beta              & Mosquito per capita transmission rate (exposed 
                     to infectious) & \si{1/days} \\
r                  & Human per capita recovery rate (infectious to 
                     recovered) & \si{1/days} \\
\addlinespace
b                  & Mosquito per capita biting rate on humans      & \si{1/days} \\
p_H                & Probability that infective bite generates new 
                     infection in humans & \si{1/days} \\
p_M                & Probability that new infection in mosquito is 
                     generated   & \si{1/days} \\
\sigma             & Human per capita recovered to susceptible 
                     transition rate & \si{1/days} \\
\addlinespace
e                  & Vaccine efficiency                             & unitless \\
\gamma             & Human per capita rate of vaccination           & \si{1/days} \\
w                  & Human per capita rate of waning immunity       & \si{1/days} \\ 

\addlinespace\addlinespace
\multicolumn{4}{@{}l}{Initial Conditions}\\
V(0)               & Initial volume of water above hole & 
                     \si{\milli\liter} & 776.15 \\ 

\addlinespace\addlinespace
\multicolumn{4}{@{}l}{Variables}\\
S_H & Number of susceptible humans     & number   & $S_H \geq 0 $ \\
I_H & Number of infected humans        & number   & $I_H \geq 0 $ \\
R_H & Number of recovered humans       & number   & $R_H \geq 0 $ \\
N_H & Number of total human population & number   & $N_H \geq 0 $ \\
\addlinespace
S_M & Number of susceptible mosquitoes & number   & $S_M \geq 0 $ \\
E_M & Number of exposed mosquitoes     & number   & $E_M \geq 0 $ \\
I_M & Number of infected mosquitoes    & number   & $I_M \geq 0 $ \\
N_M & Number of total mosquito population & number& $S_M \geq 0 $ \\
\bottomrule
\end{tabularx}

\end{document}

答案2

我建议根据tabularx和进行这种布局geometry(如果不使用边距注释,则可以获得更合理的边距):

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{graphicx}
\usepackage{booktabs, multirow, makecell, tabularx}
\usepackage{siunitx}
\usepackage{amsmath}
 \setlength{\extrarowheight}{2pt}
\begin{document}

\setlength{\tabcolsep}{4pt}%
\centering%
\begin{tabularx}{\linewidth}{@{}p{0.5em}>{$}c<{$}Xlc} \toprule
& \text{Symbol}
        & \centering Description & Units & \makecell{Estimated\\ Value}\\
\midrule
\rlap{\em Parameters} \\[-2.5ex]
& \mu_{H-YF} & Human per capita mortality rate from YF & \si{1/days} & \\
& \mu_H & Human per capita mortality rate & \si{1/days} & \\
& \mu_{H-AVD} & Human per capita mortality rate from YEL-AVD & \si{1/days} & \\
& \mu_{H-AND} & Human per capita mortality rate from YEL-AND & \si{1/days} & \\
& \mu_{M} & Mosquito per capita mortality rate & \si{1/days} & \\
& \alpha_{M} & Mosquito per capita birth rate & \si{1/days} & \\
& \beta & Mosquito per capita transmission rate (exposed to infectious) & \si{1/days} & \\
& r & Human per capita recovery rate (infectious to recovered) & \si{1/days} & \\
& b & Mosquito per capita biting rate on humans & \si{1/days} & \\
& p_H & Probability that an infective bite generates new infection in humans & \si{1/days} & \\
& p_M & Probability that a new infection in the mosquito is generated & \si{1/days} & \\
& \sigma & Human per capita recovered to susceptible transition rate & \si{1/days} & \\
& e & Vaccine efficiency & unitless & \\
& \gamma & Human per capita rate of vaccination & \si{1/days} & \\
& w & Human per capita rate of waning immunity & \si{1/days} & \\
\midrule
\rlap{\em Initial Conditions}\\[-2.5ex]
& V(0) & initial volume of water above the hole & \si{mL} & 776.15 \\ \midrule
\rlap{\em Variables}\\[-2.5ex]
& S_H & Number of susceptible humans & number & $S_H \geq 0 $ \\
& I_H & Number of infected humans & number & $I_H \geq 0 $ \\
& R_H & Number of recovered humans & number & $R_H \geq 0 $ \\
& N_H & Number of total human population & number & $N_H \geq 0 $ \\
& S_M & Number of susceptible mosquitoes & number & $S_M \geq 0 $ \\
& E_M & Number of exposed mosquitoes & number & $E_M \geq 0 $ \\
& I_M & Number of infected mosquitoes & number & $I_M \geq 0 $ \\
& N_M & Number of total mosquito population & number & $S_M \geq 0 $ \\
\bottomrule
\end{tabularx}

\end{document} 

在此处输入图片描述

答案3

您可以将表格分成三个部分,而不是几乎空白的第一列,从而节省空间。

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{amsmath}
\usepackage{tabularx}

\sisetup{exponent-product=\cdot}

\begin{document}

\begin{table}

\begin{tabularx}{\textwidth}{
  @{}
  >{$}c<{$}
  >{\raggedright}X
  c
  c
  @{}
}
\toprule
\text{Symbol} &
  \multicolumn{1}{c}{Description} &
  \multicolumn{1}{c}{Unit} &
  Estimated Value \\
\midrule
\multicolumn{4}{@{}c@{}}{\itshape Parameters} \\
\mu_{\mathrm{YF}} &
  Human per capita mortality rate from Yellow  Fever &
  1/days & \num{3.5e-4} \\
\mu_{\mathrm{H}} &
  Human per capita mortality rate &
  1/days & \num{3.5e-5} \\
\mu_{\mathrm{AVD}} &
  Human per capita mortality rate from YEL-AVD &
  1/days & \\
\mu_{\mathrm{AND}} &
  Human per capita mortality rate from YEL-AND &
  1/days & \\
r &
  Human per capita recovery rate (infectious to recovered) &
  1/days & \num{0.143} \\
b &
  Mosquito average daily biting rate on humans &
  1/days & \num{3.00} \\
p_{\mathrm{H}} &
  Probability that an infective bite generates new infection in humans &
   unitless & $0 \leq p_{\mathrm{H}} \leq 1$ \\
e &
  Vaccine efficiency &
  unitless & $0 \leq e \leq 1$ \\
\gamma &
  Human per capita rate of vaccination &
  1/days & \num{0.500} \\
w &
  Human per capita rate of waning immunity induced by vaccination &
  1/days & \num{0.100} \\
\mu_{\mathrm{M}} & Mosquito per capita mortality rate &
  1/days & \num{0.09} \\
\alpha_{\mathrm{M}} &
  Mosquito per capita birth rate &
  1/days & \num{0.537} \\
\beta &
  Mosquito per capita transmission rate (exposed to infectious) &
  1/days & \num{0.143} \\
p_{\mathrm{M}} &
  Probability an infection occurs when a mosquito bites an infective host &
  unitless & $0 \leq p_{\mathrm{M}} \leq 1 $ \\

\addlinespace[1ex]

\multicolumn{4}{@{}c@{}}{\itshape Initial Conditions} \\
V(0) &
  initial volume of water above the hole &
  \si{\milli\liter} & \num{776.15} \\

\addlinespace[1ex]

\multicolumn{4}{@{}c@{}}{\itshape Variables} \\
S_{\mathrm{H}} &
  Number of susceptible humans &
  number & $S_{\mathrm{H}} \geq 0 $ \\
I_{\mathrm{H}} &
  Number of infected humans &
  number & $I_{\mathrm{H}} \geq 0 $ \\
R_{\mathrm{H}} &
  Number of recovered humans &
  number & $R_{\mathrm{H}} \geq 0 $ \\
N_{\mathrm{H}} &
  Number of total human population &
  number & $N_{\mathrm{H}} \geq 0 $ \\
S_{\mathrm{M}} &
  Number of susceptible mosquitoes &
  number & $S_M \geq 0 $ \\
E_{\mathrm{M}} &
  Number of exposed mosquitoes &
  number & $E_{\mathrm{M}} \geq 0 $ \\
I_{\mathrm{M}} &
  Number of infected mosquitoes &
  number & $I_{\mathrm{M}} \geq 0 $ \\
N_{\mathrm{M}} &
  Number of total mosquito population &
  number & $S_{\mathrm{M}} \geq 0 $ \\
\bottomrule
\end{tabularx}

\end{table}

\end{document}

需要注意的几点:

  1. 用于\num确保数字排版一致
  2. \si应该用于 SI 单位,因为 1/days 不是
  3. \extrarowheight在不需要的地方也增加空间
  4. 文本下标应直立排版

在此处输入图片描述

答案4

如果您不想更改字体大小,您可能还想让表格占据左右边距的一些空间。(表格下方的红线表示文本宽度)。

\documentclass{article}
\usepackage{graphicx}
\usepackage{booktabs, multirow}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{makecell}
\usepackage{changepage}



\setlength{\extrarowheight}{2pt}
\usepackage{ragged2e}
\newcolumntype{Y}{>{\RaggedRight}X}

\begin{document}
\begin{adjustwidth}{-1cm}{-1cm}
\centering
\begin{tabularx}{1.15\textwidth}{l>{$}c<{$}Ylc} \toprule
& \text{Symbol}
        & \hfil Description                   & Units     & \makecell[c]{Estimated \\ Value}\\
\midrule
Parameters
& \mu_{H-YF}     & Human per capita mortality rate from YF                  & \si{1/days}  & \\
& \mu_H     & Human per capita mortality rate        & \si{1/days}  &  \\
& \mu_{H-AVD}     & Human per capita mortality rate from YEL-AVD      & \si{1/days} &  \\
& \mu_{H-AND}     & Human per capita mortality rate from YEL-AND & \si{1/days} &  \\
& \mu_{M}     & Mosquito per capita mortality rate & \si{1/days} &  \\
& \alpha_{M}     & Mosquito per capita birth rate & \si{1/days} &  \\
& \beta     & Mosquito per capita transmission rate (exposed to infectious) & \si{1/days} &  \\
& r     & Human per capita recovery rate (infectious to recovered) & \si{1/days} &  \\
& b    & Mosquito per capita biting rate on humans & \si{1/days} & \\
& p_H    & Probability that an infective bite generates new infection in humans  & \si{1/days} & \\
& p_M   & Probability that a new infection in the mosquito is generated  & \si{1/days} & \\
& \sigma    & Human per capita recovered to susceptible transition rate & \si{1/days} & \\
& e    & Vaccine efficiency & unitless & \\
& \gamma    & Human per capita rate of vaccination & \si{1/days} & \\
& w    & Human per capita rate of waning immunity & \si{1/days} & \\
\midrule
\makecell[lt]{Initial \\Conditions}
& V(0)  & initial volume of water above the hole    & \si{mL}   & 776.15 \\ \midrule
Variables
& S_H & Number of susceptible humans & number   & $S_H \geq 0 $ \\
& I_H & Number of infected humans & number   & $I_H \geq 0 $ \\
& R_H & Number of recovered humans & number   & $R_H \geq 0 $ \\
& N_H & Number of total human population & number   & $N_H \geq 0 $ \\
& S_M & Number of susceptible mosquitoes & number   & $S_M \geq 0 $ \\
& E_M & Number of exposed mosquitoes & number   & $E_M \geq 0 $ \\
& I_M & Number of infected mosquitoes & number   & $I_M \geq 0 $ \\
& N_M & Number of total mosquito population & number   & $S_M \geq 0 $ \\
\bottomrule
\end{tabularx}
\end{adjustwidth}

\end{document}

在此处输入图片描述

与原始代码相比我所做的更改:

  • adjustwidth从包中使用changepage,以允许表格占据边缘空间。
  • 用于makecell单元格中的换行。
  • 使用灵活宽度的列和tabularx

相关内容