
Ich möchte in der Lage sein, in meinem gesamten Dokument eine benutzerdefinierte TTF (News Gothic) als Hauptschriftart zu verwenden, wo immer Text vorkommt, und CMU Bright für Mathematik. \text
Im Mathematikmodus sollte jedoch New Gothic verwendet werden. Der Versuch, News Gothic als Hauptschriftart zu verwenden, hebt jedoch CMU als Mathematikschriftart auf, die Sie im Bild unten sehen können – sin
ist in News Gothic geschrieben, ebenso wie ABC
, aber x
und e^{-x}
sind in Computer Modern statt CMU Bright.
Hier ist ein Beispieldokument. Es wurde mit xelatex kompiliert, obwohl eine reine luatex-Lösung auch in Ordnung wäre. Ich glaube nicht, dass pdflatex mit solchen Schriftarten umgehen kann, aber ich würde mich freuen, wenn ich mich irre. Jede Lösung, die funktioniert, ist akzeptabel.
\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}
Ergebnis:
Wenn ich entferne \setmainfont
, sin
wird auch Computer Modern. Wenn ich entferne \setsansfont
, wird die Textschriftart und ABC
beides CMU Bright ( sin
bleibt aber News Gothic). Aber ich kann nicht die Kombination herausfinden, die zu folgendem Ergebnis führt:
- Schriftart des Hauptteils = News Gothic
sin
= News Gothic (das ist optional; CMU Bright wäre auch ok)\text
im Mathemodus = News Gothic- Zahlen, Variablen usw. im Mathematikmodus = CMU Bright
Antwort1
Sie möchten ältere mathematische Schriftarten verwenden, laden Sie also nicht unicode-math
. Und laden Sie natürlich nicht fontenc
mit T1-Kodierung.
\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}
Die Operatornamen erhält man in News Gothic mit einer leicht veränderten Präambel:
\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}