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

  • I just realized that \mathrm works fine. But why is there a problem with \text? – user1577636 May 10 '14 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. – Paul Gessler May 10 '14 at 15:15
  • See also tex.stackexchange.com/a/19503/21344 – Paul Gessler May 10 '14 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$. – Gonzalo Medina May 10 '14 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 May 10 '14 at 16:34
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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