# Failure of \text within theorem environment

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}


• I just realized that \mathrm works fine. But why is there a problem with \text? – user1577636 May 10 '14 at 15:15
• This is the expected functionality since text within theorem environments is set in italics. The \text command from amsmath matches the local text font. – Paul Gessler May 10 '14 at 15:15
• – Paul Gessler May 10 '14 at 15:17
• A better option, giving also better spacing, is to say \DeclareMathOperator{\Func}{Function} in the preamble and then $\Func(x) = 1$. – Gonzalo Medina May 10 '14 at 15:22
• 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 May 10 '14 at 16:34

\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}