11

In exploring options for typesetting derivatives I came across the cool package. But a basic example from Page 22 of the Content Oriented LaTeX documentation (October 7, 2006) seems to result in the error:

 Missing \endcsname inserted.
  <to be read again> 
                \toks@ 

Uncommenting the line in the MWE below yields the above error. As is, the MWE produces:

enter image description here

References:

  • Can I have a flexible partial derivative macro? I would prefer to use one of the solutions mentioned here as they do not require another package, but the syntax proposed here is different that the cool package. This is problematic in that if I later need the flexibility provided by the the cool package will not be as easy to switch.

Code

\documentclass{article}
\usepackage{amsmath}
\usepackage{cool}
\begin{document}
\begin{align*}
    \D[1]{f}{x,y,z} &= \cdots\\
    %\D[2,n,3]{f}{x,y,z} &= x
\end{align*}
\end{document}
5
  • I can't help you. But I want to say that I think it's easier to create an own command based on LaTeX3. Commented May 4, 2012 at 18:11
  • 1
    Also note that according to ISO 31/XI the differential operator should be upright.
    – Waldheri
    Commented May 4, 2012 at 18:46
  • @MarcoDaniel: That would be acceptable, but would prefer that they use a similar syntax as the cool package in case I need to switch at some later date. The question I linked to provides some nice options, but with a different syntax. Commented May 4, 2012 at 19:14
  • 1
    @Waldheri: Besides the minor issue like not working :-), that is one of the things I don't like about the cool package. But, I assume that there is probably a way to patch that as well. Commented May 4, 2012 at 19:15
  • Copying one of the doc examples produces errors. I don't have here older TeX Live versions to test, but the error is the same with TeX Live 2010.
    – egreg
    Commented May 4, 2012 at 19:39

2 Answers 2

9

This is a bug in the cool package v1.35 (2006/12/29). Lines 2056 to 2063 read

\whiledo{ \boolean{COOL@isint} \AND
\NOT \value{COOL@multideriv}>\value{COOL@ct}  }%
{%
\def\COOL@tempd%
{\csname COOL@deriv@powers@\roman{COOL@multideriv}\endcsname}%
\isint{\COOL@tempd}{COOL@isint}%
\stepcounter{COOL@multideriv}%
}

The \def (line 2059) must be an \edef. After changing it (in a local copy, of course) the MWE ran without errors.

BTW: the style of the “d” can be changed through:

\Style{DSymb={\mathrm d}}
6
  • Brilliant! Ages ago (I think after reading the question that Peter links to), I tried the cool package, ran into a problem, and gave up. Looking at my test file, I appear to have gotten stuck with commands of the form \COOL@deriv@powers@ii not being defined which looks extremely like what this fixes. Looks like cool might just be cool again. Commented May 4, 2012 at 20:28
  • @AndrewStacey Unfortunately there doesn't seem to be a contact address to send a bug report to :(
    – cgnieder
    Commented May 4, 2012 at 20:48
  • @cgnieder: Google led me to the author's website, where he explains how to write his email address. Commented Mar 6, 2013 at 3:30
  • @MatthewLeingang Curious... I was sure I tried google, too. Anyway, thanks! I'll contact him.
    – cgnieder
    Commented Mar 6, 2013 at 7:34
  • @cgnieder: I'm sure you did, too. I used keywords n setzer cool latex and that led me to nsetzer.com. I'm not sure how active he is...the site has not been updated in a while. If he's not responsive I believe there is a CTAN process for taking over maintenance. Commented Mar 6, 2013 at 14:12
2

I use the following macro to set multiple partial derivatives:

\newcommand*\mdiff[3]{\frac{\partial^{#2}{#1}}{\pABLN{#3}}}
\newcounter{pABLCounter}
\def\pABLN#1{\setcounter{pABLCounter}{1}\xpABLN#1;pABLEnde;}
\def\pABLEnde{pABLEnde}
\def\xpABLN#1;{\def\temp{#1}%
  \ifx\temp\pABLEnde
  \else 
    \stepcounter{pABLCounter}
    \ifodd \value{pABLCounter} 
      \if1#1\,\else {{}^{#1}\,}\fi%
      \else{\partial{#1}}% 
    \fi %
    \expandafter\xpABLN
  \fi  
}

to set in your case:

\mdiff{f}{3}{x;1;y;1;z;1}

other possibilities are:

\mdiff{f}{5}{x;1;z;4}

giving \frac{\partial^5f}{\partial x\partial z^4}.

If you really want d instead of \partial just replace it in the code.

2
  • Can you not improve you macro to require only 2 argument? The second argument can be computed from the third 3. This would surely make it less error prone.
    – Walter
    Commented May 13, 2012 at 17:05
  • @Walter but then I coudn't write things like \mdiff{f}{m+n}{x;m;y;n} Commented May 13, 2012 at 20:02

You must log in to answer this question.

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