我正在尝试$\blacktriangle$
使用该包在框架环境的末尾包含一个mdframed
。
但是,我的代码不知为何无法正常工作。让我解释一下我在做什么:
\documentclass[12pt,twoside]{report}
\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fouriernc}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{thmtools}
\usepackage{tikz}
\usepackage[framemethod=TikZ]{mdframed}
\declaretheoremstyle
[
spaceabove=0pt, spacebelow=0pt, headfont=\normalfont\bfseries,
notefont=\mdseries, notebraces={(}{)}, headpunct={\newline}, headindent={},
postheadspace={ }, postheadspace=4pt, bodyfont=\normalfont, qed=$\blacktriangle$
]{mystyle}
{\theoremstyle{mystyle}
\newmdtheoremenv[%
outermargin = 1.3cm , %
leftmargin = 0pt , rightmargin = 0pt , %
innerleftmargin = 5pt , innerrightmargin = 5pt , %
innertopmargin = 5pt, innerbottommargin = 5pt , %
backgroundcolor = blue!10 , %
align = center , % align the environment itself (left, center, rigth)
nobreak = true, % prevent a frame from splitting
hidealllines = true , %
topline = true , bottomline = true , %
splittopskip = \topskip , splitbottomskip = 0pt , %
skipabove = 0.5\baselineskip , skipbelow = 0.3\baselineskip]
{example}{Exemplo}[chapter]}
\begin{document}
\section{Introduction}
Lorem ipsum sed nulla id risus adipiscing vulputate.
\begin{example}
Um consumidor financiou a compra de um veículo pagando 48 parcelas de \$800,00 mensais e a taxa de juros cobrada pela concessionária foi de 1,2\% a.m.. Qual era o valor à vista do automóvel adquirido?
\newline
\textbf{Solução:}
\newline
$PV = 800 \times \left[ \dfrac{1,012^{48}-1}{1,012^{48}\times 0,012} \right] \newline
PV = 800 \times \left[ \dfrac{0,772820}{0,021274} \right] \newline
PV = \$29.061,79$
\end{example}
Lorem ipsum sed nulla id risus adipiscing vulputate.
\end{document}
我尝试了很多次,但到目前为止,我还没有成功将 放在框架环境$\blacktriangle$
的末尾mdframed
。以下是我目前得到的结果:
有人可以提示我我做错了什么吗?
答案1
这是一个借鉴的解决方案阴影定理 (thmtools) 跨越页面
这个想法是定义一个mdstyle
\mdfdefinestyle{myframedstyle}{%
outermargin = 1.3cm , %
....
然后将其挂接到thmtools
样式声明中:
preheadhook={\begin{mdframed}[style=myframedstyle]},
postfoothook=\end{mdframed},
你会注意到我使用了命令
\declaretheorem[style=mystyle,numberwithin=chapter,title=Exemplo]{example}
来声明你的新定理。
这是一个完整的 MWE,可供使用。
% arara: pdflatex
% !arara: indent: {overwrite: on}
\documentclass[12pt,twoside]{report}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{thmtools}
\usepackage{tikz}
\usepackage[framemethod=TikZ]{mdframed}
\declaretheoremstyle
[
spaceabove=0pt, spacebelow=0pt, headfont=\normalfont\bfseries,
notefont=\mdseries, notebraces={(}{)}, headpunct={\newline}, headindent={},
postheadspace={ }, postheadspace=4pt, bodyfont=\normalfont, qed=$\blacktriangle$,
preheadhook={\begin{mdframed}[style=myframedstyle]},
postfoothook=\end{mdframed},
]{mystyle}
\declaretheorem[style=mystyle,numberwithin=chapter,title=Exemplo]{example}
\mdfdefinestyle{myframedstyle}{%
outermargin = 1.3cm , %
leftmargin = 0pt , rightmargin = 0pt , %
innerleftmargin = 5pt , innerrightmargin = 5pt , %
innertopmargin = 5pt, innerbottommargin = 5pt , %
backgroundcolor = blue!10 , %
align = center , % align the environment itself (left, center, rigth)
nobreak = true, % prevent a frame from splitting
hidealllines = true , %
topline = true , bottomline = true , %
splittopskip = \topskip , splitbottomskip = 0pt , %
skipabove = 0.5\baselineskip , skipbelow = 0.3\baselineskip}
\begin{document}
\section{Introduction}
Lorem ipsum sed nulla id risus adipiscing vulputate.
\begin{example}
Um consumidor financiou a compra de um veículo pagando 48 parcelas de \$800,00 mensais e a taxa de juros cobrada pela concessionária foi de 1,2\% a.m.. Qual era o valor à vista do automóvel adquirido?
\newline
\textbf{Solução:}
\newline
$PV = 800 \times \left[ \dfrac{1,012^{48}-1}{1,012^{48}\times 0,012} \right] \newline
PV = 800 \times \left[ \dfrac{0,772820}{0,021274} \right] \newline
PV = \$29.061,79$
\end{example}
Lorem ipsum sed nulla id risus adipiscing vulputate.
\end{document}
与 Gonzalo 聊天后,thmtools
现在有一把mdframed
钥匙,可以按如下方式使用(例如)
\documentclass[12pt,twoside]{report}
\usepackage[margin=2cm]{geometry}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{thmtools}
\usepackage{tikz}
\usepackage[framemethod=TikZ]{mdframed}
\declaretheoremstyle
[ spaceabove=0pt, spacebelow=0pt, headfont=\normalfont\bfseries,
notefont=\mdseries, notebraces={(}{)}, headpunct={\newline}, headindent={},
postheadspace={ }, postheadspace=4pt, bodyfont=\normalfont, qed=$\blacktriangle$,
mdframed={ outermargin = 1.3cm , %
leftmargin = 0pt , rightmargin = 0pt , %
innerleftmargin = 5pt , innerrightmargin = 5pt , %
innertopmargin = 5pt, innerbottommargin = 5pt , %
backgroundcolor = blue!10 , %
align = center , % align the environment itself (left, center, rigth)
nobreak = true, % prevent a frame from splitting
hidealllines = true , %
topline = true , bottomline = true , %
splittopskip = \topskip , splitbottomskip = 0pt , %
skipabove = 0.5\baselineskip , skipbelow = 0.3\baselineskip}
]{mystyle}
\declaretheorem[style=mystyle,numberwithin=chapter,title=Exemplo]{example}
\begin{document}
\section{Introduction}
Lorem ipsum sed nulla id risus adipiscing vulputate.
\begin{example}
Um consumidor financiou a compra de um veículo pagando 48 parcelas de \$800,00 mensais e a taxa de juros cobrada pela concessionária foi de 1,2\% a.m.. Qual era o valor à vista do automóvel adquirido?
\newline
\textbf{Solução:}
\newline
$PV = 800 \times \left[ \dfrac{1,012^{48}-1}{1,012^{48}\times 0,012} \right] \newline
PV = 800 \times \left[ \dfrac{0,772820}{0,021274} \right] \newline
PV = \$29.061,79$
\end{example}
Lorem ipsum sed nulla id risus adipiscing vulputate.
\end{document}