创建一个适合两列样式页面的一列的表格(同样的问题)

创建一个适合两列样式页面的一列的表格(同样的问题)

我遇到了完全相同的问题:创建适合双列样式页面的一列的表格。但是,那里提供的解决方案对我不起作用。表格甚至没有出现。因此,我想在其中一列中放置一个表格,就在文本后面。我有以下代码:

\documentclass[twoside]{article}
\usepackage[hmarginratio=1:1,top=32mm,columnsep=25pt]{geometry}
\usepackage{multicol}
\begin{document}
\begin{multicols}{2}

 Among the risk factors (...). Table \ref{T1} lists some of them.

\begin{table}[b]
\centering
\caption{My caption}
\label{T1}
\resizebox{\columnwidth}{!}{%
\begin{tabular}[b]{l}
\hline
 High LDL cholesterol \\
 Cigarette smoking\\
 Hypertension (BP$\geq 140/90 mmH$g or on  antihypertensive medication)\\
 Low HDL cholesterol ($<1.0 mmol/L$) \\
 Diabetes mellitus \\
 Family history of premature CHD \\
 Age (men$\geq 45$ years; women$\geq 55$ years)\\
 Lifestyle risk factors\\
 Obesity (BMI$\geq 30Kg/m^{2}$)\\
 Physical inactivity \\
 Atherogenic diet\\
 Emerging risk factors \\
 Lipoprotein (a)  \\
 Prothrombotic factors \\
 Proinflammatory factors \\
 Impaired fasting glucose \\
 Subclinical atherosclerosis \\
 \hline
 \end{tabular}
 }
 \end{table}

 \end{multicols}
 \end{document}

我也尝试过这个:

\begin{table}[b]
\centering
\caption{My caption}
\label{T1}
\begin{tabular}[b]{l}
\hline
 High LDL cholesterol \\
 Cigarette smoking\\
 Hypertension (BP$\geq 140/90 mmH$g or on  antihypertensive medication)\\
 Low HDL cholesterol ($<1.0 mmol/L$) \\
 Diabetes mellitus \\
 Family history of premature CHD \\
 Age (men$\geq 45$ years; women$\geq 55$ years)\\
 Lifestyle risk factors\\
 Obesity (BMI$\geq 30Kg/m^{2}$)\\
 Physical inactivity \\
 Atherogenic diet\\
 Emerging risk factors \\
 Lipoprotein (a)  \\
 Prothrombotic factors \\
 Proinflammatory factors \\
 Impaired fasting glucose \\
 Subclinical atherosclerosis \\
 \hline
 \end{tabular}
 \end{table}

我究竟做错了什么?

答案1

正如评论中所述,您不能在 -environment 中使用普通浮点数multicols。您必须使用带星号的版本table*。当然,您可以将table-environment 放在 -environment 之外multicols。请检查多色手册

在任何一种情况下,表格都不会被放在其中一列中,因此使用 -command\resizebox将其缩放到宽度是没有意义的。我在我的解决方案中删除了它。如果你坚持这样做,你也必须加载graphics- 或graphicx-package。

这将从内部起作用multicols

\documentclass[twoside]{article}
\usepackage[hmarginratio=1:1,top=32mm,columnsep=25pt]{geometry}
\usepackage{lipsum} %% in order to produce some more blindtext.
\usepackage{multicol} %% To use two columns equally filled

\begin{document}
\begin{multicols}{2}

  \lipsum[1-2]
  Among the risk factors (...). Table \ref{T1} lists some of them.

  \begin{table*}[b]
    \centering
    \caption{My caption}
    \label{T1}
      \begin{tabular}{l}
        \hline
        High LDL cholesterol \\
        Cigarette smoking\\
        Hypertension (BP$\geq 140/90 mmH$g or on  antihypertensive medication)\\
        Low HDL cholesterol ($<1.0 mmol/L$) \\
        Diabetes mellitus \\
        Family history of premature CHD \\
        Age (men$\geq 45$ years; women$\geq 55$ years)\\
        Lifestyle risk factors\\
        Obesity (BMI$\geq 30Kg/m^{2}$)\\
        Physical inactivity \\
        Atherogenic diet\\
        Emerging risk factors \\
        Lipoprotein (a)  \\
        Prothrombotic factors \\
        Proinflammatory factors \\
        Impaired fasting glucose \\
        Subclinical atherosclerosis \\
        \hline
      \end{tabular}
  \end{table*}

\end{multicols}
\end{document}

我个人更喜欢这种方法:

\documentclass[twoside]{article}
\usepackage[hmarginratio=1:1,top=32mm,columnsep=25pt]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{multicol} %% To use two columns equally filled
\usepackage{booktabs} %% for better lines in tables.


\begin{document}
\section{First Section}
\begin{multicols}{2}
  \lipsum[1-2]
  Among the risk factors (...). Table \ref{T1} lists some of them.
\end{multicols}

\begin{table}[b]
  \centering
  \caption{My caption}
  \label{T1}
  \begin{tabular}{l}
    \toprule
    High LDL cholesterol \\
    Cigarette smoking\\
    Hypertension (BP$\geq 140/90 mmH$g or on  antihypertensive medication)\\
    Low HDL cholesterol ($<1.0 mmol/L$) \\
    Diabetes mellitus \\
    Family history of premature CHD \\
    Age (men$\geq 45$ years; women$\geq 55$ years)\\
    Lifestyle risk factors\\
    Obesity (BMI$\geq 30Kg/m^{2}$)\\
    Physical inactivity \\
    Atherogenic diet\\
    Emerging risk factors \\
    Lipoprotein (a)  \\
    Prothrombotic factors \\
    Proinflammatory factors \\
    Impaired fasting glucose \\
    Subclinical atherosclerosis \\
    \bottomrule
  \end{tabular}
\end{table}

\section{Second Section}
\begin{multicols}{2}  
  \lipsum[3-4]
\end{multicols}
\end{document}

相关内容