Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
I can't help you. But I want to say that I think it's easier to create an own command based on LaTeX3. –  Marco Daniel May 4 '12 at 18:11
1  
Also note that according to ISO 31/XI the differential operator should be upright. –  Waldheri May 4 '12 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. –  Peter Grill May 4 '12 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. –  Peter Grill May 4 '12 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 May 4 '12 at 19:39
add comment

2 Answers

up vote 8 down vote accepted

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}}
share|improve this answer
    
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. –  Loop Space May 4 '12 at 20:28
    
@AndrewStacey Unfortunately there doesn't seem to be a contact address to send a bug report to :( –  cgnieder May 4 '12 at 20:48
    
@cgnieder: Google led me to the author's website, where he explains how to write his email address. –  Matthew Leingang Mar 6 '13 at 3:30
    
@MatthewLeingang Curious... I was sure I tried google, too. Anyway, thanks! I'll contact him. –  cgnieder Mar 6 '13 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. –  Matthew Leingang Mar 6 '13 at 14:12
show 1 more comment

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.

share|improve this answer
    
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 May 13 '12 at 17:05
    
@Walter but then I coudn't write things like \mdiff{f}{m+n}{x;m;y;n} –  Peter Breitfeld May 13 '12 at 20:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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