Como portar esta solução ntheorem para amsthm + thmtools?

Como portar esta solução ntheorem para amsthm + thmtools?

É possível reproduzir issoambiente de teorema agradávelusando amsthme thmtools?

Responder1

Você também pode usar o pacote mdframedpara desenhar a moldura. A configuração dos teoremas pode ser feita pelo seu pacote preferido. Depois de configurar seu ambiente de teorema, você pode cercá-lo com arquivos \surroundwithmdframed. Para o estilo desejado, você pode usar a seguinte definição, em que as linhas curtas têm comprimento de 0,25 cm. Claro que isso pode ser feito de forma mais elegante.

Para simplificar o código estou usando a calcbiblioteca do TikZ

\usepackage[framemethod=TikZ]{mdframed}
\usetikzlibrary{calc}
\makeatletter
\newrobustcmd*\mdf@tikzbox@tfl@spare[1]{%three or four borders
    \clip(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);%
    \begin{scope}[mdfcorners]%
       \clip[preaction=mdfouterline]%
            [postaction=mdfbackground]%
            [postaction=mdfinnerline]#1;%
    \end{scope}%
    \path[mdfmiddleline,mdfcorners]($(O|-P)-(0,0.25cm)$)--(O|-P)--(P)--($(P)-(0,0.25cm)$);
    \path[mdfmiddleline,mdfcorners]($(P|-O)+(0,0.25cm)$)--(P|-O)--(O)--($(O)+(0,0.25cm)$);
  }%
\newrobustcmd*\changelinestyle{\let\mdf@tikzbox@tfl\mdf@tikzbox@tfl@spare}
\makeatother
\surroundwithmdframed[settings=\changelinestyle]{theorem}

Através desta definição todas as opções de mdframedsão permitidas.

insira a descrição da imagem aqui

\documentclass{article}
\usepackage{amsmath,amsthm}
\usepackage{thmtools}
\declaretheorem[]{theorem}

\usepackage[framemethod=TikZ]{mdframed}
\usetikzlibrary{calc}
\makeatletter
\newrobustcmd*\mdf@tikzbox@tfl@spare[1]{%three or four borders
    \clip(0,0)rectangle(\mdfboundingboxwidth,\mdfboundingboxheight);%
    \begin{scope}[mdfcorners]%
       \clip[preaction=mdfouterline]%
            [postaction=mdfbackground]%
            [postaction=mdfinnerline]#1;%
    \end{scope}%
    \path[mdfmiddleline,mdfcorners]($(O|-P)-(0,0.25cm)$)--(O|-P)--(P)--($(P)-(0,0.25cm)$);
    \path[mdfmiddleline,mdfcorners]($(P|-O)+(0,0.25cm)$)--(P|-O)--(O)--($(O)+(0,0.25cm)$);
  }%
\newrobustcmd*\changelinestyle{\let\mdf@tikzbox@tfl\mdf@tikzbox@tfl@spare}
\makeatother
\surroundwithmdframed[settings=\changelinestyle,middlelinecolor=blue,roundcorner=3pt,middlelinewidth=1.2pt]{theorem}

\usepackage{lipsum}
\begin{document}
\lipsum[2]

\begin{theorem}%
If~$G$ is a connected graph of order $n\geq 3$ and size~$m$, then
\[
    g(G)\geq \frac{m}{6}-\frac{n}{2}+1.%
\]
\end{theorem}%

\lipsum[2]

\end{document}

informação relacionada