2

A solution was given to Enumeration across many sections. However, (A) it seems enumeration prevents hang indent from activating. (B) Can I get the numbers to go into the left margin and leave hang indented references flush with the left margin? (C) How can I shift the numbers themselves a bit more to the left while leaving text flush to margin?

NOTE: IF we use the enumeration environment from an answer below (B) is solved, but (A) is still not working:

\documentclass[12pt]{article}
\usepackage[top = 1in, bottom = 1in, left = 1in, right = 1in]{geometry}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{enumitem}
\setlist[enumerate]{leftmargin=-\itemindent}       %% here we change

\begin{document}
\begin{center}
\textbf{class X}
\end{center}

\begin{enumerate}
\item \hangindent=7mm \noindent \textcolor{blue}{
\textbf{sadsdasd sdsdadsd}. \textbf{1902}. sasds sasdasd adsdsasds sadsdsadsa asdasd. \textit{adsdsdadsd asda sdsadsadsda sdasdsdadsds asdasddsdasdsa}. asdasd: asdsads sasdas.}
\item  BBBBB
\end{enumerate}

\begin{center}
\textbf{class Y}
\end{center}

\begin{enumerate}[resume]
\item \footnotesize \textcolor{blue}{CCCCC} \normalsize
\end{enumerate}

\end{document}

EDIT: I found a solution that avoid the enumeration environment altogether and is totally customizable.

5

Is it like this?

\documentclass[12pt]{article}
\usepackage[top = 1in, bottom = 1in, left = 1in, right = 1in]{geometry}
\usepackage[usenames,dvipsnames]{xcolor}
\usepackage{showframe}
\usepackage{enumitem}
\setlist[enumerate]{leftmargin=\itemindent}    %% leftmargin=-\itemindent

\begin{document}
\noindent X\dotfill X
\begin{center}
\textbf{class X}
\end{center}

\begin{enumerate}
\item \footnotesize \textcolor{blue}{AAAAA} \normalsize
\item  BBBBB
\item \parbox[t]{\linewidth}{\hangindent=7mm \noindent \textcolor{blue}{
\textbf{sadsdasd sdsdadsd}. \textbf{1902}. sasds sasdasd adsdsasds sadsdsadsa asdasd. \textit{adsdsdadsd asda sdsadsadsda sdasdsdadsds asdasddsdasdsa}. asdasd: asdsads sasdas.}}

\end{enumerate}

\begin{center}
\textbf{class Y}
\end{center}

\begin{enumerate}[resume]
\item \footnotesize \textcolor{blue}{CCCCC} \normalsize
\end{enumerate}

\end{document}

enter image description here

Or this:

Changing \setlist[enumerate]{leftmargin=-\itemindent} to

\setlist[enumerate]{leftmargin=*}

gives

enter image description here

  • Or I didn't understand! – user11232 Nov 4 '13 at 13:45
  • What you did is almost perfect. But suppose I have a two line entry with \hangindent. How do I get that to work? I edit my original post to give example. – Guido Jorg Nov 4 '13 at 15:06
  • See my edited OP. Perhaps we can avoid an enumeration environment and use a counter shifted into the margin before entries. Enumeration I now see gives many additional problems with making non enumerated comments in between entries, spacing, hangindent and other commands, and so on. – Guido Jorg Nov 4 '13 at 15:47
  • 1
    @GuidoJorg You can use a parbox. see my edit. – user11232 Nov 5 '13 at 0:17
0

I have found a good answer myself also. This allows avoiding the enumeration environment altogether, which disables many normal commands.

Add \newcounter{blah}\stepcounter{blah} in the preamble.

Add \hspace*{-Xmm} \hangindent=Ymm \noindent stepcounter{blah} \arabic{blah} \hspace{5mm} before the item. Here X = Y + 10.

Then the actual text desired to be enumerated. Again, in one line.

This will avoid breaking any commands such as noindent so that standard formatted paragraphs or code can be imported from non enumerated documents you make into the enumeration.

Or, create a newcommand in the preamble which does all this:

\newcounter{blah} \stepcounter{blah}
\newcommand*\blah{\hspace*{-22mm} 
\hangindent=7mm \noindent \stepcounter{blah} \arabic{blah} \hspace{9mm}}`

Add \blah in front of the line.

Or use another method part of which is found here : in preamble add

\newcounter{blah} \stepcounter{blah}
\newcommand{\negpar}[1][-1em]{%
    \ifvmode\else\par\fi
    {\parindent=#1\leavevmode}\ignorespaces
\newcommand*\blah{\negpar[-9.7mm] 
    \hangindent=7mm \stepcounter{blah} \arabic{blah}  \hspace{5mm}}`

Add \blah in front of the line.

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.