
Gostaria de poder usar um TTF (News Gothic) personalizado como fonte principal em todo o meu documento, onde quer que o texto ocorra, e CMU Bright para matemática. Mas \text
dentro do modo matemático deve usar New Gothic. No entanto, a tentativa de usar News Gothic como fonte principal desativa CMU como fonte matemática, que você pode ver na imagem abaixo - sin
está escrita em News Gothic, assim como o ABC
, mas x
está e^{-x}
em Computer Modern em vez de CMU Bright.
Aqui está um exemplo de documento. Ele foi compilado com xelatex, embora uma solução somente luatex também fosse adequada; Não acho que o pdflatex possa lidar com fontes como essa, mas adoraria estar errado. Qualquer solução que funcione é aceitável.
\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:
Se eu remover \setmainfont
, então sin
também se tornará Computer Modern. Se eu remover \setsansfont
, a fonte do corpo e ABC
ambas se tornarão CMU Bright (mas sin
permanecerão News Gothic). Mas não consigo descobrir a combinação que resultará em:
- Fonte do corpo = News Gothic
sin
= News Gothic (isso é opcional; CMU Bright também estaria ok)\text
no modo matemático = News Gothic- Números, variáveis, etc. no modo matemático = CMU Bright
Responder1
Você deseja usar fontes matemáticas herdadas, então não carregue arquivos unicode-math
. E, claro, não carregue fontenc
com codificação 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}
Pode-se obter os nomes dos operadores no News Gothic com um preâmbulo ligeiramente 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}