You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Quarto中XeLaTeX渲染PDF时数学公式间文本居中问题

解决Quarto公式中“and”文本居中问题

问题出在你使用的aligned环境默认是左对齐模式,要实现文本和公式的居中排版,有两种简单的解决方法:

方法1:改用gather环境

gather环境会自动将每行内容居中,适合不需要对齐特定符号的多行公式场景:

$$
\begin{gather}
TEa =  0.25 \times \sqrt{CVw^2 + CVb^2} \\
\textrm{and} \\
\textrm{allowable imprecision} = 0.5 \times CVw
\end{gather}
$$ {#eq-bottom}

方法2:在aligned中设置全局居中对齐

如果坚持使用aligned,可以通过在每行开头添加&并结合\hfill来实现居中,不过这种方式不如gather简洁:

$$
\begin{aligned}
&TEa =  0.25 \times \sqrt{CVw^2 + CVb^2} \\
&\hfill \textrm{and} \hfill \\
&\textrm{allowable imprecision} = 0.5 \times CVw
\end{aligned}
$$ {#eq-bottom}

另外注意:公式中的普通文本建议用\textrm{}包裹(或者\text{},Quarto默认会加载所需的amsmath包),避免文本变成斜体的变量样式。

内容的提问来源于stack exchange,提问作者Peter

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 04:03:11