两列文档,表格侵入第二列

两列文档,表格侵入第二列

我目前遇到这个问题,表格侵入了第二列,我不知道我做错了什么......

表格侵占第二列

\documentclass[twoside,twocolumn]{article}
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} 
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} 
\usepackage[utf8]{inputenc}
\setlength{\arrayrulewidth}{0.25mm}
\setlength{\tabcolsep}{9pt}
\renewcommand{\arraystretch}{1.5}
\begin{document}
\begin{table}[ht]
\begin{tabular}{ p{5cm} p{5.3cm} } 
\hline 
Parameter & Condition \\
\hline
Flow Rate & $4.5 \frac{\text{mL}}{\text{min}}$ \\
Carrier gas & Nitrogen \\
Column type & HP-$5$  \\
Column dimensions & \SI{10}{m} long $\times$ \SI{0.53}{mm} ID  \\
Injection port temperature & \SI{140}{\celsius}  \\
Oven temperature & \SI{40}{\celsius} \\
Attenuation & Automatically done by computer \\
Sample size & $\num{3.00000e-1}\frac{\text{ng}}{\text{ul}}$ \\
Number of products & $2$  \\ 
Types of products & Butenes \\  [1ex] % [1ex] adds vertical space[1ex]
\hline %inserts single line
\end{tabular}
\caption{GC parameters on}
\label{table:nonlin} % is used to refer this table in the text
\end{table}
\end{document}

答案1

姆韦

\documentclass[twoside,twocolumn]{article}
\usepackage{amsmath,siunitx,booktabs,lipsum}
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} 
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} 
\usepackage[utf8]{inputenc}
\setlength{\arrayrulewidth}{0.25mm}
\setlength{\tabcolsep}{9pt}
\renewcommand{\arraystretch}{1.5}

\begin{document}

\begin{table}[ht]
\setlength{\tabcolsep}{9pt}
\begin{tabular*}{\linewidth}{@{}p{\dimexpr.5\linewidth-\tabcolsep}p{\dimexpr.5\linewidth-\tabcolsep}@{}} 
\toprule 
Parameter & Condition \\
\midrule
Flow Rate & $4.5 \frac{\text{mL}}{\text{min}}$ \\
Carrier gas & Nitrogen \\
Column type & HP-$5$  \\
Column dimensions & \SI{10}{m} long $\times$ \SI{0.53}{mm} ID  \\
Injection port temperature & \SI{140}{\celsius}  \\
Oven temperature & \SI{40}{\celsius} \\
Attenuation & Automatically done by computer \\
Sample size & $\num{3.00000e-1}\frac{\text{ng}}{\text{ul}}$ \\
Number of products & $2$  \\ 
Types of products & Butenes \\  [1ex] % [1ex] adds vertical space[1ex]
\bottomrule %inserts single line
\end{tabular*}
\caption{GC parameters on}
\label{table:nonlin} % is used to refer this table in the text
\end{table}

\lipsum[1-10]
\end{document}

编辑:要让表格包含两列但不使用table*环境以避免跳转到下一页,您可以使用cutedcapt-of包:

在此处输入图片描述

\documentclass[twoside,twocolumn]{article}
\usepackage{amsmath,siunitx,booktabs,lipsum,cuted,capt-of}
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} 
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} 
\usepackage[utf8]{inputenc}
\setlength{\arrayrulewidth}{0.25mm}
\setlength{\tabcolsep}{9pt}
\renewcommand{\arraystretch}{1.5}

\begin{document}
\section{Nulla malesuada} 
\lipsum[3]
\begin{strip}
\begin{tabular*}{\linewidth}{@{}p{\dimexpr.5\linewidth-\tabcolsep}p{\dimexpr.5\linewidth-\tabcolsep}@{}} 
\toprule 
Parameter & Condition \\
\midrule
Flow Rate & $4.5 \frac{\text{mL}}{\text{min}}$ \\
Carrier gas & Nitrogen \\
Column type & HP-$5$  \\
Column dimensions & \SI{10}{m} long $\times$ \SI{0.53}{mm} ID  \\
Injection port temperature & \SI{140}{\celsius}  \\
Oven temperature & \SI{40}{\celsius} \\
Attenuation & Automatically done by computer \\
Sample size & $\num{3.00000e-1}\frac{\text{ng}}{\text{ul}}$ \\
Number of products & $2$  \\ 
Types of products & Butenes \\  
\bottomrule 
\end{tabular*}
\captionof{table}{GC parameters on}
\end{strip}
\lipsum[1]
\section{Nam dui ligula}
\lipsum[2]
\end{document}

答案2

您可以使用环境table*来获得一个覆盖两列的表格......

以下 MWE(重要代码更改以 标记<======

\documentclass[twoside,twocolumn]{article}

\usepackage[utf8]{inputenc}

\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} 
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} 

\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{blindtext} % <======= dummy text ===========================

\setlength{\arrayrulewidth}{0.25mm}
\setlength{\tabcolsep}{9pt}
\renewcommand{\arraystretch}{1.5}


\begin{document}
\Blindtext Code for the table
\begin{table*}[ht] % <==================================================
\centering
\begin{tabular}{ p{5cm} p{5.3cm} } 
\hline 
Parameter & Condition \\
\hline
Flow Rate & $4.5 \frac{\text{mL}}{\text{min}}$ \\
Carrier gas & Nitrogen \\
Column type & HP-$5$  \\
Column dimensions & \SI{10}{m} long $\times$ \SI{0.53}{mm} ID  \\
Injection port temperature & \SI{140}{\celsius}  \\
Oven temperature & \SI{40}{\celsius} \\
Attenuation & Automatically done by computer \\
Sample size & $\num{3.00000e-1}\frac{\text{ng}}{\text{ul}}$ \\
Number of products & $2$  \\ 
Types of products & Butenes \\  [1ex] % [1ex] adds vertical space[1ex]
\hline %inserts single line
\end{tabular}
\caption{GC parameters on}
\label{table:nonlin} % is used to refer this table in the text
\end{table*} % <========================================================
\Blindtext
\end{document}

得到的第二页:

第二页

答案3

替代:

\documentclass[twoside,twocolumn]{article}
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry}
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption}
\usepackage[utf8]{inputenc}

\usepackage{amsmath}
\usepackage{siunitx}
\setlength{\arrayrulewidth}{0.25mm}
\renewcommand{\arraystretch}{1.5}

\usepackage{lipsum}

\begin{document}
\lipsum[1]
\begin{table}[ht]
    \setlength{\tabcolsep}{3pt}
    \small
\begin{tabular}{@{}l >{\raggedright\arraybackslash}p{3.5cm}@{}}
\hline
Parameter & Condition \\
\hline
Flow Rate & $4.5 \frac{\text{mL}}{\text{min}}$ \\
Carrier gas & Nitrogen \\
Column type & HP-$5$  \\
Column dimensions & \SI{10}{m} long $\times$ \SI{0.53}{mm} ID  \\
Injection port temperature & \SI{140}{\celsius}  \\
Oven temperature & \SI{40}{\celsius} \\
Attenuation & Automatically done by computer \\
Sample size & $\num{3.00000e-1}\frac{\text{ng}}{\text{ul}}$ \\
Number of products & $2$  \\
Types of products & Butenes \\  [1ex] % [1ex] adds vertical space[1ex]
\hline %inserts single line
\end{tabular}
\caption{GC parameters on}
\label{table:nonlin} % is used to refer this table in the text
\end{table}
\lipsum
\end{document}

在此处输入图片描述

答案4

我会将tabularx\small字体大小和 的较小值结合起来\tabcolsep。此外,我还会使用 中的规则booktabs,其中包含一些垂直填充,并借助 简化了代码siunitx

\documentclass[twoside,twocolumn]{article}
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry}
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption}
\usepackage[utf8]{inputenc}
\setlength{\arrayrulewidth}{0.25mm}
\setlength{\tabcolsep}{9pt}
\renewcommand{\arraystretch}{1.5}
\usepackage{amsmath, lipsum, siunitx, tabularx, booktabs}
\DeclareSIUnit\min{min}
\DeclareSIUnit\ng{ng}
\DeclareSIUnit\Ul{ul}

\begin{document}

\begin{table}[ht]
\small\setlength{\tabcolsep}{4pt}
\sisetup{per-mode = fraction}
\begin{tabularx}{\linewidth}{*{2}{>{\raggedright\arraybackslash}X}}%}
\toprule
Parameter & Condition \\
\midrule
Flow Rate & \SI{4.5}{\mL\per\min} \\
Carrier gas & Nitrogen \\
Column type & HP-$5$ \\
Column dimensions & \SI{10}{m} long $\times$ \SI{0.53}{mm} ID \\
Injection port temperature & \SI{140}{\celsius} \\
Oven temperature & \SI{40}{\celsius} \\
Attenuation & Automatically done by computer \\
Sample size & \SI{3.00000e-1}{\ng\per\Ul} \\
Number of products & $2$ \\
Types of products & Butenes \\
\bottomrule %inserts single line
\end{tabularx}
\caption{GC parameters on}
\label{table:nonlin} % is used to refer this table in the text
\end{table}
\lipsum

\end{document} 

在此处输入图片描述

相关内容