
Usando XeTeX con fontspec
yunicode-math
, me gustaría usar la fuente principal de los documentos paradígitos(números) en modo matemático. Además, me gustaría que \text{}
en el modo matemático se utilicen números de revestimiento, mientras que los números predeterminados para el documento son números de estilo antiguo. ¿Cómo puedo lograr este comportamiento?
Intenté insertar \setmathfont[range=\mathup/{num}]{Linux Libertine O}
pero no da el resultado deseado.
Aquí hay un MWE que señala los problemas:
\documentclass{article}
\usepackage{iftex}
\usepackage{libertine}
\usepackage{fontspec}
\setmainfont[Numbers=OldStyle]{Linux Libertine O}
\usepackage{amsmath}
\usepackage{unicode-math}
% Here I try to set up the normal text font for digits in mathmode:
\setmathfont[range=\mathup/{num}]{Linux Libertine O}
\parindent0pt
\begin{document}
This is \ifXeTeX XeTeX\fi\ifLuaTeX LuaTeX\fi
with \fontname\font
\bigskip
Text numbers:
0123456789; italic: \textit{0123456789}; bold: \textbf{0123456789}
Text numbers lining:
\liningnums{0123456789; italic: \textit{0123456789}; bold:
\textbf{0123456789}}
Numbers in mathmode: $0123456789$ (ok)\\
mathit: $\mathit{0123456789}$ (wrong font)\\
mathbf: $\mathbf{0123456789}$ (wrong font)\\
mathrm: $\mathrm{0123456789}$ (wrong font)\\
text (math): $\text{0123456789}$ (should be lining)
In big equation, fonts for big brackets $\big( \Big( \bigg( \Bigg($ are
missing:
\[
\left(\frac{12a}{34b}\right)
\]
\end{document}
Usando XeTeX, esto da como resultado:
Entonces hay 3 problemas:
Linux Libertine O
para dígitos no aparece en\mathrm
,\mathit
,\mathbf
etc.- Los soportes grandes no funcionan. (Vea más sobre esto a continuación).
- ¿Hay alguna manera de lograr números de revestimiento en modo matemático
\text{}
aunque el estilo del número de documento sea OldStyle?
En cuanto al problema 1, esto se debe a que range=\mathup/{num}
solo se aplica al texto matemático vertical. ¿Alguien sabe cómo aplicar este comando para todos los números en todos los rangos? usar solo range={num}
resulta en un error.
Respecto al problema 2, tengo dos datos más. A) Usando LuaTeX en el mismo archivo, los corchetesaparecen, pero sin ser escalado:
B) Si comento la línea \setmathfont[range=\mathup/{num}]{Linux Libertine O}
, el problema no ocurre en absoluto. Esto sugiere que el mecanismo de corchetes se ve afectado al cambiar la fuente de los números, lo cual no debería ser así, ¿verdad?
Este problema, por cierto, no es específico de Linux Libertine O
. También apareció cuando lo estaba usando SabonNextLTPro
como fuente del documento principal.
Respuesta1
Mientras tanto, hasta que a alguien se le ocurra una idea, pensé en compartir una solución alternativa. Básicamente se trata de volver a mathspec
en lugar de unicode-math
. Casi todo funciona de inmediato en solo tres líneas:
\documentclass{article}
\usepackage{iftex}
\usepackage[no-math]{fontspec}
\usepackage{libertine}
\setmainfont[Numbers=OldStyle]{Linux Libertine O}
\usepackage{amsmath}
\usepackage{mathspec}
\setmathfont(Digits){Linux Libertine O}
\parindent0pt
\begin{document}
This is \ifXeTeX XeTeX\fi\ifLuaTeX LuaTeX\fi
with \fontname\font
\bigskip
Text numbers:
0123456789; italic: \textit{0123456789}; bold: \textbf{0123456789}
Text numbers lining:
\liningnums{0123456789; italic: \textit{0123456789}; bold:
\textbf{0123456789}}
Numbers in mathmode: $0123456789$ (ok)\\
mathit: $\mathit{0123456789}$ (correct font but no italic)\\
mathbf: $\mathbf{0123456789}$ (correct font but no boldface)\\
mathrm: $\mathrm{0123456789}$ (ok)\\
text (math): $\text{0123456789}$ (should be lining)
In equations, testing fonts for big brackets $\big( \Big( \bigg( \Bigg($:
\[
\left(\frac{12a}{34b}\right)
\]
\end{document}