17

What is the \cdot alternative for comma, or any other punctuation symbol? I want to raise comma symbol in a list of fractions to the fraction line. Comma is placed below when used next to fraction.

lockstep
  • 250,273
user9452
  • 171
  • 1
  • 1
  • 3

1 Answers1

20

You can use \raisebox to move it where you want. Here is a comparison of the inline \frac and the displaystyle \dfrac. Based on @GonzaloMedina's suggestions I have provided two versions, each which provides slightly different spacing around the comma:

  • one that uses \mathbin (spacing similar to \cdot) and
  • another that uses \mathpunct (spacing more like a punctuation)

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\CommaBin}{\mathbin{\raisebox{0.5ex}{,}}} \newcommand{\CommaPunct}{\mathpunct{\raisebox{0.5ex}{,}}} \begin{document}

\verb|\mathbin|: $\frac{1}{2} \CommaBin \frac{3}{4} \CommaBin \dfrac{1}{2} \CommaBin \dfrac{3}{4}$

\bigskip \verb|\mathpunct|: $\frac{1}{2} \CommaPunct \frac{3}{4} \CommaPunct \dfrac{1}{2} \CommaPunct \dfrac{3}{4}$ \end{document}

Peter Grill
  • 223,288
  • 1
    Perhaps you could use \mathop so \Comma would behave as a math operator (like \cdot)? – Gonzalo Medina Mar 08 '12 at 03:58
  • 2
    Sorry to bother you again, but now that I've reread the OP's question, perhaps he/she wants the vertically centered comma to act as a punctuation symbol instead of an operator; if this is the case, \mathpunct would be better than \mathop. Since the intent is not clear (at least to me) you could suggest both options. – Gonzalo Medina Mar 08 '12 at 04:46
  • 2
    @GonzaloMedina \cdot is a \mathbin, not a \mathop. – egreg Mar 08 '12 at 10:08
  • @PeterGrill: it's me again. egreg is right; \cdot is defined as a binary symbol, not as an operator, so it should be \mathbin instead of \mathop. – Gonzalo Medina Mar 08 '12 at 12:22
  • @GonzaloMedina: Updated to use \mathbin. – Peter Grill Mar 08 '12 at 15:19