1

I recently discovered the diffcoef package and the power of xtemplate. The first one encompasses almost everything I was doing with personal macros for derivative operators.

However, I was wondering if it is possible to simply tune the command \diffp to obtain a compact version of the derivative operator, where the denominator is subscripted instead.

Here is a MWE, where the right hand side of the equation should look like the left hand side:

\documentclass{article}

\usepackage{diffcoeff}

\begin{document}

    \diffdef{p}{ % Something that should remove the fraction style
        op-symbol = \partial,
        op-symbol-alt = none
        }
    \begin{equation}
        \partial_x f= \diffp*{f}{x} % now the LHS and RHS are different...
    \end{equation}
\end{document}

Of course the purpose is not to do something like \newcommand{\diff2}[2]{\dlp_{#1}#2} because I would like to retain the flexibility of the diffcoef package. For example, I also wish to be able to write with the same command:

\partial_{\frac{1}{b}}^{z}\partial_{xy}^{z-1}a=\diffp[z,z-1]{a}{\frac{1}{b},xy}

So is it possible to remove the fraction style of the \diffp command with diffcoef? If not, is it possible to implement a new command, which maintains the syntax and flexibility of \diffp (perhaps via xtemplate)?

2 Answers 2

1

The derivative might have the functionality you seek with it's \pdif command. The package uses a key-value interface for setting options. This can be done on a individual basis that only apply to a single differential/derivative e.g. \pdif[key-value]{x,y,z}. One can also set the options for all differentials /derivatives with \derivset{\MacroName}[key-value], with \MacroName being \pdif, \pdv or other derivatives/differentials defined by the packages or you.

\documentclass{article}
\usepackage{amsmath}
\usepackage{derivative}
\begin{document}
    \begin{align}
        \pdif[order={z,z-1}]{\frac{1}{b},xy}  a \\
        \pdif*[order={z,z-1}]{\frac{1}{b},xy} a \\
        \pdif[style-notation=single, order={z,z-1}]{\frac{1}{b},xy} a \\
        \pdif[style-notation=multiple, order={z,z-1}]{\frac{1}{b},xy} a \\
        \pdif[style-notation=mixed, order={z,z-1}]{\frac{1}{b},xy} a \\
    \end{align}
\end{document}

Alternatively, if one wants other macros names for them, I suggest defining new ones with the commands in section 5 of the documentation.

enter image description here

2
  • As I understand, the variable a in you answer is not really catch by the command, because it is not suppose to receive quantity to derive. As example, you can not give the option fun to the command \pdif because it does not expect a second mandatory argument. This is why I think it should more be a \pdv option: something like \pdv[style=compact]{a}{b}. Are you derivative author ? If yes, I can give more details on github and maybe help the implementation, if you want.
    – R. N
    Commented Jul 28, 2022 at 21:02
  • @R.N Yes, I'm the author of the package and you are welcome to contact me on github or by email. I implemented the single and mixed options specifically for this purpose you want. I didn't consider it crucial to grab the function, and I don't think an implementation through \pdv and friends would be good. Lets take the discussion of implementation on github/email.
    – Simon
    Commented Jul 29, 2022 at 16:19
1

I believe the package defines \dl.p. and \dlp to write partial differential. From what I understand from the documentation, when you use \diffdef{variant}{key-value} you define both \diff.variant. and \dl.variant.. Then it is just a matter of defining \NewDocumentCommand\SomeOtherName{}{ \diff.variant. } if you don't want to use dots.

\documentclass{article}
\usepackage{amsmath}
\usepackage{diffcoeff}
\begin{document}
    \begin{align}
        \dl.p.{x} \dlp{x} \\
        \dl.p._{x} \dlp_{x}
    \end{align}
\end{document}

enter image description here

Alternatively, there are other packages with these features as well.

2
  • @R.N I don't think diffcoeff support that functionality you seek, I'm afraid. You may want to take a look at the derivative package, which have this functionality, but implemented slightly different. It is a flexible package with similar features.
    – Simon
    Commented Jul 28, 2022 at 9:08
  • Thank you for your suggestion about derivative package, I did not know it. Indeed, diffcoeff and derivative seems to have very similar features. However, from what I understood from the doc, the same distinction between \diffp and \dlp (diffcoeff) remains true between \pdv and \pdif (derivative). Therefore, if you can propose a solution using derivative package with \pdv command, I would accept it.
    – R. N
    Commented Jul 28, 2022 at 12:55

You must log in to answer this question.

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