24

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.

  • 5
    For what it's worth: I'm the maintainer of physymb and I spent quite some time searching to find an accurate rendering of that symbol - obviously, with no exact success. So I share your disappointment that the Calligra fonts don't exactly reproduce the character. But I'll stay tuned to this question in case someone comes up with a replacement (that is LPPL-compatible). – David Z Jul 7 '13 at 5:28
2

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

18

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
    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 Sep 1 '15 at 23:31
8

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

5

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.

  • 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 Jul 7 '13 at 5:32
  • I am very interested on making this work. I tried and get this ! Undefined control sequence. \mathbcal Thanks – Herman Jaramillo Mar 4 '17 at 19:59
5

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.

4

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.

3

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

  • how can I limit DeclareFontShape to \scriptr and not all texts with calligra font? – ar2015 Oct 31 '17 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 Aug 19 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.