Is there any command for typesetting constants in mathematical formulas? I would imagine something similar to \operatorname or \DeclareMathOperator, but for constants.

I want the constant to be typeset in roman font as in the text mode (with proper spacing and ligatures - this concerns constants denoted by a couple of letters).

  • 4
    the usual advice is to use \mathrm{...}. Aug 6, 2014 at 14:40
  • Use siunitx package.
    – skpblack
    Aug 6, 2014 at 15:23
  • @DCh -- that's funny. with this test, the two commands produce exactly the same result, with ligatures: \[ x\ \mathrm{iff}\ y\ \textup{iff}\ z_{\textup{iff}}^{\mathrm{iff}} \]. \mathrm is also what's documented in lamport's latex manual. (it can be used only in math mode, but it behaves the same as text roman; there's a reason for using \math... commands instead of \text... commands in math mode. \text... commands should be used in math only within \text{...} according to all the documentation i've read.) Aug 6, 2014 at 16:30
  • @barbara Interesting, maybe depends on typeface used.. The following demonstrates different outputs (pdflatex): \DeclareSymbolFont{AMSb}{U}{msb}{m}{n} % fix [noamsfonts] bug \documentclass[noamsfonts]{amsart} \usepackage[bitstream-charter]{mathdesign} \begin{document} \[ x\ \mathrm{fin}\ y\ \textup{fin} \] \end{document}
    – DCh
    Aug 6, 2014 at 16:50

1 Answer 1


(updated to incorporate the comments by @egreg, barbara beaton, and @DCh)

I assume your document uses a roman (serif) font rather than a sans-serif font for mathematics. To ensure that constants are typeset consistently using upright Roman letters, it's handy to create a dedicated macro named, say, \ct that uses the following macros in a nested fashion: \text (from the amsmath package), \rmfamily(just in case the surrounding material is non-roman), and \upshape.

\newcommand\ct[1]{\text{\rmfamily\upshape #1}}

Then, use this macro to typeset an equation such as


Suppose, furthermore, that your documents contains two frequently-occurring constants named ab-cd and fi-fi. (You did say that the names of the constants might contain ligatures...) To help speed up typing, you could define two macros \abcd and \fifi as follows:


The result of a full MWE:

enter image description here

\documentclass[noamsfonts]{amsart}  \usepackage[bitstream-charter]{mathdesign}

%% use the \ct macro to define math constants
\newcommand\ct[1]{\text{\rmfamily\upshape #1}}

%% define two math constants with rather contrived names...

\sffamily  % switch to sans-serif for main text font


not in math mode: ab-cd, fi-fi
  • \mathrm, not \textup.
    – egreg
    Aug 6, 2014 at 16:53
  • In case of a sans serif or small caps context, \textup would respect it, while \mathrm wouldn't.
    – egreg
    Aug 6, 2014 at 16:59
  • @egreg -- try the test provided in the second comment by DCh to the question. (i just did.) indeed, as he claims, the results are different -- i suspect he's right that it may depend on what fonts are being used, because i can't think of any other reason. (i tried it with both amsart and article to make sure the former wasn't a factor.) Aug 6, 2014 at 17:03
  • 1
    @egreg -- but the ligatures are made with \mathrm when computer modern is used. that may be unexpected, but when i checked several other strings, including "ffl", the ligatures are clearly present. Aug 6, 2014 at 17:17
  • 2
    @DCh - Instead of "reopening" this four-year-old question -- sadly, very few people will notice that you did so (mainly by revoking the previously-awarded "accept" badge, right?) -- it would have been better if you had posted a new question. The issue you've encountered appears to be sufficiently distinct to merit being raised in a new question; that way, far more people will get to see it and have a chance to think about providing an answer.
    – Mico
    Aug 17, 2018 at 21:29

You must log in to answer this question.

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