Text Formattingenumitem | Multi-lined Items in enumerated List

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ghss
Posts: 5
Joined: Fri Nov 02, 2012 8:39 pm

enumitem | Multi-lined Items in enumerated List

Post by ghss »

Hello,

I am using package enumitem to generate the following list as in the attachment using this code

Code: Select all

% long line in Enumitems
\documentclass[10pt,twoside]{book} 
\usepackage{enumitem}

\begin{document}
  \begin{enumerate}[label={\it Problem \arabic* (my  problem)}:,leftmargin=*,labelindent=0pt]
    \item This is first line \\
          This is second line.
    \item short line
  \end{enumerate}
\end{document}
Is it possible to print the the second line in first item just below "Problem 1". This means I need "this is second line" with no indent.

thanks
ghss
Attachments
main2.png
main2.png (15.21 KiB) Viewed 3622 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

enumitem | Multi-lined Items in enumerated List

Post by localghost »

Perhaps something like this.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{enumitem}

\begin{document}
  \begin{enumerate}[label={\textit{Problem \arabic* (my  problem)}:},fullwidth]
    \item This is first line \\
          This is second line.
    \item short line
  \end{enumerate}
\end{document}

Thorsten
ghss
Posts: 5
Joined: Fri Nov 02, 2012 8:39 pm

Re: enumitem | Multi-lined Items in enumerated List

Post by ghss »

Thanks Thorsten.

And if i want to indent whole text in enumitem with some margin (say \parindent) with the same feature in my first post i.e. text in second line just start below the label of item.

ghss
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

enumitem | Multi-lined Items in enumerated List

Post by localghost »

In this case you have to specify a left margin that is slightly bigger than the width of the label.

Code: Select all

\documentclass[11pt,fleqn]{article}
\usepackage[T1]{fontenc}
\usepackage{enumitem}

\begin{document}
  \noindent Preceding text.
  \begin{enumerate}[label={\textit{Problem \arabic* (my  problem)}:},leftmargin=13em]
    \item This is first line \\
          This is second line.
    \item short line
  \end{enumerate}
  Following text.
\end{document}
Post Reply