![小数分隔符符号被“mathastext”覆盖](https://linux22.com/image/454873/%E5%B0%8F%E6%95%B0%E5%88%86%E9%9A%94%E7%AC%A6%E7%AC%A6%E5%8F%B7%E8%A2%AB%E2%80%9Cmathastext%E2%80%9D%E8%A6%86%E7%9B%96.png)
我发现这mathastext
会干扰包spanish
的选项babel
。更准确地说,当mathastext
加载时,西班牙语中的默认小数点分隔符(逗号)会被替换为点,即使明确设置了它也是如此。
这是一个最小工作示例:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[defaultfam,light,bold,proportional,lining]{montserrat}
% Using Montserrat as our default font.
\usepackage[italic,defaultmathsizes]{mathastext}
% This makes the math font to be the default text font.
\usepackage[spanish]{babel}
\decimalcomma % Not really needed, since this is the default option
\begin{document}
Estos números son famosos:\\
$\pi = 3.14159\dots$\\
$e = 2.71828\dots$\\
$\varphi = 1.61803\dots$\\
Además,
%
\begin{equation}
\pi = 3.14\dots = 4 \sum_{n=0}^{+\infty}{\frac{(-1)^n}{2n+1}} .
\end{equation}
\end{document}
由此得出:
现在,如果我们删除这些行
\usepackage[italic,defaultmathsizes]{mathastext}
% This makes the math font to be the default text font.
从上面的例子,我们得到这个:
所以,当我使用时,如何在西班牙语中使用逗号作为小数点分隔符mathastext
?
答案1
该包恢复了处mathastext
的数学代码。将其恢复到预期状态。.
\everymath
babel-spanish
\documentclass[12pt]{article}
%\usepackage[utf8]{inputenc} % not necessary
\usepackage[T1]{fontenc}
\usepackage[defaultfam,light,bold,proportional,lining]{montserrat}
% Using Montserrat as our default font.
\usepackage[italic,defaultmathsizes]{mathastext}
% This makes the math font to be the default text font.
\usepackage[spanish]{babel}
\AtBeginDocument{%
\everymath\expandafter{\the\everymath\mathcode`.="8000 }%
\everydisplay\expandafter{\the\everydisplay\mathcode`.="8000 }%
}
\begin{document}
Estos números son famosos:
$\pi = 3.14159\dots$
$e = 2.71828\dots$
$\varphi = 1.61803\dots$
Además,
%
\begin{equation}
\pi = 3.14\dots = 4 \sum_{n=0}^{+\infty}{\frac{(-1)^n}{2n+1}} .
\end{equation}
\end{document}