LaTeX 表中的长文本字符串换行

LaTeX 表中的长文本字符串换行

我目前正在尝试创建一个简单的 4 列表格,并且一直在尝试解决换行问题。

\begin{table}[ht]
    \centering
    \caption{- Main silicate HFSE-hosting minerals from major ore deposits}
    \begin{tabular}[t]{p{0.1\textwidth}m{0.4\textwidth}m{0.3\textwidth}m{0.2\textwidth}}
        \toprule
        Mineral&Formula&HFSE-hosting sites&Ref.\\
        \midrule
        allanite (epidote) & $A_{2}M_{3}Si_{3}O_{12}[OH]$ & A = REE$^{3+}$; B = U$^{4+}$, Th$^{4+}$, Zr$^{4+}$ & citation\\
        chevkinite & $A_{4}BC_{2}D_{2}(Si_{2}O_{7})_{2}O_{8}$ & A = REE$^{3+}$; B = Zr$^{4+}$, Ti$^{4+}$; C = Ti$^{4+}$, Nb$^{5+}$ & citation\\
        eudialyte & $N_{15-16}[M1]_{6}[M2]_{3}[M3][M4]Z_{3}Si_{24}O_{66-73}(W)_{0-9}(X)_{2}$ & N \& M1 = REE$^{3+}$; M2 = Zr$^{4}$, Ta$^{5+}$, Ti$^{4+}$; M3/4 = Nb$^{5+}$, Ti$^{4+}$; Z = Zr$^{4+}$, Ti$^{4+}$, Nb$^{5+}$ & citation\\
                
        \bottomrule
    \end{tabular}
\end{table}

制作这个

在此处输入图片描述

2 个问题(抱歉,我意识到它应该一次处理 1 个问题):a)如何让第二列中的长字符串根据列宽换行?b)需要在标题设置中进行哪些更改才能将数字与标题文本分开?目前,我已输入连字符试图绕过它,但显然 LaTeX 会忽略空格

答案1

关于第一个问题,我建议您谨慎选择\newline指令。关于第二个问题,我建议您加载caption包并为选项使用合适的值labelsep

不过,无论您做什么,我强烈建议您加载几个可能的化学式包之一,并使用它们的宏来排版化学化合物。当然,我希望您会同意 的输出\ce{A2M3Si3O12[OH]}比 的输出好看得多$A_{2}M_{3}Si_{3}O_{12}[OH]$

在此处输入图片描述

\documentclass[a4paper]{report} % I don't have access to your custom LaTeX class
\usepackage{geometry}
\geometry{lmargin=30mm, rmargin=20mm, vmargin=25mm, foot=10mm, head=10mm}
\usepackage{newtxtext,newtxmath} % Times Roman clone
\usepackage{array,booktabs,ragged2e}
\newcolumntype{P}[1]{>{\RaggedRight\hangafter=1\hangindent=1em}p{#1}} % automatic hanging indentations
\usepackage{mhchem} % provides \ce macro to typeset chemical formulas
\usepackage[skip=0.333\baselineskip,labelfont=sc,labelsep=endash]{caption}
\begin{document}

\begin{table}[ht]
\centering
\caption{Main silicate HFSE-hosting minerals from major ore deposits}
\begin{tabular}{ @{} 
   >{\RaggedRight}p{\dimexpr0.12\textwidth-1\tabcolsep\relax}
   P{\dimexpr0.40\textwidth-2\tabcolsep\relax}
   P{\dimexpr0.35\textwidth-2\tabcolsep\relax}
   P{\dimexpr0.13\textwidth-1\tabcolsep\relax} 
     @{} }
\toprule
Mineral & Formula & HFSE-hosting sites & Ref.\\
\midrule
allanite (epidote) 
  & \ce{A2M3Si3O12[OH]} 
  & A = \ce{REE^3+}; B = \ce{U^4+}, \ce{Th^4+}, \ce{Zr^4+} 
  & citation\\
chevkinite 
  & \ce{A4BC2D2(Si2O7)2O8}  
  & A = \ce{REE^3+}; B = \ce{Zr^4+}, \ce{Ti^4+}; C = \ce{Ti^4+}, \ce{Nb^5+} 
  & citation\\
eudialyte 
  & \ce{N_{15-16}[M{1}]6[M{2}]3[M{3}][M{4}]Z3Si24\newline O_{66-73}(W)_{0-9}(X)2}
  & N \& M1 = \ce{REE^3+}; M2 = \ce{Zr^4+}, \ce{Ta^5+}, \ce{Ti^4+}; 
    M3/4 = \ce{Nb^5+}, \ce{Ti^4+}; Z = \ce{Zr^4+}, \ce{Ti^4+}, \ce{Nb^5+}
  & citation\\
\bottomrule
\end{tabular}
\end{table}
\end{document} 

相关内容