想要更改整个文档中 \mathsf 的大小

想要更改整个文档中 \mathsf 的大小

当我在大写 \mathsf 字母上放置 \overline、\overrightarrow 等时,结果太大,无法用默认的 \baselineskip 放入内联方程中。这会导致行距不均匀,而且在我看来,即使在显示的方程中看起来也不正确。\mathrm 和其他形状也是如此,但我只在 \mathsf 字母上使用此类装饰。

我推测有一种方法可以将 \mathsf 字体形状重新定义为比整个文档中的默认值小一点,但字体指南中有关 \DeclareLMathAlphabet 和 \SetMathAlphabet 等的文档非常简洁,其中的几个示例与我想要做的事情不符。非常感谢您的建议!

这是一个简单的例子:

\documentclass{article}
 
\usepackage{amsmath} \usepackage{newtxmath}

\addtolength{\parskip}{3pt}

\begin{document}

This is a line of text with an inline equation in it that contains a
\verb=\mathsf= character string that shows that it does not fit with
an \verb=\overrightarrow= over it, $\overrightarrow{\mathsf{AB}}$,
i.e.~the spacing on the last line is larger than the first.

This is a line of text with an inline equation in it that shows if you
change font to \verb=\mathrm= you get the same problem,
$\overrightarrow{\mathrm{AB}}$ (but I only use \verb=\overrightarrow=
on \verb=\mathsf=).

What I've been doing is to make the \verb=\mathsf= characters are bit
smaller by wrapping my equations in \verb={\small ... }=, like this
{\small$\overrightarrow{\mathsf{AB}}$}, but it's a PITA having to do
that everywhere (even in displayed equations for consistency).

So, I'd like to make all my \verb=\mathsf= text say 10\% smaller, and
of course this size change should apply equally in
\verb=\displaystyle=, \verb=\textstyle=, \verb=\scriptstyle= and
\verb=\scriptscriptstyle=.

\end{document}

答案1

例如使用包埃斯韦特,以及命令\vv。您可以自定义箭头的形状。

\documentclass{article}

\usepackage{amsmath}
\usepackage{esvect}
\addtolength{\parskip}{3pt}

\begin{document}

This is a line of text with an inline equation in it that contains
a \verb=\mathsf= character string that shows that it \textbf{does fit} 
with an \verb=\vv= over it, $\vv{\mathsf{AB}}$, i.e.~the spacing on the last 
line is \textbf{the same} than the first.

This is a line of text with an inline equation in it that shows if you change 
font to \verb=\mathrm= you get the same \textbf{correct} line spacing, 
$\vv{\mathrm{AB}}$ (bla bla bla, so there is 3 line of text in this paragraph).

\end{document}

结果:

在此处输入图片描述

答案2

您不应该使用newtxmath而不将文本字体更改为 Times。

当然,首选的软件包是newtxtext,它还加载了无衬线 Helvetica。为了缩放 Helvetica,您可以newtxtext使用nohelv选项加载,并helvet使用缩放选项加载。

对于箭头上方也esvect很有用。

\documentclass{article}
 
\usepackage{amsmath}
\usepackage[nohelv]{newtxtext}
\usepackage[scaled=0.8]{helvet}
\usepackage{newtxmath}
\usepackage{esvect}

\DeclareFontFamily{U}{esvect}{}
\DeclareFontShape{U}{esvect}{m}{n}{
  <-5.5> vect5
  <5.5-6.5> vect6
  <6.5-7.5> vect7
  <7.5-8.5> vect8
  <8.5-9.5> vect9
  <9.5-> vect10
}{}


\begin{document}

This is a line of text with an inline equation in it that contains a
\verb=\mathsf= character string that shows that it does not fit with
an \verb=\vv= over it, $\vv{\mathsf{AB}}$,
i.e.~the spacing on the last line is larger than the first.

\end{document}

需要字体形状声明,因为esvect有一个.fd文件仅加载固定大小的字体(但它提供可扩展的 Type1 字体)。

在此处输入图片描述

如果将 的调用helvet替换为

\usepackage[type1,sfdefault,scale=0.85]{sourcesanspro}

在此处输入图片描述

与 Helvetica 相比,我更推荐它。

相关内容