Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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}
share|improve this answer
1  
Perhaps you could use \mathop so \Comma would behave as a math operator (like \cdot)? –  Gonzalo Medina Mar 8 '12 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. –  Gonzalo Medina Mar 8 '12 at 4:46
2  
@GonzaloMedina \cdot is a \mathbin, not a \mathop. –  egreg Mar 8 '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 8 '12 at 12:22
    
@GonzaloMedina: Updated to use \mathbin. –  Peter Grill Mar 8 '12 at 15:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.