38

The near-ubiquitous undergraduate reference on electrodynamics, "Introduction to Electrodynamics" by David Griffiths make extensive use of a script-r symbol, defined to be \vector{\scriptr} \equiv \vector{r} - \vector{r}^{\prime} and looks like:

Script r

Although the question of how to produce such a symbol in LaTeX is quite a common one I am yet to find a satisfactory solution. The closest I've found is from the physymb package and uses the Calligra fonts:

enter image description here

Sadly, there is not a bold variant of this character and it is far more cursive than I would like. I am hence wondering if there are any better facsimiles.

0

10 Answers 10

10

I'd like to expand on the answer by Mateen. First of all, it is possible to limit the selection of calligra to only the lowercase r and second, bold face can be achieved using PDF literals. All of this is done using virtual fonts. So first, we create the virtual fonts, which is just a stripped down and tuned version of the output of tftopl `kpsewhich callig15.tfm`. In particular, the bounding boxes of the glyphs were enlarged and the glyph shifted a little bit to the left. On top of that we add some SPECIAL statements to unslant the character a little, because the Calligra font is more cursive than Griffiths' one.

The normal font variant: griffm.vpl

(FAMILY GRIFF)
(CODINGSCHEME FONTSPECIFIC)
(DESIGNSIZE R 10.0)
(MAPFONT D 0 (FONTNAME callig15))
(FONTDIMEN
   (SLANT R 0.0)
   (SPACE R 0.332987)
   (STRETCH R 0.165994)
   (SHRINK R 0.109996)
   (XHEIGHT R 0.195992)
   (QUAD R 0.798967)
   )
(CHARACTER C r
   (CHARWD R 0.23)
   (CHARHT R 0.23)
   (CHARDP R 0.0095)
   (MAP
      (SPECIAL pdf: q 1 0 -.5 1 0 0 cm)
      (PUSH)
      (MOVELEFT R 0.02)
      (SELECTFONT D 0)
      (SETCHAR C r)
      (POP)
      (SPECIAL pdf: Q)
      )
   )

In the bold font variant we add extra SPECIAL instructions around the character to embolden it by thickening the outline strokes: griffb.vpl

(FAMILY GRIFF)
(CODINGSCHEME FONTSPECIFIC)
(DESIGNSIZE R 10.0)
(MAPFONT D 0 (FONTNAME callig15))
(FONTDIMEN
   (SLANT R 0.0)
   (SPACE R 0.332987)
   (STRETCH R 0.165994)
   (SHRINK R 0.109996)
   (XHEIGHT R 0.195992)
   (QUAD R 0.798967)
   )
(CHARACTER C r
   (CHARWD R 0.23)
   (CHARHT R 0.23)
   (CHARDP R 0.0095)
   (MAP
      (SPECIAL pdf: q 1 0 -.5 1 0 0 cm 2 Tr 0.4 w)
      (PUSH)
      (MOVELEFT R 0.02)
      (SELECTFONT D 0)
      (SETCHAR C r)
      (POP)
      (SPECIAL pdf: 0 Tr 0 w Q)
      )
   )

The two virtual fonts are assembled using

vptovf griffm.vpl
vptovf griffb.vpl

Then they are ready to be used in the LaTeX file. We only need to put in the correct NFSS instructions. For easy access to the bold face variant I make use of the bm package and define the shortcut \brcurs (like Griffiths).

\documentclass{article}

\usepackage{bm}
\DeclareFontFamily{U}{griff}{}
\DeclareFontShape{U}{griff}{m}{n}{<-> s*[2.2] griffm}{}
\DeclareFontShape{U}{griff}{b}{n}{<-> s*[2.2] griffb}{}
\DeclareSymbolFont{griff}{U}{griff}{m}{n}
\SetSymbolFont{griff}{bold}{U}{griff}{b}{n}
\DeclareMathSymbol{\rcurs}{\mathalpha}{griff}{"72}
\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'
\]

\end{document}

enter image description here

References

35

You may want to consult Dr. David J. Griffiths's web page at http://academic.reed.edu/physics/faculty/griffiths.html.

At the bottom of the page he provides a link "To create script-r in TeX:"

EDIT: There's often a little too much whitespace after the glyph. If you want to reduce this, you can crop it by using these macros instead of the ones Griffiths suggests:

\def\rcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics[trim= 1em 0 14em 0,clip]{ScriptR}}$}}}
\def\brcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics[trim= 1em 0 14em 0,clip]{BoldR}}$}}}
1
  • 2
    I'd add that using the macros (or at least \rcurs) in math mode in a section header doesn't work, but using it in math mode elsewhere does. It complains that Use of \refstepcounter@optarg doesn't match its definition. Has anyone else gotten that much to work?
    – jvriesem
    Commented Sep 1, 2015 at 23:31
11

If you are willing to use lualatex and unicode-math. At least you can get a free script font, XITS or Asana. They both have a script font and its bold version.

rsfs is a free script font. But there seems to be no bold version.

Any way the glyphs in XITS and Asana are not exactly what you want. But if you only want script fonts with bold version instead of exactly reproduce the look in that book, they should work.

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{XITS Math}

\def\az{abcdefghijklmnopqrstuvwxyz}
\def\AZ{ABCDEFGHIJKLMNOPQRSTUVWXYZ}

\begin{document}
  \begin{gather*}
    \mathscr{\az} \\
    \mathscr{\AZ} \\
    \mathbfscr{\az} \\
    \mathbfscr{\AZ}
  \end{gather*}
\end{document}

XITS scripts

8

In MathTime \mathbcal{\altr} gives:

Bold Script alternative r (MathTime)

But the font isn't free...

And, my opinion is, that alternative r on print, even in handwriting, doesn't read well.

2
  • Your opinion makes a good point - this is arguably not the best way to typeset an r, if you just want to have an r. But Griffith's book is so widely used that many physicists and physics students will recognize it as having a particular meaning (even if they may not immediately be able to parse it as an r), which is why it's a useful symbol to have available.
    – David Z
    Commented Jul 7, 2013 at 5:32
  • I am very interested on making this work. I tried and get this ! Undefined control sequence. \mathbcal Thanks Commented Mar 4, 2017 at 19:59
8

There is a script r in Free Serif

script r

but unfortunately it's not available as bold face. You can compile with XeLaTeX the following scriptr.tex file (Free Serif is included in TeX Live)

\documentclass{standalone}
\usepackage{fontspec}
\setmainfont{Free Serif}
\begin{document}
\char"1D4C7
\end{document}

so getting a scriptr.pdf file, and use

\newcommand{\scriptr}{\includegraphics{scriptr}}

in your document. Maybe some shift is needed.

8

Works in pdflatex:

\usepackage{calligra}

\DeclareMathAlphabet{\mathcalligra}{T1}{calligra}{m}{n}
\DeclareFontShape{T1}{calligra}{m}{n}{<->s*[2.2]callig15}{}
\newcommand{\scriptr}{\mathcalligra{r}\,}
\newcommand{\boldscriptr}{\pmb{\mathcalligra{r}}\,}

Usage:

$\scriptr$ or $\boldscriptr$

Output:

enter image description here

Source

2
  • how can I limit DeclareFontShape to \scriptr and not all texts with calligra font?
    – ar2015
    Commented Oct 31, 2017 at 0:01
  • Do you know if it is possible to have one symbol (or command) for the lowercase script symbols (like \scriptr in this example) but have it be sensitive to a bold environment, such as within \bm{}.
    – oliversm
    Commented Aug 19, 2019 at 13:13
7

I don't know if anyone is still looking for this, but I believe I have found the simplest solution. To produce the bold, script r, use the physymb package and the command (in math mode) \pmb{\scriptr}. It's italicized bold, but bold nonetheless.

1
  • It looks like physymb is no longer in some repositories. Commented Oct 20, 2020 at 4:47
4

You can also do this in the modern toolchain by loading any script font of your choice as \mathscr (as well as \mathcal, \mathbfscr, etc.)

In this case, I used a font called Parisienne. You might prefer a different one, but it will do for this example. (It looks too much like a dotless i to me and needs a little more space between r and c.) Existing script fonts were not intended for physics equations. Since it comes in only one weight, I used FakeBold for \mathbfscr.

\documentclass{book}
\usepackage[paperwidth=10cm]{geometry} % Solely to format a MWE on TeX.SX.
\usepackage[math-style=ISO]{unicode-math}

\defaultfontfeatures{Scale = MatchLowercase}
\setmainfont{TeX Gyre Pagella}
\setmathfont{Asana Math}
% Uses the Parisienne font from:
% https://www.fontsquirrel.com/fonts/parisienne
\setmathfont[range=scr]{parisienne-regular.ttf}
\setmathfont[range=bfscr, FakeBold=1.2]{parisienne-regular.ttf}

\newcommand\epsilonnought{\mupepsilon_0}
\newcommand\vectorsym[1]{\symbfup{#1}}
\newcommand\upc{\symup{c}}

\begin{document}
Calligraphic \(\symcal{r}\) and \(\symbfcal{r}\) versus
script \(\symscr{r}\) and \(\symbfscr{r}\).

\[ \nabla V = \frac{q \upc}{4 \muppi \epsilonnought}
              \frac{-1}{(\symscr{r} \upc -
                 \symbfscr{r} \cdot \vectorsym{v})^2}
              \nabla(\symscr{r} \upc -
                 \symbfscr{r} \cdot \vectorsym{v})
\]
\end{document}

Font sample

2

After struggling with this problem for years, I've decided to draw the glyphs using tikz so they could be manipulated as I'd like (boldface, etc). Here is an example of the code:

\documentclass[extrafontsizes, 60pt]{memoir} %makes fonts larger, so it is easier to see the glyphs
\usepackage{tikz} %tikz is used to draw the glyphs
\usetikzlibrary{arrows,scopes} %tikz libraries used to draw the glyphs

\usepackage[papersize={145mm,45mm},left=0.1ex, right=0.1ex]{geometry} %change paper size, so it is easier to see the glyphs

%defining script r (scalar)
\newcommand{\rc}{%
\resizebox{!}{1.25ex}{%
    \begin{tikzpicture}[>=round cap]
        \clip (0.09em,-0.05ex) rectangle (0.61em,0.81ex);
        \draw [line width=.11ex, <->, rounded corners=0.13ex] (0.1em,0.1ex) .. controls (0.24em,0.4ex) .. (0.35em,0.8ex) .. controls (0.29em,0.725ex) .. (0.25em,0.6ex) .. controls (0.7em,0.8ex) and (0.08em,-0.4ex) .. (0.55em,0.25ex);
    \end{tikzpicture}%
}%
}

%defining bold script r (vector)
\newcommand{\brc}{%
\resizebox{!}{1.3ex}{%
    \begin{tikzpicture}[>=round cap]
        \clip (0.085em,-0.1ex) rectangle (0.61em,0.875ex);
        \draw [line width=.2ex, <->, rounded corners=0.13ex] (0.1em,0.1ex) .. controls (0.24em,0.4ex) .. (0.35em,0.8ex) .. controls (0.29em,0.725ex) .. (0.25em,0.6ex) .. controls (0.7em,0.8ex) and (0.08em,-0.4ex) .. (0.55em,0.25ex);
    \end{tikzpicture}%
}%
}

%defining bold script r with a hat (unit vector)
\newcommand{\hrc}{\hat{\brc}}

\begin{document}
$\Huge\noindent \rc \brc \hrc$ %huge font size, so it is easier to see the glyphs
\end{document}

Compiling it will yield the following document:

Scriptr glyphs drawn with tikz

Of course, part of the previous code is dedicated simply to make the fonts larger (by the way, notice the drawings scale with ex, so they should scale with font size). A MWE would be

\documentclass{article}
\usepackage{tikz} 
\usetikzlibrary{arrows,scopes}

\newcommand{\rc}{%
\resizebox{!}{1.25ex}{%
    \begin{tikzpicture}[>=round cap]
        \clip (0.09em,-0.05ex) rectangle (0.61em,0.81ex);
        \draw [line width=.11ex, <->, rounded corners=0.13ex] (0.1em,0.1ex) .. controls (0.24em,0.4ex) .. (0.35em,0.8ex) .. controls (0.29em,0.725ex) .. (0.25em,0.6ex) .. controls (0.7em,0.8ex) and (0.08em,-0.4ex) .. (0.55em,0.25ex);
    \end{tikzpicture}%
}%
}

\newcommand{\brc}{%
\resizebox{!}{1.3ex}{%
    \begin{tikzpicture}[>=round cap]
        \clip (0.085em,-0.1ex) rectangle (0.61em,0.875ex);
        \draw [line width=.2ex, <->, rounded corners=0.13ex] (0.1em,0.1ex) .. controls (0.24em,0.4ex) .. (0.35em,0.8ex) .. controls (0.29em,0.725ex) .. (0.25em,0.6ex) .. controls (0.7em,0.8ex) and (0.08em,-0.4ex) .. (0.55em,0.25ex);
    \end{tikzpicture}%
}%
}

\newcommand{\hrc}{\hat{\brc}}

\begin{document}
$\rc \brc \hrc$
\end{document}

I'm still not quite happy with the hat version, so I might update it later. I'd be happy to hear any suggestions or improvements on this code.

2

The PDF file provided by Griffiths at http://academic.reed.edu/physics/faculty/griffiths/script_r.zip converted to SVG using https://cloudconvert.com/pdf-to-svg includes

@font-face {font-family:'LBVMPG+Kaufmann';

From this, it seems that the actual font that he uses for script r is Kaufmann. (I was not able to determine the meaning of LBVMPG.)

One may get a closer representation of the script r used by Griffiths by using the font metrics and the approach described in the accepted answer, which uses a calligraphic r.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .