我正在使用 fira-math 和 TeX Gyre DejaVu Math 来排版使用 Lualatex 的文档。我使用 TeX Gyre DejaVu Math,因为 fira-math 中的箭头似乎太小了。我使用 Arial 来表示文本。从以下 mwe 的输出可以看出,我使用\left(
、\right)
组合得到的括号太大了。我尝试了\biggl(
和\biggr)
。它们只稍微好一点。如何纠正这个问题?我还添加了一个屏幕截图。
\documentclass{article}
\usepackage{unicode-math}
\usepackage{firamath-otf}
%the arrow from fira-math is too small.
\setmathfont{TeX Gyre DejaVu Math}[Scale=1.8,range={\overrightarrow}]
\setmainfont{Arial}[Scale=1.1]
\setsansfont{Arial}[Scale=MatchLowercase]
\setmathfont{Arial}[Scale=1.1,range=up/{num,Latin,latin}]
\setmathfont{Arial}[Scale=1.1,range=it/{num,Latin,latin}]
\setmathfont{Arial}[Scale=1.1,range=bfup/{num,Latin,latin}]
\begin{document}
The coordinates of A are $\left( a_1,a_2\right)$ and of B are $\left(b_1,b_2\right),$ then $\left|\overrightarrow{AB}\right|=\left|\overrightarrow{BA}\right|=\sqrt{{{\left(a_1-\ b_1\right)}^2+\left(a_2-b_2\right)}^2}$.
%biggl biggr version
\vskip 1cm
The coordinates of A are $\biggl( a_1,a_2\biggr)$ and of B are $\biggl(b_1,b_2\biggr)$, then $\left|\overrightarrow{AB}\right|=\left|\overrightarrow{BA}\right|=\sqrt{{{\biggl(a_1-\ b_1\biggr)}^2+\biggl(a_2-b_2\biggr)}^2}$.
\end{document}
这是来自传统 pdflatex 的输出,以供比较。
答案1
(a) 大量不必要的指令和 (b) 一个或多个 opentype 数学字体中 (可能的) 错误的组合\left
似乎\right
是导致该问题的直接原因。
在下面给出的解决方案中,我建议进行四项 [4] 改进。它们包括删除所有\left
和\right
指令、删除所有不必要的{
和实例,以及在加载“特殊”形式的时}
使用更合理的选项值。虽然步骤 1 和 2 是最重要的,但步骤 3 和 4 也有助于改进。Scale
\overrightarrow
% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{xcolor}
\usepackage{unicode-math}
\usepackage{firamath-otf}
\setmainfont{Arial}[Scale=1.1]
\setsansfont{Arial}[Scale=MatchLowercase]
%the arrow from fira-math is too small.
\setmathfont{TeX Gyre DejaVu Math}[Scale=1.8,range={\overrightarrow}]
\setmathfont{Arial}[Scale=1.1,range=up/{num,Latin,latin}]
\setmathfont{Arial}[Scale=1.1,range=it/{num,Latin,latin}]
\setmathfont{Arial}[Scale=1.1,range=bfup/{num,Latin,latin}]
\begin{document}
\noindent\textcolor{red}{OP's version}
The coordinates of A are $\left( a_1,a_2\right)$
and of B are $\left(b_1,b_2\right),$ then
$\left|\overrightarrow{AB}\right|=
\left|\overrightarrow{BA}\right|=
\sqrt{{{\left(a_1-\ b_1\right)}^2+\left(a_2-b_2\right)}^2}.$
\bigskip\noindent\textcolor{red}{%
1. Omit \texttt{\string\left} and \texttt{\string\right} around \texttt{|...|} expressions}
The coordinates of A are $\left( a_1,a_2\right)$
and of B are $\left(b_1,b_2\right),$ then
$|\overrightarrow{AB}|=|\overrightarrow{BA}|=
\sqrt{{{\left(a_1-\ b_1\right)}^2+\left(a_2-b_2\right)}^2}.$
\bigskip\noindent\textcolor{red}{%
2. Fix Scaling of arrows}
\setmathfont{TeX Gyre DejaVu Math}[Scale=1.3,range={\overrightarrow}]
The coordinates of A are $\left( a_1,a_2\right)$
and of B are $\left(b_1,b_2\right),$ then
$|\overrightarrow{AB}|=|\overrightarrow{BA}|=
\sqrt{{{\left(a_1-\ b_1\right)}^2+\left(a_2-b_2\right)}^2}.$
\bigskip\noindent\textcolor{red}{%
3. Omit superfluous instances of \texttt{\{} and \texttt{\}} in \texttt{\string\sqrt} term}
The coordinates of A are $\left( a_1,a_2\right)$
and of B are $\left(b_1,b_2\right),$ then
$|\overrightarrow{AB}|=|\overrightarrow{BA}|=
\sqrt{\left(a_1-b_1\right)^2+\left(a_2-b_2\right)^2}.$
\bigskip\noindent\textcolor{red}{%
4. Get rid of all remaining \texttt{\string\left} and \texttt{\string\right} directives}
The coordinates of A are $(a_1,a_2)$ and of B are $(b_1,b_2)$, then
$|\overrightarrow{AB}|=|\overrightarrow{BA}|=
\sqrt{(a_1-b_1)^2+(a_2-b_2)^2}$.
\end{document}