5

I have an equation within the statement of one of my theorems. Within this equation, I have some text to name a function. However, when this equation appears within the theorem environment, the output treats each letter of my function name as though it were a variable. How can I fix this?

\documentclass[11pt]{article}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}

\begin{document}

$\text{Function}(x) = 1$

\begin{theorem}
$\text{Function}(x) = 1$
\end{theorem}

\end{document}

output

10
  • I just realized that \mathrm works fine. But why is there a problem with \text? Commented May 10, 2014 at 15:15
  • 6
    This is the expected functionality since text within theorem environments is set in italics. The \text command from amsmath matches the local text font. Commented May 10, 2014 at 15:15
  • See also tex.stackexchange.com/a/19503/21344 Commented May 10, 2014 at 15:17
  • 3
    A better option, giving also better spacing, is to say \DeclareMathOperator{\Func}{Function} in the preamble and then $\Func(x) = 1$. Commented May 10, 2014 at 15:22
  • 2
    I agree with Gonzalo Medina. However if you want to stick to \text, you should use \textup. \mathrm will give you a letter spacing as though they were the variables F, u, n, c, &c.
    – Bernard
    Commented May 10, 2014 at 16:34

1 Answer 1

3

\text honors the surrounding font. A better approach to get the desired font and the proper spacing is to use \DeclareMathOperator:

\documentclass[11pt]{article}
\usepackage{amsmath}

\newtheorem{theorem}{Theorem}
\DeclareMathOperator{\Func}{Function}

\begin{document}

$\text{Function}(x) = 1\quad\Func(x) = 1$

\begin{theorem}
$\text{Function}(x) = 1\quad\Func(x) = 1$
\end{theorem}

\end{document}

enter image description here

You must log in to answer this question.

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