有人能帮我把这个表格第一行的文字换行吗?它总是超出页面的行宽,命令\\
不起作用。主要是第一行最后三列。
\begin{table}[H]
\centering
\begin{tabularx}{\linewidth}{X | X | X | X}
\multicolumn{1}{c|}{\textit{\textbf{Photoresist}}} & \multicolumn{1}{c|}{\textit{\textbf{Soft Bake Time at 95 \textdegree C}}} & \multicolumn{1}{c|}{\textit{\textbf{Exposure Energy (mJ/cm\textsuperscript{2})}}} & \multicolumn{1}{c}{\textit{\textbf{Post Exposure Bake Time at 95 \textdegree C}}}\tabularnewline \hline
SU-8 2000.5 & 1760 & 1.5 & 0.4 \\ \hline
SU-8 2002 & 1190 & 3.2 & 0.35 \\
\end{tabularx}
\caption[Parameter properties for PVC and acrylic.]{Parameter properties for PVC and acrylic.}
\label{Parameter properties}
\end{table}
答案1
您可以手动或自动换行。
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{table}[h]
\centering
\caption{Parameter properties for PVC and acrylic.}
\label{Parameter properties}
\begin{tblr}
{
colspec = {*{4}{X[-1,c,m]}},
row{1} = {font=\bfseries\itshape},
hline{1,Z} = {wd=.08em},
hline{2} = {wd=.05em},
}
Photoresist & {Soft Bake\\Time at\\95 \textdegree C} & {Exposure\\Energy\\(mJ/cm\textsuperscript{2})} & {Post Exposure\\Bake Time at\\95 \textdegree C}\\
SU-8 2000.5 & 1760 & 1.5 & 0.4 \\
SU-8 2002 & 1190 & 3.2 & 0.35 \\
\end{tblr}
\end{table}
\begin{table}[h]
\centering
\caption{Parameter properties for PVC and acrylic.}
\label{Parameter properties}
\begin{tblr}
{
colspec = {*{4}{X[-1,c,m]}},
row{1} = {font=\bfseries\itshape},
hline{1,Z} = {wd=.08em},
hline{2} = {wd=.05em},
}
Photoresist & Soft Bake Time at 95 \textdegree C & Exposure Energy (mJ/cm\textsuperscript{2}) & Post Exposure Bake Time at 95 \textdegree C\\
SU-8 2000.5 & 1760 & 1.5 & 0.4 \\
SU-8 2002 & 1190 & 3.2 & 0.35 \\
\end{tblr}
\end{table}
\end{document}
答案2
@Clara 答案(+1):引入的一个小变化是使用包siunitx
:
\usepackage{tabularray}
\UseTblrLibrary{siunitx} % <---
\sisetup{per-mode=symbol} % <---
\begin{document}
\begin{table}[ht]
\caption{Parameter properties for PVC and acrylic.}
\label{Parameter properties}
\begin{tblr}{colspec = {l X[c] % <---
*{2}{X[c, si={table-format=1.2}]}},% <---
row{1} = {guard, font=\bfseries\itshape, m}, % <---
hline{1,Z} = 1pt, hline{2}=solid,
}
Photoresist & {Soft Bake\\ Time at\\ \qty{95}{\celsius}}
& Exposure Energy \normalfont(\unit{\milli\joule\per\square\cm})
& Post Exposure Bake Time at \qty{95}{\celsius} \\
SU-8 2000.5 & 1760 & 1.5 & 0.4 \\
SU-8 2002 & 1190 & 3.2 & 0.35 \\
\end{tblr}
\end{table}
\end{document}
答案3
\documentclass{article}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}
\centering
\begin{tabularx}{\linewidth}{X | X | X | X}
\multicolumn{1}{Y|}{\textit{\textbf{Photoresist}}} & \multicolumn{1}{Y|}{\textit{\textbf{Soft Bake Time at 95 \textdegree C}}} & \multicolumn{1}{Y|}{\textit{\textbf{Exposure Energy (mJ/cm\textsuperscript{2})}}} & \multicolumn{1}{Y}{\textit{\textbf{Post Exposure Bake Time at 95 \textdegree C}}}\tabularnewline \hline
SU-8 2000.5 & 1760 & 1.5 & 0.4 \\ \hline
SU-8 2002 & 1190 & 3.2 & 0.35 \\
\end{tabularx}
\caption[Parameter properties for PVC and acrylic.]{Parameter properties for PVC and acrylic.}
\label{Parameter properties}
\end{table}
\end{document}
答案4
诊断:不必要且有害地使用多列,其c
样式会阻止文本换行。
另一方面,由于标题和内容不等,使用不等列会更好看tabulary
,而且设置居中列也更容易。顺便说一句,使用也会更好看booktabs
(即使没有粗体字体,恕我直言,使用粗体标题也会改变 MWE 的限制):
\documentclass{article}
\usepackage{tabulary, booktabs}
\begin{document}
\begin{tabulary}{\linewidth}{cCCC}\toprule
\bfseries\em Photoresist &
\bfseries\em Soft Bake Time at 95\,°C &
\bfseries\em Exposure Energy (mJ/cm²) &
\bfseries\em Post Exposure Bake Time at 95\,°C \\\midrule
SU-8 2000.5 & 1760 & 1.5 & 0.4 \\
SU-8 2002 & 1190 & 3.2 & 0.35 \\\bottomrule
\end{tabulary}
\end{document}