带有方程式的问题集的宏

带有方程式的问题集的宏

我正在寻找一种方法来设置一个宏来组织我的问题集。基本上,我正在寻找一种快捷方式来替代我目前所做的事情,即:

Problem 1)

\begin{equation*}  
\begin{gathered}  
\int_{-\infty}^{\infty} f(x) dx \\  
\text{A well thought out proof}  
\end{gathered}  
\end{equation}

Problem 2)  
etc...

我认为我需要一个自定义环境,我只需说一句话\begin{problem} ... \end{problem},它就会相应地指向该部分并处于数学模式。但我对如何设置它一无所知。任何见解都值得赞赏,非常感谢!

答案1

正如 Werner 所说的那样,不清楚您是喜欢拥有一个problem 环境,还是只喜欢一个替代equation*和的新环境gathered。我都做过(我称后者为eqga)。

我还添加了这些行(感谢 Paulo Cereda):

\newtheoremstyle{mystyle}% name
{3pt}% space above
{3pt}% space below
{}% body font
{}% indent amount
{\bfseries}% theorem head font
{)\newline}% punctuation after theorem head
{.5em}% space after theorem head
{}% theorem head spec
\theoremstyle{mystyle}

要获得problem您在问题中指出的样式,但我更喜欢在数字末尾带有点的经典布局,只需删除上面的几行并取消注释这一行:

%\theoremstyle{definition}

看看它。

\documentclass{article}
\usepackage{amsmath}

\usepackage{amsthm}

% code from: https://tex.stackexchange.com/a/26116/101651 (slightly modified)
\newtheoremstyle{mystyle}% name
{3pt}% space above
{3pt}% space below
{}% body font
{}% indent amount
{\bfseries}% theorem head font
{)\newline}% punctuation after theorem head
{.5em}% space after theorem head
{}% theorem head spec
\theoremstyle{mystyle}
%\theoremstyle{definition}
\newtheorem{problem}{Problem}

\newenvironment{eqga}{%
\begin{equation*}  
\begin{gathered}
}{%
\end{gathered}  
\end{equation*}
}

\begin{document}
\begin{problem}
Description of the problem
\begin{eqga}  
\int_{-\infty}^{\infty} f(x) dx \\  
\end{eqga}
\end{problem}
\begin{proof}
A well thought out proof
\end{proof}
\begin{problem}
Description of another problem
\end{problem}
\begin{proof}
Another well thought out proof
\end{proof}
\end{document}

在此处输入图片描述

相关内容