3

I have the following minimal example, which fails on the second equation:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{cool}
\begin{document}

\begin{equation}
    \pderiv{f}{x}
\end{equation}
\begin{equation}
    \pderiv{f}{\tilde{x}}
\end{equation}

\end{document}

Is this a bug in the cool package? Is there a workaround?

1
  • 1
    I don't think it is a bug exactly. This just isn't supported. The package was intended to be extensible, I think, via an optional configuration file. However, that functionality was marked to be added in a future release. More than a decade on, I guess its author has moved on. You could try emailing to ask about the possibility of getting 'style file' support, but, if you want to use this, you either have to avoid unrecognised macros in maths or extend it yourself, I think. Looks like a lot of work to me, but not particularly complicated. Just look at the .sty and copy the patterns.
    – cfr
    Sep 5, 2017 at 1:38

1 Answer 1

3

The problem is, that \pderiv fully expands its argument somewhere deep down in the package. I haven't tried to track it down, but you simply work around it by storing the arguments to the derivative in unexpandable macros.

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{cool}

\begin{document}

\begin{equation}
    \pderiv{f}{x}
\end{equation}

\protected\def\tildex{\tilde{x}}
\begin{equation}
    \pderiv{f}{\tildex}
\end{equation}

\end{document}
1
  • I think the package is trying to automatically compute exponents for higher derivatives, so it has to massage the arguments in such a way that fragile command are not allowed.
    – egreg
    Dec 23, 2017 at 9:14

You must log in to answer this question.

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