Durch das Festlegen von Mainfont und Sansfont wird CMU Bright als mathematische Schriftart aufgehoben. Wie kann ich das beheben?

Durch das Festlegen von Mainfont und Sansfont wird CMU Bright als mathematische Schriftart aufgehoben. Wie kann ich das beheben?

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. \textIm 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 –  sinist in News Gothic geschrieben, ebenso wie ABC, aber xund 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:

Bildbeschreibung hier eingeben

Wenn ich entferne \setmainfont, sinwird auch Computer Modern. Wenn ich entferne \setsansfont, wird die Textschriftart und ABCbeides CMU Bright ( sinbleibt aber News Gothic). Aber ich kann nicht die Kombination herausfinden, die zu folgendem Ergebnis führt:

  1. Schriftart des Hauptteils = News Gothic
  2. sin= News Gothic (das ist optional; CMU Bright wäre auch ok)
  3. \textim Mathemodus = News Gothic
  4. 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 fontencmit 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}

Bildbeschreibung hier eingeben

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}

Bildbeschreibung hier eingeben

verwandte Informationen