[Tex/LaTex] commath, \dfrac and \tfrac

fontsizefractionsmath-mode

I'm using the commath package for its nice \od and \pd functions, but I find it uses \tfrac internally. It seems to have an 'if-then' clause to sometimes use \dfrac but it never does so in my tests:

test 1: \od{p}{x}\\
test 2: $\od{p}{x}$
test 3: \(\od{p}{x}\)

Or in align environments either. I don't see any options to control the package behavior. Should I just re-define \od and \pd in my preamble to behave the way I want?

Best Answer

commath provides \textstyle and \displaystyle versions of its \od and \pd (and \md) commands:

  • \textsyle override: \tod and \tpd
  • \displaystyle override: \dod and \dpd

textstyle and displaystyle overrides for \od nad \pd

\documentclass{article}
\usepackage{commath}% http://ctan.org/pkg/commath
\begin{document}
\verb|Normal:| \par
test 1: \od{p}{x} \par
test 2: $\od{p}{x}$ \par
test 3: \(\od{p}{x}\) \par

\bigskip

\verb|\textstyle-version:| \par
test 1: \tod{p}{x} \par
test 2: $\tod{p}{x}$ \par
test 3: \(\tod{p}{x}\) \par

\bigskip

\verb|\displaystyle-version:| \par
test 1: \dod{p}{x} \par
test 2: $\dod{p}{x}$ \par
test 3: \(\dod{p}{x}\) \par
\end{document}

It would be possible to define your own commands doing the same with a slightly different interface (using xparse, say) that could allow you some flexibility.