我最近了解到\begin{proof} ... \end{proof}
,这是一个很好的工作环境。我的问题是是否存在类似的环境来陈述问题或者我是否可以自己编写一些类似命令。理想情况下,我想要这样的命令:
\begin{problem} Prove that $2+2 = 4$. \end{\problem}
然后它应该输出类似这样的内容:
\\\\\noindent\textem{Problem.} Prove that $2+2 = 4$.\\\\
答案1
以下提供了 MWE:
\documentclass{article}
\usepackage{amsmath}
\newtheorem{problem}{Problem}
\begin{document}
\begin{problem}
This is a new problem.
\end{problem}
\end{document}
为了进一步定制环境的外观problem
,我们可以借助amsthm
包和\newtheoremstyle
命令。下面给出了一个 MWE:
\documentclass{article}
\usepackage{amsmath,amsthm}
\newtheoremstyle{problemstyle} % <name>
{3pt} % <space above>
{3pt} % <space below>
{\normalfont} % <body font>
{} % <indent amount}
{\bfseries\itshape} % <theorem head font>
{\normalfont\bfseries:} % <punctuation after theorem head>
{.5em} % <space after theorem head>
{} % <theorem head spec (can be left empty, meaning `normal')>
\theoremstyle{problemstyle}
\newtheorem{problem}{Problem}[section] % Comment out [section] to remove section number dependence
\begin{document}
\section{Simple Problems}
\begin{problem}[Analytic]
Prove that $2+2 = 4$.
\end{problem}
\end{document}
答案2
这也是我的建议,正如 azetina 所建议的:
\documentclass{article}
\usepackage{amsthm}
\theoremstyle{remark}
\newtheorem{problem}{Problem}
\begin{document}
\begin{problem}
Prove that $2+2 = 4$.
\end{problem}
\end{document}