[Tex/LaTex] hanging indents

indentationparagraphs

Note: Subsequent to the original post, it was pointed out to me that my problem had nothing to do with the textpos package. I've edited the title, but left the original post as is for posterity (or so that I can feel silly every time I look at it).

I'd like to be able to use the textpos package to place text at arbitrary positions on the page. At one point, however, I'd like to have multiple lines in one box with all lines after the first being indented. I tried using \addtolength{\leftskip}{18pt}, but it indented all lines including the first. After thinking about this a little, I concluded that it's probably not a bug, it just is the way it is. Anyway, does anyone have a solution to this problem? (Obviously, I could break things up into many little vertical modules, but that seems like a huge amount of trouble). Here is a small example. In the first textbox, I used the \addtolength construct; the second textbox is without it so you can see the difference. Thanks.

\documentclass{article}
\usepackage[absolute,showboxes]{textpos}
\pagestyle{empty}

\TPGrid[1in,1in]{2}{20}
\TPMargin{4pt}
\setlength{\parindent}{0pt}

\begin{document}
  \begin{textblock}{1}(0,2)
   {\scshape\large Name}
    \newline
    {\addtolength{\leftskip}{12pt}
      Address 1\\
      Address 2
      \par
    }
  \end{textblock}
  \begin{textblock}{1}(0,4)
    {\scshape\large Name}
      \newline
      Address 1\\
      Address 2
  \end{textblock}
\end{document}

Best Answer

Use \hangindent=13pt (use any size you wish instead of 13pt for example 1em or 0.3cm}

\documentclass{article}
\usepackage[absolute,showboxes]{textpos}
\pagestyle{empty}

\TPGrid[1in,1in]{2}{20}
\TPMargin{4pt}
\setlength{\parindent}{0pt}

\begin{document}
  \begin{textblock}{1}(0,2)
   {\scshape\large Name}
    \newline
    {\addtolength{\leftskip}{12pt}
      Address 1\\
      Address 2
      \par
    }
  \end{textblock}
  \begin{textblock}{1}(0,4)
    {\scshape\large Name}
      \newline
      \hangindent=13pt
      Address 1\\
      Address 2
  \end{textblock}
\end{document}

You can also use \hangafter=2 in conjunction with hangindent to effect the indentation from the second line only etc.

The OP also asked why adjusting \leftskip did not work, this is because it was applied within a paragraph, if we break the text into two paragraphs by leaving a blank line, the OP's example would also work as per the example below:

\begin{textblock}{1}(0,2)
   {\scshape\large Name}
    \newline


    {\addtolength{\leftskip}{30pt}
      Address 1\\
      Address 2
      \par
    }