
Me gustaría poder utilizar un TTF (News Gothic) personalizado como fuente principal en todo mi documento dondequiera que aparezca el texto, y CMU Bright para matemáticas. Pero \text
dentro del modo matemático debería usar New Gothic. Sin embargo, intentar utilizar News Gothic como fuente principal desactiva CMU como fuente matemática, que puede ver en la imagen a continuación: sin
está escrita en News Gothic, al igual que ABC
, pero x
y e^{-x}
están en Computer Modern en lugar de CMU Bright.
Aquí hay un documento de muestra. Fue compilado con xelatex, aunque una solución exclusiva de luatex también estaría bien; No creo que pdflatex pueda manejar fuentes como esta, pero me encantaría equivocarme. Cualquier solución que funcione es aceptable.
\documentclass{article}
\usepackage{mathtools}
\usepackage{fontspec,unicode-math}
\usepackage{cmbright}
\usepackage[T1]{fontenc}
\setmainfont[
Path = /Applications/Microsoft PowerPoint.app/Contents/Resources/DFonts/,
Extension = .ttf,
BoldFont = News Gothic MT Bold,
ItalicFont = News Gothic MT Italic,
BoldItalicFont = News Gothic MT Bold Italic
]
{News Gothic MT}
\setsansfont[
Path = /Applications/Microsoft PowerPoint.app/Contents/Resources/DFonts/,
Extension = .ttf,
BoldFont = News Gothic MT Bold,
ItalicFont = News Gothic MT Italic,
BoldItalicFont = News Gothic MT Bold Italic
]
{News Gothic MT}
\begin{document}
\begin{center}
This is math:
\begin{align*}
\int_{-\infty}^\infty \frac{\sin(x)e^{-x}}{x}\quad\textbf{\textit{ABC}}
\end{align*}
\end{center}
\end{document}
Resultado:
Si elimino \setmainfont
, sin
también se convierte en Computer Modern. Si elimino \setsansfont
, la fuente del cuerpo y ABC
ambas se convierten en CMU Bright (pero sin
siguen siendo News Gothic). Pero no puedo entender la combinación que resultará en:
- Fuente del cuerpo = Noticias góticas
sin
= News Gothic (esto es opcional; CMU Bright también estaría bien)\text
en modo matemático = Noticias Góticas- Números, variables, etc en modo matemático = CMU Bright
Respuesta1
Desea utilizar fuentes matemáticas heredadas, así que no las cargue unicode-math
. Y, por supuesto, no cargue fontenc
con codificación T1.
\documentclass{article}
\usepackage{mathtools}
\usepackage{fontspec}
\usepackage{cmbright}
%\usepackage[T1]{fontenc}% <--- don't
\setmainfont{News Gothic MT}[
Path = /Applications/Microsoft PowerPoint.app/Contents/Resources/DFonts/,
Extension = .ttf,
ItalicFont = * Italic,
BoldFont = * Bold,
BoldItalicFont = * Bold Italic,
]
\setsansfont{News Gothic MT}[
Path = /Applications/Microsoft PowerPoint.app/Contents/Resources/DFonts/,
Extension = .ttf,
ItalicFont = * Italic,
BoldFont = * Bold,
BoldItalicFont = * Bold Italic,
]
\begin{document}
This is math:
\begin{equation*}
\int_{-\infty}^\infty \frac{\sin(x)e^{-x}}{x}\quad\textbf{\textit{ABC}}+123
\end{equation*}
\end{document}
Se pueden obtener los nombres de los operadores en News Gothic con un preámbulo ligeramente diferente:
\documentclass{article}
\usepackage{mathtools}
\usepackage{fontspec}
\usepackage{cmbright}
\setmainfont{News Gothic MT}[
Path = /Applications/Microsoft PowerPoint.app/Contents/Resources/DFonts/,
Extension = .ttf,
ItalicFont = * Italic,
BoldFont = * Bold,
BoldItalicFont = * Bold Italic,
NFSSFamily = ngmt,
]
\setsansfont{News Gothic MT}[
Path = /Applications/Microsoft PowerPoint.app/Contents/Resources/DFonts/,
Extension = .ttf,
ItalicFont = * Italic,
BoldFont = * Bold,
BoldItalicFont = * Bold Italic,
]
\DeclareSymbolFont{operators}{TU}{ngmt}{m}{n}
\SetSymbolFont{operators}{bold}{TU}{ngmt}{b}{n}
\DeclareSymbolFont{cmbroperators}{OT1}{cmbr}{m}{n}
\makeatletter
\AtBeginDocument{\DeclareMathSymbol{\std@equal}{\mathrel}{cmbroperators}{`=}}
\makeatother
\begin{document}
\show\Relbar
This is math:
\begin{equation*}
\int_{-\infty}^\infty \frac{\sin(x)e^{-x}}{x}\quad\textbf{\textit{ABC}}+123
\end{equation*}
$\Longrightarrow\longrightarrow$
\end{document}