
我非常接近正確對齊,但最右邊的單元格與頂部規則齊平,而最左邊和中心的單元格有少量的垂直空間。我試圖使對齊方式統一(要么刪除垂直空間,要么使其在行中保持一致)。
我曾經\parbox{}
允許多行表達式包含在表中並在表中水平對齊。
\begin{table}[h]
\caption{Title of Table.}
\begin{tabularx}{\linewidth}{p{1.4cm} p{6.9cm} p{6.8cm}}
\toprule
Head1 & Head2 & Head3 \\
\midrule
text & text text text text & \parbox{6.8cm}{$BZ, CY, CX, BZ, BX, AY, AZ, \\ CY, CZ, \ldots$ } \\
\bottomrule
\end{tabularx}
\end{table}
另外,如果這很重要,我在 APA 格式表的序言中包含以下內容。
\DeclareCaptionLabelSeparator*{spaced}{\\[2ex]}
\captionsetup[table]{textfont=it,format=plain,justification=justified,
singlelinecheck=false,labelsep=spaced,skip=0pt}
\captionsetup[figure]{labelsep=period,labelfont=it,justification=justified,
singlelinecheck=false,font=doublespacing}
答案1
目前還不清楚你想要實現什麼,你應該提供一個完整的最小範例。
無論如何,與tabularray
:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\usepackage{caption}
\DeclareCaptionLabelSeparator*{spaced}{\\[2ex]}
\captionsetup[table]{textfont=it,format=plain,justification=justified,
singlelinecheck=false,labelsep=spaced,skip=0pt}
\captionsetup[figure]{labelsep=period,labelfont=it,justification=justified,
singlelinecheck=false,font=doublespacing}
\begin{document}
\begin{table}[h]
\caption{Title of Table.}
\begin{tblr}{colspec={Q[1.4cm]Q[6.9cm]X[mode=math]}}
\toprule
Head1 & Head2 & Head3 \\
\midrule
text & text text text text & {BZ, CY, CX, \\ BZ, BX, AY,\\ AZ, CY, CZ, \ldots} \\
\bottomrule
\end{tblr}
\end{table}
\end{document}
答案2
請注意,tabularx
環境需要使用 -columnX
才能正常運作。如果沒有,您不如使用常規的tabular
.其次,您想要改變的是,內聯數學元素的清單是不可破壞的,
。您必須使用(例如)的內容來變更管理方式「在內聯數學模式下允許在『,』處換行」會破壞引用:
\documentclass{article}
\usepackage{tabularx,booktabs}
% https://tex.stackexchange.com/a/19100/5764
\mathchardef\breakingcomma\mathcode`\,
{\catcode`,=\active
\gdef,{\breakingcomma\discretionary{}{}{}}
}
\newcommand{\mathlist}[1]{\mathcode`\,=\string"8000 #1}
\begin{document}
\begin{table}
\caption{Table caption}
\begin{tabularx}{\linewidth}{ p{14mm} p{69mm} X }
\toprule
Head1 & Head2 & Head3 \\
\midrule
text & text text text text & $\mathlist{BZ, CY, CX, BZ, BX, AY, AZ, CY, CZ, \ldots}$ \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案3
https://tex.stackexchange.com/a/467445/197451
\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{multirow}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{document}
\begin{table}[h]
\caption{Title of Table.}
\setlength{\extrarowheight}{2pt}
\begin{tabularx}{\linewidth}{ccC}
\toprule
Head1 & Head2 & Head3 \\
\midrule
text & text text text text &{{\parbox{3cm}{$BZ, CY, CX, BZ, BX,\\ AY,
AZ, CY, CZ, \ldots$ }}} \\
\bottomrule
\end{tabularx}
\end{table}
\begin{table}[h]
\caption{Title of Table.}
\begin{tabularx}{\textwidth}{ccC}
\toprule
Head1 & Head2 & Head3 \\
\midrule
text & text text text text & {{$BZ, CY, CX, BZ, BX, AY, AZ, CY, CZ,
\ldots$ }} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
答案4
\parbox
包含多行文字的 a 的基線是其最底行的基線,使整個框在基線之上高度過高。這樣的框不是在基線處對齊,而是在頂部對齊,使其看起來與上述規則齊平。
解決方案是在其第一行文字中包含一個“支柱”,以便其最上面行的(假想)基線與其他列中的基線對齊。 Plain TeX為此提供了巨集\strut
和。\mathstrut
text & \strut text text text text &
$\mathlist{\mathstrut BZ, CY, CX, BZ, BX, AY, AZ, CY, CZ, \ldots}$ \\
也可以看看與 Bussproofs 的推理線間距相同。