在“mdframed”框内的 itemize 环境中使用自定义项目标签会导致内容滑出框吗?

在“mdframed”框内的 itemize 环境中使用自定义项目标签会导致内容滑出框吗?

考虑以下 MWnotE:

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mdframed} % noteboxes, boxes, etc.

\newmdenv{notebox}

\begin{document}
    \section{Cats}
        Here is an important theorem.

        \begin{notebox}
            Let $X$ be a graph with $k$ vertices. Then, the earth is flat.

            \begin{proof}
                It suffices to show that the following conditions hold: 

                    \begin{itemize}
                        \item[Closure.] 
                        \begin{equation*}
                            0/0 = 0
                        \end{equation*}
                    \end{itemize}
            \end{proof}
        \end{notebox}

\end{document}

它产生如下输出:

在此处输入图片描述

我该如何解决?

答案1

类似于koleygr的想法,但是使用和的labelsep=0pt自动调整以及通过的删除itemize标签。\leftmarginleftmargin=*enumitemlabel={}

这也可以用\newlistand来完成。\setlist

\documentclass{article}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mdframed} % noteboxes, boxes, etc.

\usepackage{enumitem}

\newmdenv{notebox}


\begin{document}
    \section{Cats}
        Here is an important theorem.

        \begin{notebox}
            Let $X$ be a graph with $k$ vertices. Then, the earth is flat.

            \begin{proof}
              It suffices to show that the following conditions hold: 

              \begin{itemize}[label={},labelsep=0pt,leftmargin=*]
              \item Closure.
                \begin{equation*}
                  0/0 = 0
                \end{equation*}
              \item Foo

              \end{itemize}
            \end{proof}
          \end{notebox}

        \begin{notebox}[innerleftmargin=2cm]
            Let $X$ be a graph with $k$ vertices. Then, the earth is flat.

            \begin{proof}
              It suffices to show that the following conditions hold: 

              \begin{itemize}[label={},labelsep=0pt,leftmargin=*]
              \item Closure.
                \begin{equation*}
                  0/0 = 0
                \end{equation*}
              \end{itemize}
            \end{proof}
          \end{notebox}

\end{document}

在此处输入图片描述

答案2

编辑:我甚至可以比@ChristianHupfer 做得更好,但不想清楚地表明我有多好:P ...所以,只是把这种不优雅但简单的方法作为“可行的解决方案”。

一种解决方案是使用enumitemleftmargin选项,例如:

\documentclass{article}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{mdframed} % noteboxes, boxes, etc.

\newmdenv{notebox}

\begin{document}
    \section{Cats}
        Here is an important theorem.

        \begin{notebox}
            Let $X$ be a graph with $k$ vertices. Then, the earth is flat.

            \begin{proof}
                It suffices to show that the following conditions hold: 

                    \begin{itemize}[leftmargin=40pt]
                        \item[Closure.] 
                        \begin{equation*}
                            0/0 = 0
                        \end{equation*}
                    \end{itemize}
            \end{proof}
        \end{notebox}

\end{document}

在此处输入图片描述

相关内容