3

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?

7
  • Where do you want it to use \dfrac? It does so in display style \[...\].
    – Werner
    Commented Jan 23, 2012 at 5:10
  • Most of my equations are in align environments. I use this by default. Should I be using something else?
    – mankoff
    Commented Jan 23, 2012 at 6:08
  • So am I right in assuming you are interested in having more control over using \dfrac and \tfrac, and not necessarily an explanation of why this is the case. Are you interested in a redefinition that uses (say) starred \od*/\pd* for \dfrac usage, and \od/\pd for the \tfrac usage?
    – Werner
    Commented Jan 23, 2012 at 6:34
  • I guess I'm looking for both... The normal size fractions look better to me, so I'd like to use them with the simpler forms provided by commath. I can redefine the commands myself. I'm wondering if there is some way to do this for commath via an option that I've missed. At the same time, if I'm breaking a standard, I'd be happy for an explanation why I should be happy with it the way it is, and that I should change all my existing \frac to \dfrac or \tfrac instead...
    – mankoff
    Commented Jan 23, 2012 at 6:45
  • Similarly, why does commath use one font for \[ environments, and another for \begin{align}. Aren't they similar enviroments? I understand the difference for $ and \( compared to \[.
    – mankoff
    Commented Jan 23, 2012 at 6:46

1 Answer 1

4

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.

3
  • Can you explain the difference between the "Normal" version and the "textstyle" (t) version? It took some serious squinting before I even noticed a difference. Commented Jun 26, 2013 at 21:41
  • @TysonWilliams: There is no difference. Perhaps what you see is an artefact from my viewer during the screen grab. \tfrac is a forced \textstyle\frac, while \dfrac is a forced \displaystyle\frac. The "normal" \frac is either \textstyle or \displaystyle, depending on the style it is used in. The same holds for the *-\od family above.
    – Werner
    Commented Jun 26, 2013 at 21:44
  • while \frac switches behaviour between displaystyle and textstyle \od (like almost all commath commands) is broken in that respect and does not usefully switch, only the forced \tod and \dod versions are really useful. (The comath commands all use \ifinner to switch between display and text style versions but that is not a useful test in math mode) Commented Feb 23, 2018 at 11:02

You must log in to answer this question.

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