将 tikzpicture 环境放置在带有 mdframed 的个性化框内

将 tikzpicture 环境放置在带有 mdframed 的个性化框内

我正在尝试将图形(带有tikz picture环境)放置在文本的右侧以及自定义框的环境内。您能保证或帮助我正确放置它吗?

谢谢

\documentclass{memoir}
\usepackage{mdframed}
\usepackage{amsthm}
\usepackage{tkz-graph}
\usepackage{lipsum}
\usepackage{cutwin}

\newcounter{theorem}[chapter]\setcounter{theorem}{0}
\renewcommand{\thetheorem}{\arabic{chapter}.\arabic{theorem}}
\newenvironment{theorem}[2][]{%
    \refstepcounter{theorem}
    \ifstrempty{#1}%
    % if condition (without title)
    {\mdfsetup{%
            frametitle={%
            \tikz[baseline=(current bounding box.east),outer sep=0pt]
            \node[anchor=east,rectangle,fill=blue!80]
            {\strut Theorem~\thetheorem};}
    }%
    % else condition (with title)
}{\mdfsetup{%
        frametitle={%
            \tikz[baseline=(current bounding box.east),outer sep=0pt]
            \node[anchor=east,rectangle,fill=blue!80]
            {\strut Theorem~\thetheorem:~#1};}%
    }%
}%
% Both conditions
\mdfsetup{%
    innertopmargin=10pt,linecolor=blue!80,%
    linewidth=2pt,topline=true,%
    frametitleaboveskip=\dimexpr-\ht\strutbox\relax%
}
\begin{mdframed}[]\relax}{%
\end{mdframed}}

\begin{document}

\chapter{New chapter}

\begin{theorem}[Eulerian graph]{}
If $G=(V,E)$ is an graph non dirigite, then \[|V|=2|E|.\]

\begin{proof}
\lipsum[1]
\begin{tikzpicture}
    \GraphInit[vstyle=Normal]
    \SetGraphUnit{2}
    \begin{scope}[rotate=-90]
    \Vertices{circle}{A,B,C,E}
    \end{scope}
    \NOEA[unit=1.414](E){D}
    \Edges(A,B,E,D,C,E,A,C,B)
\end{tikzpicture}
\end{proof}
\end{theorem}

\end{document}

例子

请不要考虑重复,因为问题不同

答案1

嗯,你已经加载了cutwin包,所以你可以像下面这样使用它这个答案

\documentclass{memoir}
\usepackage{mdframed}
\usepackage{amsthm}
\usepackage{tkz-graph}
\usepackage{lipsum}
\usepackage{cutwin}

\newcounter{theorem}[chapter]\setcounter{theorem}{0}
\renewcommand{\thetheorem}{\arabic{chapter}.\arabic{theorem}}
\newenvironment{theorem}[2][]{%
    \refstepcounter{theorem}
    \ifstrempty{#1}%
    % if condition (without title)
    {\mdfsetup{%
            frametitle={%
            \tikz[baseline=(current bounding box.east),outer sep=0pt]
            \node[anchor=east,rectangle,fill=blue!80]
            {\strut Theorem~\thetheorem};}
    }%
    % else condition (with title)
}{\mdfsetup{%
        frametitle={%
            \tikz[baseline=(current bounding box.east),outer sep=0pt]
            \node[anchor=east,rectangle,fill=blue!80]
            {\strut Theorem~\thetheorem:~#1};}%
    }%
}%
% Both conditions
\mdfsetup{%
    innertopmargin=10pt,linecolor=blue!80,%
    linewidth=2pt,topline=true,%
    frametitleaboveskip=\dimexpr-\ht\strutbox\relax%
}
\begin{mdframed}[]\relax}{%
\end{mdframed}}
\opencutright
\begin{document}

\chapter{New chapter}

\def\windowpagestuff{\flushright 
\begin{tikzpicture}
    \GraphInit[vstyle=Normal]
    \SetGraphUnit{2}
    \begin{scope}[rotate=-90]
    \Vertices{circle}{A,B,C,E}
    \end{scope}
    \NOEA[unit=1.414](E){D}
    \Edges(A,B,E,D,C,E,A,C,B)
\end{tikzpicture}
}


\begin{theorem}[Eulerian graph]{}
If $G=(V,E)$ is an graph non dirigite, then \[|V|=2|E|.\]

\begin{proof}
\begin{cutout}{3}{0.5\textwidth}{0pt}{12}
     \noindent
     \lipsum[1]
\end{cutout}
\end{proof}
\end{theorem}

\end{document}

在此处输入图片描述

相关内容