Deklarieren eines bestimmten mathematischen Symbols in einer TTF-Schriftart (LuaLaTeX)

Deklarieren eines bestimmten mathematischen Symbols in einer TTF-Schriftart (LuaLaTeX)

Ich versuche, ein klassisches Problem in LaTeX für jeden zu umgehen, der sich mit Elektromagnetismus beschäftigt:Definieren Sie Griffiths' Script-R-Notation. Dieses Mal möchte ich die tatsächliche Kaufmann-Schriftart verwenden, die er in seinem Buch verwendet, und ich habe es bereits geschafft, die Dateien zu bekommen. Während es in LuaLaTeX einfach ist, die Schriftarten „frei“ zu verwenden, möchte ich ein mathematisches Symbol definieren, das sie verwendet, damit der Code gut mit anderen Paketen funktioniert, die ich verwende, wie z. B. den fetten Vektorbefehlen, die definiert sind durchphysics.

Nach dem Lesendiese Antwortim Beitrag zum allgemeinen Script-R-Problem: Ich habe versucht, die Script-R-Notation mithilfe des \DeclareMathSymbolBefehls zu implementieren, verstehe aber nicht, wie ich darin die Schriftart Kaufmann verwenden kann.

Kurz gesagt: Ich habe zwei .ttfSchriftdateien Kaufmann-Regular.ttfund Kaufmann-Bold.ttf. Wie kann ich diese verwenden, um ein mathematisches Symbol \rcursin der Schriftart Kaufmann zu definieren, sodass Befehle wie \mathbf{\rcurs}die fettgedruckte Version zurückgeben?

Antwort1

Mathematische Alphabete und Operatoren bilden einen Satz, sodass beim Mix-and-Match-Verfahren in der Regel geringfügige Anpassungen verschiedener Art erforderlich sind.

Allerdings gibt es verschiedene Möglichkeiten und Methoden, ein Symbol zu importieren.


(1)

Am einfachsten ist es, die Glyphen als Bilder/PDFs einzubinden und bei Bedarf die Größe usw. zu ändern, wie es Griffiths macht:

Code:

\documentclass{report}

\usepackage{graphicx}

\def\rcurs{{\mbox{$\resizebox{.16in}{.08in}{\includegraphics{ScriptR}}$}}}
\def\brcurs{{\mbox{$\resizebox{.16in}{.08in}{\includegraphics{BoldR}}$}}}
\def\hrcurs{{\mbox{$\hat \brcurs$}}}


\begin{document}

Here's a sample:

$\resizebox{.16in}{.08in}{\includegraphics{BoldR}}$

Can I put it into a line of type?  $\resizebox{.21in}{.11in}{\includegraphics{BoldR}}$

How about using the macro: \brcurs.

How about using the macro: \rcurs?

How about using the macro: \hrcurs?

What if it's in an equation?

\begin{equation}
{\bf E} = {1\over 4\pi\epsilon_0}\int {\rho\over \rcurs^2}{\hrcurs}\,d\tau.
\end{equation}

\end{document}

Bild

Siehe die Griffiths Zip-Dateihttp://academic.reed.edu/physics/faculty/griffiths/script_r.zip, überScript-r-Symbol


(2)

Der nächst einfachere Weg ist die Verwendung einer der \math...Funktionen (hier\mathord ) zu verwenden:Definieren eines mathematischen Symbols variabler Größe in XeTeX mit \UmathchardefüberLuaTeX: Verwenden Sie im Mathematikmodus ein einzelnes Symbol aus einer anderen Schriftart

Hier ist eine Liste davon:

Liste Mathematik

(Texdoc Quelle2e)

um2

MWE

\documentclass{report}
\usepackage{xcolor}
\usepackage{unicode-math}
\setmathfont{Asana-Math}

\newfontfamily{\miama}{Miama}[Colour=red,
Scale=1.3,
Path=C:/Users/.../tl/texlive/2020/texmf-dist/fonts/opentype/public/miama/,
Extension=.otf,
UprightFont=*,
]

\DeclareRobustCommand\mysym{%
  \mathord{\text{\normalfont\miama r}}%
}

%\def\rcurs{{\mbox{$\resizebox{.16in}{.08in}{\includegraphics{ScriptR}}$}}}
%\def\brcurs{{\mbox{$\resizebox{.16in}{.08in}{\includegraphics{BoldR}}$}}}
%\def\hrcurs{{\mbox{$\hat \brcurs$}}}
\def\hrcurs{{\mbox{$\hat\mbfscrr$}}}

\begin{document}

\fbox{Asana-Math: $\mbfscrr, \mscrr $}

Here's a sample:

$\mbfscrr$

Can I put it into a line of type?  $\mbfscrr$

How about using the macro: \hrcurs?

What if it's in an equation?

\begin{equation}
\symbf{E} = {1\over 4\mitpi\mitepsilon_0}\int {\mitrho\over \mscrr^2}{\hat\mbfscrr}\,d\mittau.
\end{equation}


\renewcommand\mbfscrr{{\mysym}}
\def\hrcurs{{\mbox{$\hat\mbfscrr$}}}

\bigskip
\fbox{Miama: $\mysym$}

Here's a sample:

$\mysym$

Can I put it into a line of type?  $\mysym$

How about using the macro: \hrcurs?

What if it's in an equation?


\begin{equation}

\symbf{E} = {1\over 4\mitpi\mitepsilon_0}\int {\mitrho\over \mscrr^2}{\hat\mbfscrr}\,d\mittau.
\end{equation}


\end{document}

(2a)

Um die Akzentanpassungen richtig vorzunehmen, ist Unterschneidung usw. erforderlich. Hier wird dieses Problem durch eine andere, nicht mathematische Schriftart vermieden:

um3

MWE

\documentclass{report}
\usepackage{xcolor}
\usepackage{unicode-math}
\setmathfont{Asana-Math}

\newfontfamily{\gfs}{GFSBodoni}[Colour=red,
Scale=1.3,
Path=C:/Users/.../tl/texlive/2020/texmf-dist/fonts/opentype/public/gfsbodoni/,
Extension=.otf,
UprightFont=*,
ItalicFont=GFSBodoniIt,
BoldFont=GFSBodoniBold,
BoldItalicFont=GFSBodoniBoldIt,
]

\DeclareRobustCommand\mysymbi{%
  \mathord{\text{\normalfont\gfs\bfseries\itshape r}}%
}
\DeclareRobustCommand\mysym{%
  \mathord{\text{\normalfont\gfs\itshape r}}%
}

\def\hrcurs{{\mbox{$\hat\mbfscrr$}}}

\begin{document}

\fbox{Asana-Math: $\mbfscrr, \mscrr $}

Here's a sample:

$\mbfscrr$

Can I put it into a line of type?  $\mbfscrr$

How about using the macro: \hrcurs?

What if it's in an equation?

\begin{equation}
\symbf{E} = {1\over 4\mitpi\mitepsilon_0}\int {\mitrho\over \mscrr^2}{\hat\mbfscrr}\,d\mittau.
\end{equation}


\renewcommand\mbfscrr{{\mysymbi}}
\def\hrcurs{{\mbox{$\hat\mbfscrr$}}}

\bigskip
\fbox{GFS Bodoni: $\mysymbi, \mysym$}

Here's a sample:

$\mysym$

Can I put it into a line of type?  $\mysym$

How about using the macro: \hrcurs?

What if it's in an equation?


\begin{equation}
\symbf{E} = {1\over 4\mitpi\mitepsilon_0}\int {\mitrho\over \mysym^2}{\hat\mbfscrr}\,d\mittau.
\end{equation}


\end{document}

(3)

Als Nächstes erfolgt die Zuordnung mithilfe der Schriftartoption unicode-mathdes Pakets .range=

Zuordnung von einer Unicode-Mathematikschriftart:

Äh

MWE

\documentclass{report}
\usepackage{xcolor}
\usepackage{unicode-math}
\setmathfont{Asana-Math}

\def\hrcurs{{\mbox{$\hat\mbfscrr$}}}

\begin{document}

\fbox{Asana-Math: $\mbfscrr,\mscrr$}

Here's a sample:

$\mbfscrr$

Can I put it into a line of type?  $\mbfscrr$

How about using the macro: \hrcurs?

What if it's in an equation?

\begin{equation}
\symbf{E} = {1\over 4\mitpi\mitepsilon_0}\int {\mitrho\over \mscrr^2}{\hat\mbfscrr}\,d\mittau.
\end{equation}


\setmathfont{TexGyreSchola-Math}[range={\mbfscrr,\mscrr},Colour=red]

\bigskip
\fbox{TexGyreSchola-Math: $\mbfscrr,\mscrr$}

Here's a sample:

$\mbfscrr$

Can I put it into a line of type?  $\mbfscrr$

How about using the macro: \hrcurs?

What if it's in an equation?

\begin{equation}
\symbf{E} = {1\over 4\mitpi\mitepsilon_0}\int {\mitrho\over \mscrr^2}{\hat\mbfscrr}\,d\mittau.
\end{equation}


\end{document}

(4)

\DeclareMathSymbolverwendet veraltete Schrifttechniken. ttf\otf-Schriftarten können verwendet werden, indem ihnen über fontspecdas Paket ein NFSS-Alias ​​zugewiesen wird (also xelatex oder lualatex als Compiler) und dann gemäß der verlinkten Frage mehrere Schritte ausgeführt werden.

Die Option ist NFSSFamily=.

Blumenfee

Das Beispiel verwendet QTFloralinedie Schriftart (in der Tex-Distribution)L. Sie hat eine normale und eine fette Schriftart. Ersetzen Sie sie stattdessen durch Ihre Kaufmann-Dateien.

MWE

\documentclass{article}
\usepackage{xcolor}
\usepackage{unicode-math}
\setmathfont{Asana-Math}

\newfontface\ffontc{QTFloraline}[
Extension=.otf,
UprightFont=*,
BoldFont=*-Bold,
NFSSFamily=floraline,
]


\usepackage{bm}
\DeclareFontFamily{U}{floraline}{}
\DeclareFontShape{U}{floraline}{m}{n}{<-> QTFloraline}{}
\DeclareFontShape{U}{floraline}{b}{n}{<-> QTFloraline-Bold}{}
\DeclareSymbolFont{myfloraline}{U}{floraline}{m}{n}
\SetSymbolFont{myfloraline}{bold}{U}{floraline}{b}{n}
\DeclareMathSymbol{\rcurs}{\mathalpha}{myfloraline}{`\r}
\DeclareBoldMathCommand{\brcurs}{\rcurs}
\newcommand*\hrcurs{\hat{\brcurs}}

\begin{document}

\[
  \mathbf{E}(\mathbf{r}) = \frac{1}{4 \pi \epsilon_0} \int\limits_{\mathcal{V}} \frac{\rho(\mathbf{r}')}{\rcurs^2} \hrcurs d \tau'
\]


Using \texttt{unicode-math} macros:

\[
  \symbfup{E}(\symbfup{r}) = \frac{1}{4 \mitpi \mitepsilon_0} \int\limits_{\symcal{V}} \frac{\mitrho(\symbfup{r}')}{\rcurs^2} \hrcurs d \mittau'
\]


\end{document}

(5)

Bei einem oder zwei Symbolen \mathord{}ist die Methode einfacher und verbraucht auch nicht das ganze mathematische Alphabet.

Wie sich herausstellt, unicode-mathdefiniert zwei Makros, \mbfscrrund \mscrr. Diese können einfach renewcommandüber ( ) neu definiert werden \mathord, und das war’s.

Der Code durchläuft die einzelnen Schritte der zu ändernden Änderungen, veranschaulicht jedes Ergebnis und erreicht den letzten Schritt mithilfe QTChanceryTypeeiner Schriftart:

Makros

MWE

\documentclass{report}
\usepackage{xcolor}
\usepackage{unicode-math}
\setmathfont{Asana-Math}
\newfontface\bodb{BOD_BLAR.TTF}[Colour=red]

\newfontface\ffontbreg{QTChanceryType.otf}
\newfontface\ffontbbold{QTChanceryType-Bold.otf}

\DeclareRobustCommand\xmbfscrr{%
\mathord{\text{\normalfont\bodb A}}%
}
\DeclareRobustCommand\myscrr{%
\mathord{\text{\normalfont\ffontbreg r}}%
}
\DeclareRobustCommand\mybfscrr{%
\mathord{\text{\normalfont\ffontbbold r}}%
}


\begin{document}

%======================: 0: base
\fbox{Asana-Math: $\mbfscrr,\mscrr$}
\begin{equation}
\symbfup{E} = {\frac{1}{4\mitpi\mitepsilon_0}}\int {\frac{\mitrho}{\mscrr^2}}{\hat\mbfscrr}\,d\mittau.
\end{equation}


%======================: 1: A
\renewcommand{\mbfscrr}{A}

\bigskip
\begin{equation}
\symbfup{E} = {\frac{1}{4\mitpi\mitepsilon_0}}\int {\frac{\mitrho}{\mscrr^2}}{\hat\mbfscrr}\,d\mittau.
\end{equation}


%======================: 2: A from another font
\renewcommand{\mbfscrr}{{\xmbfscrr}}

\bigskip
\begin{equation}
\symbfup{E} = {\frac{1}{4\mitpi\mitepsilon_0}}\int {\frac{\mitrho}{\mscrr^2}}{\hat\mbfscrr}\,d\mittau.
\end{equation}


%======================:  3: r and bold r, from another font
\renewcommand{\mbfscrr}{{\mybfscrr}}
\renewcommand{\mscrr}{{\myscrr}}

\bigskip
\begin{equation}
\symbfup{E} = {\frac{1}{4\mitpi\mitepsilon_0}}\int {\frac{\mitrho}{\mscrr^2}}{\hat\mbfscrr}\,d\mittau.
\end{equation}



\end{document}

Nachtrag

Um Unklarheiten zu vermeiden: Textmodus und Mathematikmodus sind, was die Schriftarten betrifft, völlig unterschiedliche Universen.

kursives x

Wo steht das kursive x (

verwandte Informationen