.png)
私は、電磁気学を扱う人なら誰でも LaTeX で抱える典型的な問題を回避しようとしています。グリフィスのscript-r記法を定義する今回は、彼が本で実際に使用しているカウフマンフォントを使用してやりたいのですが、すでにファイルを入手しています。LuaLaTeXではフォントを「自由に」使用するのは簡単ですが、私が使用している他のパッケージ、たとえば、で定義されている太字ベクトルコマンドなどでもコードがうまく機能するように、フォントを使用する数学記号を定義したいと思います。physics
。
読んだあとこの答え汎用的な script-r の問題に関する投稿で、コマンドを使用して script-r 表記を実装しようとしました\DeclareMathSymbol
が、その中で Kaufmann フォントを使用する方法がわかりません。
簡単に言うと、.ttf
フォント ファイルが2 つあります。これらを使用して、Kaufmann フォントを使用して数式記号を定義し、コマンドがその太字バージョンを返すようにするにはどうすればよいでしょうか。Kaufmann-Regular.ttf
Kaufmann-Bold.ttf
\rcurs
\mathbf{\rcurs}
答え1
数学のアルファベットと演算子はセットを形成するため、組み合わせるには通常、さまざまな種類の低レベルの調整が必要になります。
そうは言っても、シンボルをインポートする方法や手法はさまざまです。
(1)
最も簡単な方法は、グリフを画像\PDF として含め、必要に応じてサイズを変更することです (Griffiths が行っているように)。
コード:
\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}
Griffiths の zip ファイルを参照http://academic.reed.edu/physics/faculty/griffiths/script_r.zip、 経由スクリプト-r シンボル
(2)
次に簡単な方法は、\math...
関数の 1 つ (ここでは\mathord
) を使用することです。\Umathchardef を使用して XeTeX で可変サイズの数学記号を定義する経由LuaTeX: 数式モードで他のフォントの単一記号を使用する
以下にそのリストを示します。
(texdoc ソース2e)
ムウェ
\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}
(2ア)
アクセントの調整を正しく行うには、カーニングなどが必要になります。ここでは、別の非数学フォントを使用することでその問題を回避しています。
ムウェ
\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)
次に、unicode-math
パッケージのrange=
フォントオプションを使用してマッピングします。
Unicode 数学フォントからのマッピング:
ムウェ
\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)
\DeclareMathSymbol
従来のフォント技術を使用します。ttf\otf フォントは、パッケージ (つまりコンパイラとして xelatex または lualatex) 経由で NFSS エイリアスを割り当てfontspec
、リンクされた質問に従って複数の手順を実行することで使用できます。
オプションは ですNFSSFamily=
。
この例ではQTFloraline
、標準書体と太字書体を持つフォント (Tex ディストリビューション内) を使用しています。代わりに kaufmann ファイルを代用してください。
ムウェ
\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)
1 つまたは 2 つの記号の場合、この\mathord{}
方法はより簡単であり、数学のアルファベット全体も使用しません。
結局のところ、は と というunicode-math
2 つのマクロを定義します。これらはを介して ( )再定義するだけで済みます。\mbfscrr
\mscrr
renewcommand
\mathord
コードは、変更する内容の段階を順に実行し、各結果を示し、QTChanceryType
フォントを使用して最終ステップに到達します。
ムウェ
\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}
補遺
曖昧さを避けるために、テキスト モードと数式モードは、フォントに関しては完全に異なる世界です。
イタリック体のx(