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.

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}
share|improve this question
add comment

1 Answer 1

up vote 7 down vote accepted

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
    }
share|improve this answer
    
Thanks - I guess this had nothing to do with the textpos package. Can you explain why the solution in the example did not work? –  rogerl Dec 19 '10 at 20:27
    
@rogerl Yes it has nothing to do with the textpos package - you may wish to edit the title of the post a bit to reflect that, if you wish. I added the reason in my answer above, essentially you applied the \leftskip to the whole paragraph by calling it within the paragraph. –  Yiannis Lazarides Dec 19 '10 at 20:35
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.