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 am trying to format part of a LaTeX document that should have the first line flush left, the second line should be indented, and then there should be a bullet list. Additionally, I would like to put some left and right padding around the block.

In order to apply the padding, I am trying to use the changepage package and adjustwidth environment. Unfortunately, what I find is that when I use adjustwidth, the effect of hangindent is nullified. I have tried many permutations of \hangindent, \hangafter, \leftskip, \rightskip, \setlength, etc. but have not yet seemed to find a combination that works.

Here is a minimum working example of both what the text should look like without padding and then the problem that is introduced when padding is added:

\documentclass[letterpaper,10pt]{article}
\usepackage[strict]{changepage}
\usepackage{paralist}
\begin{document}

\section*{How it should look, though I'd like to add some padding to the left and right.}
\noindent \textbf{A title of some sort} \\
\hangindent=\parindent Some descriptive text \\
\vspace{-\baselineskip}
\begin{compactitem}
    \item Bullet point 1
    \item Bullet point 2
    \item Bullet point 3
\end{compactitem}  

\section*{Adding padding using adjustwidth causes the hanindent to fail.}
\begin{adjustwidth}{5em}{5em}
    \noindent \textbf{A title of some sort} \\
    \hangindent=\parindent Some descriptive text that should be indented.\\
    \vspace{-\baselineskip}
    \begin{compactitem}
        \item Bullet point 1
        \item Bullet point 2
        \item Bullet point 3
    \end{compactitem}  
\end{adjustwidth}

\end{document}

enter image description here

You will find that the second instance of Some descriptive text that should be indented is flush left with A title of some sort on the previous line. It should, however, be indented to the same position as the bullets below it. If you don't see this problem, please message me and I can send the pdf through a private message/email.

Any advice or workarounds for this issue is greatly appreciated.

share|improve this question
    
Move \begin{compactitem} after \begin{adjustwidth}{5em}{5em}. Does it what you want? –  Kurt Sep 18 '12 at 15:42
1  
No, it doesn't work: adjustwidth is a list environment in disguise, so it uses \parshape which wins over \hangindent. –  egreg Sep 18 '12 at 16:45
    
Thanks for the tip, Kurt! Also, I am not sure what you're asking, I have \begin{compactitem} appearing a several lines after \begin{adjustwidth}. Even if moved things around, it doesn't fix anything. I imagine that I can work around this by using a minipage, but I feel like that is overkill for just changing the margins/padding for a paragraph. –  Karan Mistry Sep 18 '12 at 18:36
    
Generally it does not work with list environments (tested it with KOMA-Script’s \addmargin, chngpage's \adjustwidth - what you used – and enumitem). I wrote some time ago an e-mail to Will Robertson about that issue to be mentioned in the documentation of hanging, what uses \hangindent. –  Speravir Sep 18 '12 at 22:28
add comment

1 Answer

up vote 5 down vote accepted

You should emulate the hanging indentation with a list, so that it can be properly nested in adjustwidth:

\documentclass[letterpaper,10pt]{article}
\usepackage[strict]{changepage}
\usepackage{enumitem}
\makeatletter
\newenvironment{hanging}[1][\parindent]
  {\list{}{%
   \topsep\z@
    \listparindent\parindent
    \parsep\parskip
    \leftmargin=#1}%
    \item[]}
  {\endlist}

\makeatother
\begin{document}

\section*{How it should look, though I'd like to add some padding to the left and right.}
\noindent \textbf{A title of some sort}
\begin{hanging}
Some descriptive text
\begin{itemize}[nosep]
  \item Bullet point 1
  \item Bullet point 2
  \item Bullet point 3
\end{itemize}
\end{hanging}

\section*{Adding padding using adjustwidth}
\begin{adjustwidth}{5em}{5em}
\noindent \textbf{A title of some sort}
\begin{hanging}
Some descriptive text that should be indented.
\begin{itemize}[nosep]
  \item Bullet point 1
  \item Bullet point 2
  \item Bullet point 3
\end{itemize}  
\end{hanging}
\end{adjustwidth}

\end{document}

The hanging environment has an optional argument, the amount of hanging indentation.

I used the enumitem package, which is more powerful than paralist. In any case, adding \\ before starting an itemized list is wrong.

enter image description here

share|improve this answer
    
Thank you for your answer! I ended up modifying your solution to better suit my needs. I used the enumitem package as your suggested (very useful) and was able to do everything I need through nested lists and selective use of leftmargin, rightmargin, itemsep, label, beginpenalty, and midpenalty options. Works perfectly and is now structurally correct as well. –  Karan Mistry Jan 4 '13 at 15:14
add comment

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.