3

I have a difficult to center the hat bold accent as in the Griffiths David's book as the picture below extract from the book:

enter image description here

My output using

\usepackage{baskervald}
\usepackage[baskervaldx]{newtxmath}

is different to the original picture of the book.

 \documentclass[12pt,a4paper,oneside]{book}
 \usepackage[lmargin=7cm,rmargin=.7cm,bmargin=2cm,marginparwidth=5.5cm,marginparsep=2em]{geometry}
    \usepackage{lipsum,sidenotes,tabularx}
    \reversemarginpar % Page margins
    \usepackage{graphicx} % Required for including pictures
    \usepackage{xcolor}
    \usepackage{baskervald}
    \usepackage[baskervaldx]{newtxmath}
    \usepackage[scr, scaled=1.1]{rsfso}
    \usepackage{bm}
    \usepackage{amsmath,amssymb}  
    \usepackage[italian]{babel}
    \usepackage[utf8]{inputenc} 
    \usepackage[T1]{fontenc} 
    \usepackage{mathtools}
    \usepackage{dsfont}
    \usepackage{mathrsfs}
    \usepackage{scalerel}


    %----------------------------------------------------------------------------------------
    %   r Griffiths, curls and fonts from mt2pro[lite]->pro
    %----------------------------------------------------------------------------------------


    \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}}$}}}
    \def\hrcurs{{\mbox{$\hat \brcurs$}}}
    \begin{document}
    \[V(\mathbf r)=\frac{1}{4\pi \epsilon_0}\int_{\mathcal V} \frac{\mathbf P(\mathbf r')\cdot \hrcurs}{\rcurs^2}d\tau'\]
    \end{document}

In fact my output is:

enter image description here

How should I fix the problem?

Sebastiano
  • 54,118
  • 1
    If you use characters then the font metrics help to align the accents and subscripts but as you are still arbitrarily using boxes to pull non-matching characters from other pdf files that becomes a lot harder. But even if you want different fonts why include the characters as images? – David Carlisle Jun 27 '18 at 21:24
  • So does it exist for the Griffiths book r the original character without adding it as an image? If I remember correctly on this site there was a link how to use the Griffiths r using the pictures. Verily for me without image is better. And then I would like to use other calligraphic characters that I need in addition to those of my code as in Figure 1. Thank you so much. – Sebastiano Jun 27 '18 at 21:35
  • you presumably had a font to make the pdfs? or have you just scanned a book to get them? – David Carlisle Jun 27 '18 at 21:43
  • so the fomt is Kaufmann-Bold which seems to be available from lots of places. – David Carlisle Jun 27 '18 at 21:52
  • Yes!!! https://fontzone.net/font-details/kaufmann-bold and normal do not exist? But how I must use it into my code + other calligraphic font? – Sebastiano Jun 27 '18 at 21:57
  • what do you mean by "the font does not exist"? You just gave a link to it? – David Carlisle Jun 27 '18 at 21:59
  • 3
    well you must be able to buy kaufmann and kaufmann-Bold together (the ScriptR.pdf uses kaufmann), but as I have said 10001 times before there really is no reason to use some non standard font here, it's just a fairly standard script font and its bold version, you could use stix for example which is already set up for tex and includes script characters. – David Carlisle Jun 27 '18 at 22:10
  • Could you please add a full answer by varying my source with your suggestion for stix fonts? But to have that kind of calligraphic "V" of the first image, can you do something? Thank you as always. – Sebastiano Jun 27 '18 at 22:18
  • 2
    You can grab a snippet from David Griffith's homepage: http://www.reed.edu/physics/faculty/griffiths.html (Ctrl+F script) It's all the way at the bottom. – Henri Menke Jul 01 '18 at 22:14
  • Thank you very much for your comment. But couldn't you give me an answer before? :-) I did the compilation of the test file but the hat is not exactly like the one in the book. In my opinion there is a difference between the pdf sources https://tex.stackexchange.com/questions/21274/script-r-symbol) I have and the one of the site that you inserted in the link. The hat is not quite as bold as in the original book. – Sebastiano Jul 01 '18 at 22:32
  • @HenriMenke I'd be delighted if you could give me an answer on how to put the bold accent on bold r (first image). Thanks. – Sebastiano Jul 01 '18 at 22:43
  • Possible duplicate of Script-r Symbol – TeXisFun Jul 01 '18 at 22:45
  • @TeXisFun My question there is not a duplicate. Can you reproduce the bold accent on bold r exactly like the first picture? Have you seen the my output (2nd figure) that is different? Thank you. – Sebastiano Jul 01 '18 at 22:48

4 Answers4

3

I'd be inclined to use stix2 which has a wide range of times-compatible alphabets already set up including script and bold script

enter image description here

\documentclass[12pt,a4paper,oneside]{book}


%----------------------------------------------------------------------------------------
%   VARIOUS REQUIRED PACKAGES AND CONFIGURATIONS
%----------------------------------------------------------------------------------------
\usepackage[lmargin=7cm,rmargin=.7cm,bmargin=2cm,marginparwidth=5.5cm,marginparsep=2em]{geometry}
\usepackage{lipsum,sidenotes,tabularx}
\reversemarginpar % Page margins
\usepackage{graphicx} % Required for including pictures
\usepackage{xcolor}


%----------------------------------------------------------------------------------------
%   FONTS
%----------------------------------------------------------------------------------------

\usepackage[full]{textcomp}
\usepackage{baskervald}

% you could consider using stix rather than newtxmatn
%\usepackage[baskervaldx]{newtxmath}


%\usepackage{bm}
\usepackage{amsmath,amssymb}  
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{mathtools}

%using stix double struck for consistency
% \usepackage{dsfont}

% you can't want rsfso and mathrsfs (which are basically the same thing)
% but here I use stix script anyway
%%\usepackage[scr, scaled=1.1]{rsfso}
%% \usepackage{mathrsfs}

\usepackage{scalerel}
%\usepackage{amsthm}

\usepackage{stix2}
%----------------------------------------------------------------------------------------
%   bracket
%----------------------------------------------------------------------------------------

\usepackage{braket}

%----------------------------------------------------------------------------------------
%   cancel
%----------------------------------------------------------------------------------------
\usepackage{cancel}


%----------------------------------------------------------------------------------------
%   r Griffiths, curls and fonts from mt2pro[lite]->pro
%----------------------------------------------------------------------------------------


\def\rcurs{\mathscr{r}}
\def\brcurs{\mathbfscr{r}}
\def\hrcurs{\hat{\brcurs}}


\begin{document}
\[V(\mathbf{r})=\frac{1}{4\pi \epsilon_0}\int_{\!\!\mathscr{V}}\!
\frac{\mathbf{P}(\mathbf{r}')\cdot \hrcurs}{\rcurs^2}d\tau'\]
\end{document}
David Carlisle
  • 757,742
3
\documentclass{article}

%% Preamble
\ifdefined\pdfliteral
    \let\griffPdfliteral\pdfliteral
\else \def\griffPdfliteral#1{\special{pdf: literal #1}} \fi

\newcommand\griffr[1][2]{\leavevmode\hbox{\kern1pt\vbox to1ex{}\griffPdfliteral{%
    q 1 J .27 0 0 .27 0 0 cm #1 w
    0 2 m
    0 2 8.1 9.7 9.2 13.2 c
    10.4 16.8 8.4 15.4 8 14.7 c
    7.6 14 6.8 12.6 12 13 c
    17 13.5 14.5 7.8 13.7 6 c
    12.8 4.3 10.3 1.2 11.4 .2 c
    12.6 -.7 18.8 3.6 18.8 3.6 c
    18.8 3.6 l S Q
}\kern6pt}}
\newcommand\hatgriffr{\skew3\hat{\griffr}}

%% Body
\begin{document}
    A$\hatgriffr$B\griffr[0.5]C\griffr[3]D
\end{document}

Output

However, the values have to be manually adjusted to scale to surrounding text.

plante
  • 1,349
3

The OP's general idea is sound and workable, though it does leave the symbol represented as a rastor image. However, the use of trim on a regularly recurring symbol I do not find advisable. I merely did a screen grab of the OP's symbol (regular and bold as scriptr.jpg and scriptrb.jpg) and trimmed them closely in an editor and saved them directly.

Then, the definitions, without the trimming, become

\def\rcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics{scriptr}}$}}}
\def\brcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics{scriptrb}}$}}}
\def\hrcurs{{\mbox{$\hat \brcurs$}}}

Done this way, the hat has no problem centering better (though the code does complain of \Bbbk being already defined, which I did not address):

\documentclass[12pt,a4paper,oneside]{book}
\usepackage[lmargin=7cm,rmargin=.7cm,bmargin=2cm,marginparwidth=5.5cm,marginparsep=2em]{geometry}
\usepackage{lipsum,sidenotes,tabularx}
\reversemarginpar % Page margins
\usepackage{graphicx} % Required for including pictures
\usepackage{xcolor}
\usepackage{baskervald}
\usepackage[baskervaldx]{newtxmath}
\usepackage[scr, scaled=1.1]{rsfso}
\usepackage{bm}
\usepackage{amsmath,amssymb}  
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{mathtools}
\usepackage{dsfont}
\usepackage{mathrsfs}
\usepackage{scalerel}

%---------------------------------------------------------------------------------------- % r Griffiths, curls and fonts from mt2pro[lite]->pro %----------------------------------------------------------------------------------------

\def\rcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics{scriptr}}$}}} \def\brcurs{{\mbox{$\resizebox{.09in}{.08in}{\includegraphics{scriptrb}}$}}} \def\hrcurs{{\mbox{$\hat \brcurs$}}} \begin{document} [V(\mathbf r)=\frac{1}{4\pi \epsilon_0}\int_{\mathcal V} \frac{\mathbf P(\mathbf r')\cdot \hrcurs}{\rcurs^2}d\tau'] \end{document}

enter image description here

3

Since your MWE did not compile for me, I substituted the French Cursive font from the frcusrive package (and also set the math alphabets with mathalpha.)

\documentclass[12pt,a4paper,oneside]{book}
\tracinglostchars=2
\usepackage[lmargin=7cm,rmargin=.7cm,bmargin=2cm,marginparwidth=5.5cm,marginparsep=2em]{geometry}
%\usepackage{lipsum,sidenotes,tabularx}
\reversemarginpar % Page margins
\usepackage{graphicx} % Required for including pictures
\usepackage{xcolor}
\usepackage{amsmath, mathtools}  
\usepackage{baskervald}
\usepackage[baskervaldx]{newtxmath}
\usepackage[bb=dsserif, scr=rsfso]{mathalpha}
\usepackage{bm}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
%----------------------------------------------------------------------------------------
%   r Griffiths, curls and fonts from mt2pro[lite]->pro
%----------------------------------------------------------------------------------------


% \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}}$}}} % \def\hrcurs{{\mbox{$\hat \brcurs$}}}

% Substitute french Cursive font for script r: \newcommand\rcurs{\text{\usefont{T1}{frc}{m}{sl}r}} \newcommand\brcurs{\text{\usefont{T1}{frc}{bx}{sl}r}} \newcommand\hrcurs{\boldsymbol{\hat{\brcurs}}}

\begin{document}
\[V(\mathbf r)=\frac{1}{4\pi \epsilon_0}\int_{\mathcal V} \frac{\mathbf P(\mathbf r')\cdot \hrcurs}{\rcurs^2}d\tau'\]
\end{document}

Baskervald + bewtx + frcursive sample

This isn’t perfect, but does give you the script r in a scalable font. If you’re willing to switch to unicode-math (which, if your goal is to duplicate the appearance of a book typeset with classic LaTeX, you probably aren’t), you will have many more options.

To fine-tune the position of a math accent, use the command \skew. This definition of \hrcurs shifts the hat to the right:

\documentclass[12pt,a4paper,oneside]{book}
\tracinglostchars=2
\usepackage[lmargin=7cm,rmargin=.7cm,bmargin=2cm,marginparwidth=5.5cm,marginparsep=2em]{geometry}
%\usepackage{lipsum,sidenotes,tabularx}
\reversemarginpar % Page margins
\usepackage{graphicx} % Required for including pictures
\usepackage{xcolor}
\usepackage{amsmath, mathtools}  
\usepackage{baskervald}
\usepackage[baskervaldx]{newtxmath}
\usepackage[bb=dsserif, scr=rsfso]{mathalpha}
\usepackage{bm}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}
%----------------------------------------------------------------------------------------
%   r Griffiths, curls and fonts from mt2pro[lite]->pro
%----------------------------------------------------------------------------------------


% \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}}$}}} % \def\hrcurs{{\mbox{$\hat \brcurs$}}}

% Substitute french Cursive font for script r: \newcommand\rcurs{\text{\usefont{T1}{frc}{m}{sl}r}} \newcommand\brcurs{\text{\usefont{T1}{frc}{bx}{sl}r}} \newcommand\hrcurs{\boldsymbol{\skew{4}{\hat}{\brcurs}}}

\begin{document}
\[V(\mathbf r)=\frac{1}{4\pi \epsilon_0}\int_{\mathcal V} \frac{\mathbf P(\mathbf r')\cdot \hrcurs}{\rcurs^2}d\tau'\]
\end{document}

Exaple with \skew

Davislor
  • 44,045