我当前的排版定义设置是
\newenvironment{definition}[1][Definition:]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
产生
我不太喜欢这种外观,但我不希望我的定义看起来像我的物理定律,这些定律是在mdframed
包中使用选项完成的framemethod = tikz
\begin{mdframed}[backgroundcolor = gray!30,
frametitle = Oberth effect]
Is where the use of a rocket engine when traveling at high speed generates
much more useful energy than one at low speed.
\end{mdframed}
看起来像
有什么建议我可以做些什么让definition
环境不那么简单但又不模仿环境的外观mdframed
?
\documentclass{article}
\usepackage[framemethod = tikz]{mdframed}
\newenvironment{definition}[1][Definition:]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\begin{document}
\begin{definition}
This is a definition.
\end{definition}
\begin{mdframed}[backgroundcolor = gray!30,
frametitle = Oberth effect]
Is where the use of a rocket engine when traveling at high speed generates
much more useful energy than one at low speed.
\end{mdframed}
\end{document}
答案1
一些无限选择的选项(我选择将颜色限制为灰色,以保持与现有环境的一致性并使文档保持简洁);我将其用于mdframed
一些示例和tcolorbox
其他示例;任何示例都可以用这两个强大的软件包中的任何一个来制作。
首先,使用mdframed
:
\documentclass{article}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}
\newtheoremstyle{defi}
{\topsep}%
{\topsep}%
{\normalfont}%
{}%
{\bfseries}%
{:}%
{.5em}%
{\thmname{#1}\thmnote{~(#3)}}%
\theoremstyle{defi}
\newmdtheoremenv{definitioni}{Definition}
\newmdtheoremenv[
hidealllines=true,
leftline=true,
innertopmargin=0pt,
innerbottommargin=0pt,
linewidth=4pt,
linecolor=gray!40,
innerrightmargin=0pt,
]{definitionii}{Definition}
\newmdtheoremenv[
roundcorner=5pt,
innertopmargin=0pt,
innerbottommargin=5pt,
linewidth=4pt,
linecolor=gray!40,
]{definitioniii}{Definition}
\begin{document}
\begin{mdframed}[backgroundcolor = gray!30,
frametitle = Oberth effect]
Is where the use of a rocket engine when traveling at high speed generates
much more useful energy than one at low speed.
\end{mdframed}
\begin{definitionii}
\lipsum[4]
\end{definitionii}
\begin{definitioni}
\lipsum[4]
\end{definitioni}
\begin{definitioniii}
\lipsum[4]
\end{definitioniii}
\end{document}
另外一个选择:
\documentclass{article}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}
\newtheoremstyle{defi}
{\topsep}%
{\topsep}%
{\normalfont}%
{}%
{\bfseries}%
{:}%
{.5em}%
{\thmname{#1}\thmnote{~(#3)}}%
\theoremstyle{defi}
\newmdtheoremenv[
hidealllines=true,
innertopmargin=0pt,
linewidth=4pt,
linecolor=gray!40,
singleextra={
\draw[line width=3pt,gray!50,line cap=rect] (O|-P) -- +(1cm,0pt);
\draw[line width=3pt,gray!50,line cap=rect] (O|-P) -- +(0pt,-1cm);
\draw[line width=3pt,gray!50,line cap=rect] (O-|P) -- +(-1cm,0pt);
\draw[line width=3pt,gray!50,line cap=rect] (O-|P) -- +(0pt,1cm);
},
firstextra={
\draw[line width=3pt,gray!50,line cap=rect] (O|-P) -- +(1cm,0pt);
\draw[line width=3pt,gray!50,line cap=rect] (O|-P) -- +(0pt,-1cm);
},
secondextra={
\draw[line width=3pt,gray!50,line cap=rect] (O-|P) -- +(-1cm,0pt);
\draw[line width=3pt,gray!50,line cap=rect] (O-|P) -- +(0pt,1cm);
}
]{definitioni}{Definition}
\begin{document}
\begin{mdframed}[backgroundcolor = gray!30,
frametitle = Oberth effect]
Is where the use of a rocket engine when traveling at high speed generates
much more useful energy than one at low speed.
\end{mdframed}
\begin{definitioni}
\lipsum[4]
\end{definitioni}
\end{document}
另外一个选择:
\documentclass{article}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{lipsum}
\newmdenv[
innertopmargin=0pt,
roundcorner=5pt,
linewidth=1pt,
linecolor=gray!40,
innertopmargin=\baselineskip,
singleextra={
\node[
anchor=west,
xshift=7pt,
fill=gray!20,
rounded corners=2pt,
draw] at (P-|O) {\bfseries Definition:};
},
firstextra={
\node[
anchor=west,
xshift=7pt,
fill=gray!20,
rounded corners=2pt,
draw] at (P-|O) {\bfseries Definition:};
}
]{definition}
\begin{document}
\begin{mdframed}[backgroundcolor = gray!30,
frametitle = Oberth effect]
Is where the use of a rocket engine when traveling at high speed generates
much more useful energy than one at low speed.
\end{mdframed}
\begin{definition}
\lipsum[4]
\end{definition}
\end{document}
现在使用更多选项tcolorbox
包裹:
\documentclass{article}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\newtcolorbox{definitioni}{
breakable,
fonttitle=\bfseries,
title={Definition:}
}
\newtcolorbox{definitionii}{
skin=enhanced,
breakable,
colback=white,
colframe=gray!30,
coltitle=black,
fonttitle=\bfseries,
leftrule=0.5cm,
arc=0pt,
outer arc=0pt,
title={Definition:}
}
\newtcolorbox{definitioniii}{
skin=enhanced,
breakable,
fonttitle=\bfseries,
colback=white,
arc=0pt,
outer arc=0pt,
title={Definition:},
shadow={1mm}{-1mm}{0mm}{fill=gray,opacity=0.5,sharp corners}
}
\begin{document}
\begin{mdframed}[backgroundcolor = gray!30,
frametitle = Oberth effect]
Is where the use of a rocket engine when traveling at high speed generates
much more useful energy than one at low speed.
\end{mdframed}
\begin{definitioni}
\lipsum[4]
\end{definitioni}
\begin{definitionii}
\lipsum[4]
\end{definitionii}
\begin{definitioniii}
\lipsum[4]
\end{definitioniii}
\end{document}
还有一个:
\documentclass{article}
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\newtcolorbox{definition}{
freelance,
breakable,
before=\par\vspace{2\bigskipamount}\noindent,
after=\par\bigskip,
frame code={
\node[
anchor=south west,
inner xsep=8pt,
xshift=8pt,
rounded corners=5pt,
font=\bfseries\color{white},
fill=gray] at (frame.north west) (tit) {\strut Definition:};
\draw[
line width=3pt,
rounded corners=5pt,gray
] (tit.west) -| (frame.south west) -- ([xshift=15pt]frame.south west);
},
interior code={},
top=2pt
}
\begin{document}
\begin{mdframed}[backgroundcolor = gray!30,
frametitle = Oberth effect]
Is where the use of a rocket engine when traveling at high speed generates
much more useful energy than one at low speed.
\end{mdframed}
\begin{definition}
\lipsum[4]
\end{definition}
\end{document}