Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to use enumitem to present various numbered principles, and to keep a running count on these principles. I'm getting stuck because I can't get enumerate not to shift the label into the left margin, except by forcing a very large margin for the whole principle.

I'm hoping for something betweeen the two (not working) examples below, where - where the label doesn't hang into the left margin, but the text is allowed to wrap so it isn't so heavily indented. Do you have any suggestions? Many thanks!

\documentclass{article}
\usepackage{enumitem}


\begin{document}
 dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.

\begin{enumerate}[label=\small\textsc{Longlabel}-\arabic*\normalsize,labelindent=7em,itemindent=2em]
  \item   elit. Duis tincidunt mi ut purus varius aliquet posuere eni ultricies.  dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.
  \item  mi vel lacus dictum iaculis. Aenean vestibulum    pharetra magna, sit amet    venenatis velit posuere ut. dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.
\end{enumerate}

 dolor sit amet, consectetur adipiscing dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim ltricies.

\begin{enumerate}[label=\small\textsc{Longlabel}-\arabic*\normalsize,leftmargin=7.2em]
  \item   elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.  dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.
  \item  mi vel lacus dictum iaculis. Aenean vestibulum   pharetra magna, sit amet venenatis velit posuere ut. dolor sit amet, consectetur adipiscing   elit. Duis tincidunt mi ut purus varius aliquet posuere enim.
\end{enumerate}


\end{document}

enter image description here

EDIT: Lockstep's fix works pretty near perfectly for enumerate environment. Is there a way of replicating it when I use itemize to refer back to a previous example?

Minimal example below shoes problem with hanging indent again.

\documentclass{article}
\usepackage{enumitem}


\begin{document}
 dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.

\begin{enumerate}[label=\small\textsc{Longlabel}-  \arabic*\normalsize,labelindent=*,itemindent=*]
  \item\label{test2}   elit. Duis tincidunt mi ut purus varius aliquet posuere eni ultricies.  dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.
\end{enumerate}

\begin{itemize}[labelindent=*,itemindent=*]
\item[\ref{test2}]elit. Duis tincidunt mi ut purus varius aliquet posuere eni ultricies.  dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.
\end{itemize}

\end{document}
share|improve this question

1 Answer 1

up vote 5 down vote accepted

Try leftmargin=*,itemindent=*. (If that's close to, but not exactly what you want, try setting itemindent to, say, 4em.)

\documentclass{article}

\usepackage{enumitem}

\begin{document}

dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.

\begin{enumerate}[label=\small\textsc{Longlabel}-\arabic*\normalsize,leftmargin=*,itemindent=*]
  \item   elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.  dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.
  \item  mi vel lacus dictum iaculis. Aenean vestibulum   pharetra magna, sit amet venenatis velit posuere ut. dolor sit amet, consectetur adipiscing   elit. Duis tincidunt mi ut purus varius aliquet posuere enim.
\end{enumerate}

\end{document}

enter image description here

EDIT: Wth regard to your follow-up question: Replacing the normal itemize item with a cross-reference to an enumerate item is somewhat unusual, but the option align=left produces the desired alignment.

\documentclass{article}

\usepackage{enumitem}

\begin{document}

 dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.

\begin{enumerate}[label=\small\textsc{Longlabel}-  \arabic*\normalsize,labelindent=*,itemindent=*]
  \item\label{test2}   elit. Duis tincidunt mi ut purus varius aliquet posuere eni ultricies.  dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.
\end{enumerate}

\begin{itemize}[labelindent=*,itemindent=*,align=left]
\item[\ref{test2}]elit. Duis tincidunt mi ut purus varius aliquet posuere eni ultricies.  dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.
\item   elit. Duis tincidunt mi ut purus varius aliquet posuere eni ultricies.  dolor sit amet, consectetur adipiscing    elit. Duis tincidunt mi ut purus varius aliquet posuere enim    ultricies.
\end{itemize}

\end{document}

enter image description here

share|improve this answer
    
This looks really good what you've done, but the problem is I can't replicate it on my computer. I try running your minimal example and get error message "Missing number, treated as zero <to be read again> * ... leftmargin=*,itemindent=*] –  user25244 Jan 30 '13 at 13:08
    
@user25244 You probably have an outdated version of enumitem -- v3 included major new features. Try to update your TeX distribution. –  lockstep Jan 30 '13 at 13:18
    
I've now updated my version of enumitem and this works fine for the minimal example, text, even when I make the label much longer. But in my own document there's still sometimes a tiny over hang when the theorem number goes into two digits. But it's a tiny overhang, and with only 2 days before thesis submission, I think this is a good-enough fix. Many thanks! –  user25244 Jan 30 '13 at 13:26
    
@user25244 You're welcome -- and don't forget to upvote (as soon as you have 15 rep) and accept my answer. ;-) –  lockstep Jan 30 '13 at 13:27
    
Thanks! I've now edited to add a further query about itemize lists. Sorry about this! –  user25244 Jan 30 '13 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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