我想定义自己的定理,并将其捕获在fancybox
包中指定的双(或椭圆)框周围。这是一个 MWE
\documentclass{article}
\useackage{amsmath,fancybox}
\newtheorem{test}{Test}
\begin{document}
\doublebox{%
\begin{test}
bla bla bla
\end{test}}
\end{document}
答案1
您可以使用tcolorbox
,它比 具有更强的自定义功能fancybox
。
\documentclass{article}
\usepackage{amsmath,amsthm}
\usepackage[many]{tcolorbox}
\usepackage{lipsum}
\newtheorem{test}{Test}
\tcolorboxenvironment{test}{
enhanced,
borderline={0.8pt}{0pt}{black},
borderline={0.4pt}{2pt}{black},
boxrule=0.4pt,
colback=white,
coltitle=black,
sharp corners,
}
\begin{document}
\lipsum[2]
\begin{test}
bla bla bla
\end{test}
\lipsum[2]
\end{document}
答案2
一个简单的解决方案,使用framed
来自选项ntheorem
和同名包:
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{amsmath,fancybox}
\usepackage{framed}
\usepackage[thmmarks, thref, amsmath, framed]{ntheorem}
\def\theoremframecommand{\doublebox}
\theoremheaderfont{\bfseries}
\theorembodyfont{\normalfont}
\theoremseparator{.}
\newshadedtheorem{thmtest}{Test}
\begin{document}
\begin{thmtest}
Bla bla bla
\end{thmtest}
\end{document}
答案3
\documentclass{article}
\usepackage{amsmath,fancybox}
\usepackage{calc}
\newtheorem{test}{Test}
\newenvironment{boxedtest}
{\noindent\begin{Sbox}\begin{minipage}{\linewidth-7.5\fboxrule-2\fboxsep-1pt}\begin{test}}
{\end{test}\end{minipage}\end{Sbox}\doublebox{\TheSbox}}
\begin{document}
\begin{boxedtest}
bla bla bla
\end{boxedtest}
\end{document}