2

Consider the following 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}

It produces as output the following:

enter image description here

How do I fix this?

bzm3r
  • 3,196
  • Why do use an \item[Closure.] there if you just have one singular item? –  Feb 08 '18 at 23:41
  • @ChristianHupfer There are other items, but I have truncated them for the sake of the MWE. – bzm3r Feb 08 '18 at 23:42
  • Alright, but \item[...] is not always the best way to achieve such things –  Feb 08 '18 at 23:43
  • @ChristianHupfer I am open to alternative suggestions. One thing I sometimes do is \item Closure: (as an example), so that I get the bullet point and the label. – bzm3r Feb 08 '18 at 23:44
  • I know what \item Closure will do ;-) –  Feb 08 '18 at 23:44
  • @ChristianHupfer Not assuming knowledge (or lack thereof!) on your part, or whoever else reads this later. :) – bzm3r Feb 08 '18 at 23:46

2 Answers2

3

Edit: I could do it even better than @ChristianHupfer but did not wanted to make clear how much better I am :P ... So, just leaving this non elegant but simple way as a "working solution".

A solution is to use enumitem's leftmargin option, like:

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

enter image description here

koleygr
  • 20,105
  • But instead of using a fixed value (40pt), is it possible to put in some automatic document-dependent value? – bzm3r Feb 08 '18 at 23:40
  • @user89, It can be done... But in a difficult way because is deppends on the width of the the word "closure" or of the bigger word used... and this word comes in the code after the part that have to be given... This makes things somehow complicated and I suppose that Christian's suggestion is better and that you don't really need a hack that is too complicated to get a result that could take with other ways... – koleygr Feb 08 '18 at 23:51
  • @koleygr: My suggestion isn't really better, it's a bad trick ;-) –  Feb 08 '18 at 23:54
  • @ChristianHupfer... deleting this... Already upvoted yours... – koleygr Feb 08 '18 at 23:54
3

Similar to koleygr's idea, but using labelsep=0pt and automatic adjustement of \leftmargin with leftmargin=* from enumitem in conjunction with removal of the itemize label by label={}.

This could be done with a \newlist and \setlist as well.

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

enter image description here

  • nice... I could swear that tried this before... But probably had other options too that breaked it... (+1) – koleygr Feb 08 '18 at 23:54
  • @koleygr: Thanks (I've +1 for you some while ago, because you were just a few seconds faster than me with the same leftmargin=40pt idea. ;-)) -- Referring to the options of enumitem: Yes, that sometimes confuses me too as well –  Feb 08 '18 at 23:56
  • For more on enum item options you (or at least me :P) can look here: https://tex.stackexchange.com/q/184780/120578 – koleygr Feb 08 '18 at 23:58
  • @koleygr: Well, my statement was confusing: I rather meant that I forget the enumitem options rather quickly and are confused to use them in that case. You should have kept your answer, however –  Feb 09 '18 at 00:00
  • It was clear what you mean... I just used it in a not elegant way in my answer and added in the comment what I need to read... (If not the manual)... I don't think that my answer has to offer something... but I will undelete it if you think it has to offer to anyone... – koleygr Feb 09 '18 at 00:04
  • 1
    @koleygr: A working solution is a solution! –  Feb 09 '18 at 00:05
  • Ok... Undeleted and made clear that I am a better "TeXpert" :P [PS: For these who have already read The TeXbook, TeXpert is a way to say that you haven't read it and that you can't even pronounce TeX the right way... ] – koleygr Feb 09 '18 at 00:08