自动调整表格以适应列宽而不改变字体大小

自动调整表格以适应列宽而不改变字体大小

我真的厌倦了搜索。这在 MS-Word 中是一个非常简单的问题,但我无法在 Latex 中运行它。我有一个两列文档。如果表格的宽度足够,则没有问题,但如果表格的宽度小于列宽(无论是一列还是两列),我会使用它,{adjustbox}{width=1\textwidth}但它会改变字体的大小。例如对于以下代码:

\section{RESULTS}\label{sec:res}One hundred patients enrolled in this study including 63 (63\%) men and 37 (37\%) women. Mean age of participants was 60 ± 5 years with minimum age of 44 years old and maximum age of 80 years old. Patients’ demographics are summarized in Table 1.\begin{table}[ht]\centering\caption{Patient Characteristics}\label{table1}\begin{adjustbox}{width=0.5\textwidth}\begin{tabular}{lc}\hlineCharacteristics                  & N = 100  \\\hlineAge (years)                      & 60 ± 5  \\Female                           & 37 (37) \\Diabetes mellitus                & 36 (36) \\Hypertension                     & 50 (50) \\hyperlipidemia                   & 50 (50) \\Smoker                           & 33 (33) \\Left ventricular function        &           \\\hspace{3mm}EF \textgreater= 45\%            & 84 (84) \\\hspace{3mm}30\% \textless EF \textless 45\% & 16 (16) \\\hspace{3mm}EF \textless= 30\%               & 0 (0) \\\hline\end{tabular}\end{adjustbox}\end{table}The minimum and maximum of measured peak SBP before CR, was 90 and 155 mmHg respectively. The mean of peak SBP was 121.95 ± 14.21 mmHg. The minimum and maximum of measured SBP after CR, was 100 mmHg and 150 mmHg respectively with mean of 121.55 ± 11.84 mmHg. Mean of SBP did not significantly change after CR (P = 0.76). The minimum of measured DBP before CR was 60 mmHg and the maximum was 90 mmHg with mean of 78.55 ± 7.18 mmHg. The minimum of measured DBP after CR was 60 mmHg and maximum was 90 mmHg. The mean DBP was 77.35 ± 7.08 mmHg. Mean of DBP was not significantly different before and after CR (P = 0.12) Minimum of PPI before CR was 0.33 and maximum of it was 0.83 with mean of 0.35 ± 0.046. After CR, minimum of PPI was 0.27 and maximum was 0.53 with mean of 0.36 ± 0.048. Mean of PPI was not significantly different before and after CR (P = 0.12).\\

然后我有:

为什么桌子的尺寸不同

我曾经使用过{width=0.5\textwidth},如果我将 0.5 改为 1,表格会变得更大。有人能告诉我如何才能让表格适合列宽吗?

提前感谢您的支持。

答案1

通过使用\adjustbox,您基本上可以保证某种主要字体大小的改变。请改用tabular*环境。

哦,为了获得间距适当的水平线,请加载booktabs包及其宏\toprule\midrule\bottomrule

在此处输入图片描述

\documentclass[twocolumn]{article}
\usepackage{booktabs} % for \toprule, \midrule, and \bottomrule macros
\begin{document}

\section{Results}\label{sec:res}

One hundred patients enrolled in this study including 63 (63\%) men and 37 
(37\%) women. Mean age of participants was $60 \pm 5$ years with minimum 
age of 44 years old and maximum age of 80 years old. Patients' demographics 
are summarized in Table~\ref{table1}.

\begin{table}[ht]
\caption{Patient Characteristics}\label{table1}
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}lr@{}}
\toprule
Characteristics                  & $N = 100$  \\
\midrule
Age (years)                      & $60 \pm 5$  \\
Female                           & 37 (37) \\
Diabetes mellitus                & 36 (36) \\
Hypertension                     & 50 (50) \\
hyperlipidemia                   & 50 (50) \\
Smoker                           & 33 (33) \\
Left ventricular function        &  \\
\hspace{3mm}EF $\ge$ 45\%        & 84 (84) \\
\hspace{3mm}30\% $<$ EF $<$ 45\% & 16 (16) \\
\hspace{3mm}EF $\le$ 30\%        & 0 (0) \\
\bottomrule
\end{tabular*}
\end{table}

The minimum and maximum of measured peak SBP before CR, was 90 and 
155 mmHg respectively. The mean of peak SBP was $121.95 \pm 14.21$ 
mmHg. The minimum and maximum of measured SBP after CR, was 100 mmHg 
and 150 mmHg respectively with mean of $121.55 \pm 11.84$ mmHg. Mean 
of SBP did not significantly change after CR ($P = 0.76$). The 
minimum of measured DBP before CR was 60 mmHg and the maximum was 
90 mmHg with mean of $78.55 \pm 7.18$ mmHg. The minimum of measured DBP 
after CR was 60 mmHg and maximum was 90 mmHg. The mean DBP was $77.35 
\pm 7.08$ mmHg. Mean of DBP was not significantly different before and 
after CR (P = 0.12) Minimum of PPI before CR was 0.33 and maximum of it 
was 0.83 with mean of $0.35 \pm 0.046$. After CR, minimum of PPI was 
0.27 and maximum was 0.53 with mean of $0.36 \pm 0.048$. Mean of PPI 
was not significantly different before and after CR ($P = 0.12$).

\end{document} 

相关内容