我为示例创建了一个定理环境,并希望将它们放在标题下方。
\documentclass{book}
\usepackage{amsmath}
\usepackage{amsthm}
\newtheoremstyle{break}
{5mm}
{5mm}
{}
{}
{\bfseries}
{}
{\newline}
{}
\theoremstyle{break}
\newtheorem{exmp}{Example}
\begin{document}
\begin{exmp}
This text should be framed in a box, but not the heading "Example".
\end{exmp}
\end{document}
我可以\fbox{}
在这个 newtheorenstyle 中添加一个,以便我可以使用\begin{exmp} Text text text \end{exmp}
,并且“文本文本文本”将位于框架框内吗?
答案1
我强烈建议你看看按钮盒它正是为了这个目的而创建的。
下列:
\documentclass{book}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage%[nounderline]
{thmbox}
\newtheorem[L]{thm}{Theorem}[section]
\newtheorem[L]{ex}[thm]{Example}
\begin{document}
\begin{ex}
Some text, some more text, a sufficient amount to get a full box with several lines.
\end{ex}
\vspace{45em}
\begin{ex}
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
Some text, some more text, a sufficient amount to get a full box with several lines.
\end{ex}
\end{document}
\end{document}
几乎可以生成您想要的内容:
并完美地打破:
请参阅手册以了解更多调整选项,但我相信这会比您的“手工制作”解决方案更为优雅。
答案2
这完成了:
\documentclass{book}
\usepackage{amsmath}
\usepackage{amsthm}
\newtheoremstyle{break}
{5mm}
{5mm}
{}
{}
{\bfseries}
{}
{\newline}
{}
\theoremstyle{break}
\newtheorem{exmp}{Example}
\newcommand{\example}[1]{%
\begin{exmp}\framebox[\textwidth][l]{#1}%
\end{exmp}}
\begin{document}
\example{Text text text}
\end{document}
框架是主体的宽度,里面的示例是左对齐的。