经过大量搜索,我终于找到了格里菲斯 (Griffiths) 的 .pdf 文件,里面有他那本随处可见的本科电动力学书中所使用的难以捉摸的格里菲斯 (Griffiths) 脚本 r 字符。我制作了一个简单的包,允许我将这些数字用作数学字符:
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{scriptr}[2014/06/18 Griffiths' Script r Character]
\RequirePackage{graphicx}
\def\rcurs{{\mbox{$\resizebox{.101in}{.08in}{\includegraphics{C:/Program Files/MiKTeX 2.9/tex/latex/scriptr/ScriptR.pdf}}$}}}
\def\brcurs{{\mbox{$\resizebox{.104in}{.08in}{\includegraphics{C:/Program Files/MiKTeX 2.9/tex/latex/scriptr/BoldR.pdf}}$}}}
\def\hrcurs{{\mbox{$\hat \brcurs$}}}
有两个问题我想修复一下。
我想让字符根据字体大小自动调整其在文档主体中的大小。例如,在 12pt 字体中它看起来像这样: 在这种情况下,它看起来好像与其余文本完美契合。但是,在较小的字体大小(例如 10pt)中,它看起来与相邻字符相比有点太大。事实上,它看起来几乎像大写字母:
在数学模式下处理字符时,类似的问题仍然存在。与 \frac 一起使用时,字符看起来很好: 但是与 \tfrac 一起使用时,字符看起来与分子中的字符相比太大了:
对于我来说,让它在数学模式下表现得更像一个实际的字符的最佳方法是什么?
答案1
直接调整我的答案如何在 LaTeX 中使用自定义、可扩展的符号,我将你的两个字形屏幕保存为 jpeg 文件并对其进行了裁剪。
然后,我使用 scalerel 将它们缩放到数学模式下可扩展的大小。如果字体大小发生变化,它也可以在文本模式下很好地工作(在此 MWE 中,\tiny
演示了如何更改)。
\documentclass{article}
\usepackage{scalerel}
\begin{document}
\centering
Scale it to the size of ``r''
\def\scriptr{\scalerel*{\includegraphics{scriptr}}{r}}
\def\scriptrb{\scalerel*{\includegraphics{scriptrb}}{r}}
$ab\scriptr c \scriptscriptstyle ab\scriptr c$
$ y = x^{\scriptr}$
$ab\scriptrb c \scriptscriptstyle ab\scriptrb c$
$ y = x^{\scriptrb}$
tiny: {\tiny ab\scriptr\scriptrb c}
Scale it to a scalable rule
\newsavebox\scriptrbox
\savebox\scriptrbox{\includegraphics{scriptr}}
\def\scriptr{\scalerel{\usebox{\scriptrbox}}{\rule[-.2\LMex]{0pt}{1.4\LMex}}}
\newsavebox\scriptrbbox
\savebox\scriptrbbox{\includegraphics{scriptrb}}
\def\scriptrb{\scalerel{\usebox{\scriptrbbox}}{\rule[-.2\LMex]{0pt}{1.4\LMex}}}
$ab\scriptr c \scriptscriptstyle ab\scriptr c$\par
$ y = x^{\scriptr}$
$ab\scriptrb c \scriptscriptstyle ab\scriptrb c$\par
$ y = x^{\scriptrb}$
tiny: {\tiny ab\scriptr\scriptrb c}
\end{document}
答案2
结果很差,因为我只能进行屏幕截图;将高度调整到使符号适应字体所需的高度。
\documentclass{article}
\usepackage{amsmath,graphicx}
\newcommand\rcurs{\text{\includegraphics[height=2ex]{Rmed}}}
\newcommand\brcurs{\text{\includegraphics[height=2ex]{Rbold}}}
\begin{document}
Since $\hat{\brcurs}=\brcurs/\rcurs$, we know that
$\hat{\brcurs}/\rcurs^{2}=\brcurs/\rcurs^{3}$.
Furthermore $1/\rcurs^{3}$ can be rewritten as
\[
\tfrac{1}{\rcurs^{3}}=
\frac{1}{\rcurs^{3}}=
\bigl[(x-x')^{2}+(y-y')^{2}+(z-z')^{2}\bigr]^{3/2}.
\]
\huge
Since $\hat{\brcurs}=\brcurs/\rcurs$, we know that
$\hat{\brcurs}/\rcurs^{2}=\brcurs/\rcurs^{3}$.
Furthermore $1/\rcurs^{3}$ can be rewritten as
\[
\tfrac{1}{\rcurs^{3}}=
\frac{1}{\rcurs^{3}}=
\bigl[(x-x')^{2}+(y-y')^{2}+(z-z')^{2}\bigr]^{3/2}.
\]
\end{document}
您可能希望在包中添加一个选项。请记住根据 PDF 文件修改默认设置,使其符合您的最佳要求
scriptr.sty
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{scriptr}[2014/06/18 Griffiths' Script r Character]
\RequirePackage{kvoptions}
\SetupKeyvalOptions{prefix=scriptr@}
\DeclareStringOption{size}
\def\scriptr@size{2}% default (adjust)
\ProcessKeyvalOptions*
\RequirePackage{graphicx}
\RequirePackage{amstext} % for \text
\newcommand\rcurs{\text{\includegraphics[height=\scriptr@size ex]{Rmed}}}
\newcommand\brcurs{\text{\includegraphics[height=\scriptr@size ex]{Rbold}}}
\endinput
测试文件
\documentclass{article}
\usepackage{amsmath}
\usepackage{scriptr}
%%% Might be as follows, for adapting to a different main font
%\usepackage[size=1.5]{scriptr}
\begin{document}
Since $\hat{\brcurs}=\brcurs/\rcurs$, we know that
$\hat{\brcurs}/\rcurs^{2}=\brcurs/\rcurs^{3}$.
Furthermore $1/\rcurs^{3}$ can be rewritten as
\[
\tfrac{1}{\rcurs^{3}}=
\frac{1}{\rcurs^{3}}=
\bigl[(x-x')^{2}+(y-y')^{2}+(z-z')^{2}\bigr]^{3/2}.
\]
\huge
Since $\hat{\brcurs}=\brcurs/\rcurs$, we know that
$\hat{\brcurs}/\rcurs^{2}=\brcurs/\rcurs^{3}$.
Furthermore $1/\rcurs^{3}$ can be rewritten as
\[
\tfrac{1}{\rcurs^{3}}=
\frac{1}{\rcurs^{3}}=
\bigl[(x-x')^{2}+(y-y')^{2}+(z-z')^{2}\bigr]^{3/2}.
\]
\end{document}