I'm trying to make a slanted roman d
to use in math mode. Using How can I use the slanted variant of the libertine font? I've managed to get it to mostly work, but I don't know how to account for changes in math styles (normal/subscript etc.).
You can see the issue in the extra space after the \dd
in the subscript
I've tried using \count0=\fam
then \sbox{\diffdbox}{$\fam=\count0 \mathrm{d}$}
however that didn't change anytning. Would anybody have any ideas?
\documentclass{article}
\usepackage{mathtools}
\newsavebox\diffdbox
\newcommand{\dd}{%
\sbox{\diffdbox}{$\mathrm{d}$}%
\hskip\wd\diffdbox
\pdfsave%
\pdfsetmatrix{1 0 0.2 1}%
\mathllap{\mathrm{d}}%
\pdfrestore}
\begin{document}
\[
d \mathrm{d} d
\]
\[
d \dd d
\]
\[
x_{d \mathrm{d} d}
\]
\[
x_{d \dd d}
\]
\end{document}