定理環境中 \text 失敗

定理環境中 \text 失敗

我在我的一個定理的陳述中有一個方程式。在這個方程中,我有一些文字來命名一個函數。但是,當方程式出現在定理環境中時,輸出會將函數名稱的每個字母視為變數。我怎樣才能解決這個問題?

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

\begin{document}

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

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

\end{document}

輸出

答案1

\text尊重周圍的字體。獲得所需字體和適當間距的更好方法是使用\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}

在此輸入影像描述

相關內容