Mdframed 和 BC 徽标选项冲突

Mdframed 和 BC 徽标选项冲突

我想应用这两个使用 mdframed 和 tikz 包的 boxed,但似乎效果不佳。有人能帮我修复它吗?谢谢

\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{vietnam}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{lipsum}

\usepackage{environ}
\usepackage{xcolor}
\usepackage[tikz]{bclogo}
\usepackage{tikz}
\usetikzlibrary{calc}
\NewEnviron{myremark}[1]
{\par\medskip\noindent
    \begin{tikzpicture}
    \node[inner sep=0pt] (box) {\parbox[t]{.99\textwidth}{%
            \begin{minipage}{.3\textwidth}
            \centering\tikz[scale=5]\node[scale=3,rotate=30]{\bclampe};
            \end{minipage}%
            \begin{minipage}{.65\textwidth}
            \textbf{#1}\par\smallskip
            \BODY
            \end{minipage}\hfill}%
    };
    \draw[red!75!black,line width=3pt] 
    ( $ (box.north east) + (-5pt,3pt) $ ) -- ( $ (box.north east) + (0,3pt) $ ) -- ( $ (box.south east) + (0,-3pt) $ ) -- + (-5pt,0);
    \draw[red!75!black,line width=3pt] 
    ( $ (box.north west) + (5pt,3pt) $ ) -- ( $ (box.north west) + (0,3pt) $ ) -- ( $ (box.south west) + (0,-3pt) $ ) -- + (5pt,0);
    \end{tikzpicture}\par\medskip%
}

\usepackage[framemethod=TikZ]{mdframed}
\newcounter{dinhly}[section]
\newenvironment{dinhly}[1][]{%
    \stepcounter{dinhly}%
    \ifstrempty{#1}%
    {\mdfsetup{%
            frametitle={%
                \tikz[baseline=(current bounding box.east),outer sep=0pt]
                \node[anchor=east,rectangle,fill=yellow!120]
                {\strut Định lý~\thedinhly};}}
    }%
    {\mdfsetup{%
            frametitle={%
                \tikz[baseline=(current bounding box.east),outer sep=0pt]
                \node[anchor=east,rectangle,fill=yellow!120]
                {\strut Định lý~\thedinhly:~#1};}}%
    }%
    \mdfsetup{innertopmargin=10pt,linecolor=yellow!120,%
        linewidth=2pt,topline=true,
        frametitleaboveskip=\dimexpr-\ht\strutbox\relax,}
    \begin{mdframed}[]\relax%
    }
    {\end{mdframed}}

\begin{document}
    \begin{dinhly}
        \lipsum[1]
    \end{dinhly}
\lipsum[2]
\begin{myremark}{Web addresses in texts}
    \lipsum[4]
\end{myremark}
    \end{document}

答案1

软件包的选项mdframed必须写在小写\usepackage[framemethod=tikz]{mdframed}而不是大写\usepackage[framemethod=TikZ]{mdframed}

手册第 5 页写道:

第 5 页

截屏

\documentclass[12pt,a4paper]{book}
\usepackage[utf8]{vietnam}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{lipsum}

\usepackage{environ}
\usepackage{xcolor}
\usepackage[tikz]{bclogo}
\usepackage{tikz}
\usetikzlibrary{calc}
\NewEnviron{myremark}[1]
{\par\medskip\noindent
    \begin{tikzpicture}
    \node[inner sep=0pt] (box) {\parbox[t]{.99\textwidth}{%
            \begin{minipage}{.3\textwidth}
            \centering\tikz[scale=5]\node[scale=3,rotate=30]{\bclampe};
            \end{minipage}%
            \begin{minipage}{.65\textwidth}
            \textbf{#1}\par\smallskip
            \BODY
            \end{minipage}\hfill}%
    };
    \draw[red!75!black,line width=3pt] 
    ( $ (box.north east) + (-5pt,3pt) $ ) -- ( $ (box.north east) + (0,3pt) $ ) -- ( $ (box.south east) + (0,-3pt) $ ) -- + (-5pt,0);
    \draw[red!75!black,line width=3pt] 
    ( $ (box.north west) + (5pt,3pt) $ ) -- ( $ (box.north west) + (0,3pt) $ ) -- ( $ (box.south west) + (0,-3pt) $ ) -- + (5pt,0);
    \end{tikzpicture}\par\medskip%
}

\usepackage[framemethod=tikz]{mdframed}
\newcounter{dinhly}[section]
\newenvironment{dinhly}[1][]{%
    \stepcounter{dinhly}%
    \ifstrempty{#1}%
    {\mdfsetup{%
            frametitle={%
                \tikz[baseline=(current bounding box.east),outer sep=0pt]
                \node[anchor=east,rectangle,fill=yellow!120]
                {\strut Định lý~\thedinhly};}}
    }%
    {\mdfsetup{%
            frametitle={%
                \tikz[baseline=(current bounding box.east),outer sep=0pt]
                \node[anchor=east,rectangle,fill=yellow!120]
                {\strut Định lý~\thedinhly:~#1};}}%
    }%
    \mdfsetup{innertopmargin=10pt,linecolor=yellow!120,%
        linewidth=2pt,topline=true,
        frametitleaboveskip=\dimexpr-\ht\strutbox\relax,}
    \begin{mdframed}[]\relax%
    }
    {\end{mdframed}}

\begin{document}
    \begin{dinhly}
        \lipsum[1]
    \end{dinhly}
\lipsum[2]
\begin{myremark}{Web addresses in texts}
    \lipsum[4]
\end{myremark}
    \end{document}

相关内容