3

I'm attempting to indent cases and subcases of a proof by 1.3cm. However, when I apply adjustwidth to a subcase, it seems to affect the subcase following it.

Here is how it looks with my current code:

Case 2.2 indented too far

And here's how I'd like it to look:

Case 2.2 indented correctly

Code I'm using (excuse the sloppy reuse of code):

\documentclass{article}
\usepackage{amsthm}
\usepackage{changepage}
\begin{document}
    \begin{proof}
        {\it Case 1.} First case.

        \begin{adjustwidth}{1.3cm}{}
            Case explanation.
        \end{adjustwidth}

        {\it Case 2.} Second case.

        \begin{adjustwidth}{1.3cm}{}
            {\it Case 2.1.} First part.

            {\it Case 2.2.} Second part.

            \begin{adjustwidth}{1.3cm}{}
                Second part explanation.
            \end{adjustwidth}
        \end{adjustwidth}
    \end{proof}
\end{document}

How can I adjust my code to allow uniform indenting of sections? If it's not possible with adjustwidth, what can I use?

  • Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Qrrbrbirlbel Sep 15 '13 at 22:36
  • 2
    {\it Case 2.1.} This should just be a list (and \it is a deprecated command anyway) LaTeX list environments will handle the indentation and numbering automatically. – David Carlisle Sep 15 '13 at 22:37
  • 1
    Please see also Does it matter if I use \textit or \it, \bfseries or \bf, etc\it is deprecated in LaTeX2e, better to use {\itshape …} or just \textit{…}. — Why don’t you use a simple list like enumerate? – Qrrbrbirlbel Sep 15 '13 at 22:37
  • @Qrrbrbirlbel I've adjusted the example. As for the \it and \bf, this is just a sample, not "production" typesetting code. As for a list, I don't think it will work for my case since the word Case has to be prepended and it has to work in a proof environment. – Eric Sep 15 '13 at 22:40
  • 1
    Eric you are already using adjustwidth which is a latex list environment, but with an empty label, but then labelling the cases by hand, I just suggest using a list environment with a label that does the numbering, so that numbering and cross referencing is more natural. – David Carlisle Sep 16 '13 at 7:26
3

The following code will yield the desired output however as said in the comments of your question you might want the review some of your code in order to remove the \it commands and replace them by {\itshape } for instance

\documentclass{article}

\usepackage{amsthm}
\usepackage{changepage}

\begin{document}

\begin{proof}
    \textit{Case 1.} First case.

    \begin{adjustwidth}{1.3cm}{}
        Case explanation.
    \end{adjustwidth}

    \textit{Case 2.} Second case.

    \begin{adjustwidth}{1.3cm}{}
        \textit{Case 2.1.} First part.\\
        \textit{Case 2.2.} Second part.

        \begin{adjustwidth}{1.3cm}{}
            Second part explanation.
        \end{adjustwidth}
    \end{adjustwidth}
\end{proof}

\end{document}

The "bad" indenting came from the new paragraph introduced by the empty line between Case 2.1 and Case 2.2. This can be visualised if you add \setlength{\parindent}{0pt} in your preamble. Then the "bad" indent is still there but is of 0pt which gives the desired output.

  • Is there any specific reason why the double-\ newline forces the proper formatting while a "paragraph" newline does not? – Eric Sep 15 '13 at 22:42
  • 1
    I would say that the new paragraph introduces an indent which you don't want while the newline does not. – Ludovic C. Sep 15 '13 at 22:44
  • That makes sense. Thank you! I will accept your answer when the timeout expires. – Eric Sep 15 '13 at 22:45
  • For instance with your MWE and by adding \setlength{\parindent}{0pt} in your preamble you will get the desired output. – Ludovic C. Sep 15 '13 at 22:45
  • 1
    It should be \textit{Case 2.} and nothing else. ;-) You don't want to use obsolete commands, do you? – egreg Sep 15 '13 at 22:47
7

You should almost never need manual numbering, indentation or \\ in a LaTeX document. If you let the system do this it is much easier to handle cross references, and get consistent layouts, or to change the layouts without editing the document body.

Here I use some basic settings in enumitem to save setting the lower level latex list parameters directly. The package has a lot of parameters so the exact indentation style can be customised more without changing the document markup.

enter image description here

\documentclass{article}

\usepackage{amsthm}

\usepackage{enumitem}

\newlist{pcases}{enumerate}{3}
\setlist[pcases]{label=\textit{Case \arabic*},leftmargin=*}
\setlist[pcases,2]{label=\textit{\thepcasesi.\arabic*}}

\begin{document}

\begin{proof}\mbox{}
    \begin{pcases}
    \item First case.

        Case explanation.

    \item Second case.
        \begin{pcases}
        \item First part.
        \item Second part.

            Second part explanation.
        \end{pcases}
    \end{pcases}
\end{proof}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.