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.

1 Answer 1

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}
5
  • 1
    Perhaps you could use \mathop so \Comma would behave as a math operator (like \cdot)? Commented Mar 8, 2012 at 3: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. Commented Mar 8, 2012 at 4:46
  • 2
    @GonzaloMedina \cdot is a \mathbin, not a \mathop.
    – egreg
    Commented Mar 8, 2012 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. Commented Mar 8, 2012 at 12:22
  • @GonzaloMedina: Updated to use \mathbin. Commented Mar 8, 2012 at 15:19

You must log in to answer this question.

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