![将方程式置于表格的中心!](https://linux22.com/image/407900/%E5%B0%86%E6%96%B9%E7%A8%8B%E5%BC%8F%E7%BD%AE%E4%BA%8E%E8%A1%A8%E6%A0%BC%E7%9A%84%E4%B8%AD%E5%BF%83%EF%BC%81.png)
我似乎无法弄清楚如何将方程式置于列的中心以使其看起来很整洁!!!(请参阅下面的乳胶代码)。
%3 LAWS OF THERMO SECTION ----- SECTION 5
\section*{Laws of Thermodynamics}
\tcbset{enhanced, fonttitle=\bfseries\large,fontupper=\normalsize\sffamily,
colback=red!5!white,colframe=red!50!black,colbacktitle=red!75!black, coltitle= white,center title}
\begin{tcolorbox}[tabularx*={\arrayrulewidth0.5mm}{X|X|X},title=My table]
First
&\begin{tabular}[c]{@{}l@{}} Energy can never be destroyed or \\ created.\end{tabular}
& \begin{tabular}[c]{@{}c@{}}$dU = \delta Q - \delta U $ \end{tabular}
\\\hline
Second
&\begin{tabular}[c]{@{}l@{}}Entropy of an isolated system \\ can never decrease.\end{tabular}
&\begin{tabular}{c}$dS \geq 0$ for an isolated system\\ $\delta Q = T dS $\end{tabular}
\\\hline
Third
&\begin{tabular}[c]{@{}l@{}} The entropy of a system approaches \\ a constant value as the temperature \\ approaches absolute zero. \\ \emph{(Entropy is zero at absolute zero)}
\end{tabular}
&\begin{tabular}{c}$S = k_B \ln \Omega$ \end{tabular}
\\\hline
Zeroth
&\begin{tabular}[c]{@{}l@{}}Bodies in thermal equilibrium are \\ at the same temperature
\end{tabular}
\end{tcolorbox}
答案1
我将假设您的文档采用了标准LaTeX文档类之一(比如说),并且article
它至少加载了geometry
、、、和包(后者带有选项)。tabularx
ragged2e
xcolor
tcolorbox
most
如果这些假设基本正确,那么下面代码中显示的解决方案和相关屏幕截图可能会让您感兴趣。它对l
第一列使用基本列类型,X
对第 2 列和第 3 列使用修改后的列类型——分别左对齐和居中。鉴于X
列类型允许自动换行,您可以省去tabular
代码在几乎所有单元格中产生的开销。
建议:由于您在表格中使用了无衬线文本字体,因此您可能也想使用无衬线数学字体。
\documentclass{article}
\usepackage{geometry,tabularx,ragged2e}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
\renewcommand{\tabularxcolumn}[1]{m{#1}} % vertical centering
\usepackage[table]{xcolor}
\usepackage[most]{tcolorbox}
\setlength\extrarowheight{2pt} % optional
\usepackage{helvet} % optional
\begin{document}
\section*{Laws of Thermodynamics}
\tcbset{enhanced,
fonttitle=\bfseries\large\sffamily,
fontupper=\normalsize\sffamily,
colback=red!5!white,
colframe=red!50!black,
colbacktitle=red!75!black,
coltitle= white,
center title}
\begin{tcolorbox}[tabularx*={\arrayrulewidth0.5mm}{l|L|C},title=My table]
First
& Energy can never be destroyed or created.
& $dU = \delta Q - \delta U $
\\\hline
Second
&Entropy of an isolated system can never decrease.
&$dS \geq 0$ for an isolated system\newline $\delta Q = T dS $
\\\hline
Third
&The entropy of a system approaches a constant value as the temperature approaches absolute zero. \newline \emph{(Entropy is zero at absolute zero)}
&$S = k_B \ln \Omega$
\\\hline
Zeroth
&Bodies in thermal equilibrium are at the same temperature. &
\end{tcolorbox}
\end{document}