3

I am trying to place a graphic (with the tikz picture environment) on the right side of the text and within the environment of my custom box. Could you assure me or help me to place it correctly?

Thank you

\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}

Example

Please do not consider a duplicate, because the problem is different

Oromion
  • 384

1 Answers1

2

Hmmh, you were already loading the cutwin package, so you may just use it similarly as in this answer.

\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}

enter image description here