表格超出右边距,如何自动调整表格以适应文本宽度?

表格超出右边距,如何自动调整表格以适应文本宽度?
\begin{table}[H]
\caption{Optimised combinations of hydrophobic-SiO\textsubscript{2} (H-SiO\textsubscript{2}) particles, fatty acid and solvent loadings for water repellent coating slurries. SiO\textsubscript{2} nanoparticles (10.00 wt\%) were functionalised with their respective fatty acid (2.00 wt\%)/ethanol (88.00 wt\%) mixture.}
\label{Paper_table}
\begin{center}


\begin{tabular}{|l|l|l|l|l|}
\hline 
\textbf{Fatty acid}  & \textbf{Carbon chain length} & \textbf{H-SiO\textsubscript{2} particle loading/wt\%} & \textbf{Fatty acid loading/wt\%} & \textbf{Ethanol loading/\%} \\ 
\hline 
Octanoic & 2 & 3 & 3 & 0.18 \\ 
\hline 
Decanoic & 2 & 3 & 3 & 0.18 \\ 
\hline 
Dodecanoic & 2 & 3 & 3 & 0.18 \\ 
\hline
Hexadecanoic & 2 & 3 & 3 & 0.18 \\ 
\hline
Octadecanoic & 2 & 3 & 3 & 0.18 \\ 
\hline

\end{tabular}
\end{center}

\end{table}

答案1

您可以使用列类型用于指定列的宽度。我建议使用 booktabs 包以获得更美观的外观并删除垂直线吗?如果您不想让文本居中,请>{\centering}从下面的代码中删除。

\documentclass{article}

\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}
\begin{table}[h] 
\caption{Optimised combinations of hydrophobic-SiO\textsubscript{2} (H-SiO\textsubscript{2}) particles, fatty acid and solvent loadings for water repellent coating slurries. SiO\textsubscript{2} nanoparticles (10.00 wt\%) were functionalised with their respective fatty acid (2.00 wt\%)/ethanol (88.00 wt\%) mixture.} 
\label{Paper_table} 
\begin{center}
\begin{tabular}{>{\centering}p{0.18\textwidth}>{\centering}p{0.12\textwidth}>{\centering}p{0.18\textwidth}>{\centering}p{0.18\textwidth}>{\centering\arraybackslash}p{0.15\textwidth}}
\toprule \textbf{Fatty acid} & \textbf{Carbon chain length} & \textbf{H-SiO\textsubscript{2} particle loading /wt\%} & \textbf{Fatty acid loading /wt\%} & \textbf{Ethanol loading /\%} \\
\midrule Octanoic & 2 & 3 & 3 & 0.18 \\
\midrule Decanoic & 2 & 3 & 3 & 0.18 \\
\midrule Dodecanoic & 2 & 3 & 3 & 0.18 \\
\midrule Hexadecanoic & 2 & 3 & 3 & 0.18 \\
\midrule Octadecanoic & 2 & 3 & 3 & 0.18 \\
\bottomrule
\end{tabular} 
\end{center}
\end{table}
\end{document}

下列的这个问题,其他可能性包括旋转桌子。

答案2

我建议您使用tabularx允许自动换行的环境X。我还建议您通过删除所有垂直规则并使用较少但间距适当的水平规则,使表格看起来更“开放”。而且,如果您加载包mhchem,您可以使用包的宏来排版化合物的名称\ce

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx,ragged2e,booktabs,caption}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\usepackage[version=4]{mhchem} % to typeset chemical compound names
\begin{document}

\begin{table}
\caption{Optimised combinations of hydrophobic-\ce{SiO2} (H-\ce{SiO2}) 
particles, fatty acid and solvent loadings for water repellent 
coating slurries.} 
\label{Paper_table}

\ce{SiO2} nanoparticles (10.00 wt\%) were functionalised with their 
respective fatty acid (2.00 wt\%)\slash ethanol (88.00 wt\%) mixture.

\smallskip
\begin{tabularx}{\textwidth}{@{} l *{4}{L} @{}}
\toprule 
\textbf{Fatty acid}  & 
\textbf{Carbon chain length} & 
\textbf{H-\ce{SiO2} particle loading\slash wt\%} & 
\textbf{Fatty acid loading\slash wt\%} & 
\textbf{Ethanol loading\slash\%} \\ 
\midrule 
Octanoic     & 2 & 3 & 3 & 0.18 \\  
Decanoic     & 2 & 3 & 3 & 0.18 \\ 
Dodecanoic   & 2 & 3 & 3 & 0.18 \\ 
Hexadecanoic & 2 & 3 & 3 & 0.18 \\ 
Octadecanoic & 2 & 3 & 3 & 0.18 \\ 
\bottomrule
\end{tabularx}
\end{table}
\end{document}

相关内容