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.

is there a way to start every paragraph in a document with a hanging indent, without defining this for each and every paragraph? Is this possible without any extra packages loaded or such?

And, while we're at it: is it possible to start an area of, say, 10 out of 100 paragraphs in a row, with a hanging indent, where the rest of the paragraphs don't start with a hanging indent?

EDIT:

So I want is: 10 paragraphs with hanging indent, 90 paragraphs without hanging indent. Is this accomplishable:

  • without defining this for every paragraph separately
  • loading extra packages
share|improve this question
    
Welcome to TeX.SX! The question is very broad. May you make some examples of what you're asking? –  egreg Jun 20 '12 at 20:42
    
The problem is in what your paragraphs are supposed to contain: LaTeX plays with \parshape when doing lists or environments such as center, so they don't go along with the primitives for hanging indentation. For plain text the thing can be easy. –  egreg Jun 20 '12 at 21:06

2 Answers 2

up vote 5 down vote accepted

I am sure it is possible by some TeX programming. On the other hand, the hanging-package already does most of what you are asking for. Just put all body text, or any number of paragraphs to be hung, inside a \hangparas-environment.

share|improve this answer

This is a simple solution to your problem, when the paragraphs contain only text.

\documentclass{article}
\usepackage[numbers]{kantlipsum}
\begin{document}

\parindent=0pt
\newcounter{paras}
\everypar{%
  \stepcounter{paras}%
  \ifnum\value{paras}>10 
    \everypar{}
  \else
    \hangindent=5em \hangafter=1
  \fi}

\kant[1-100]

\end{document}

The mysterious \everypar is a container of tokens that are inserted whenever a paragraph is started. In this case we say to step the counter and look at its value: at the moment its value is greater than 10, we are at the 11th paragraph, so we remove everything from \everypar, otherwise we set the hanging indentation.

share|improve this answer
    
That will help me a lot at a later time, but thank you very much in advance for your effort and in the name of those who already fully understand all this code. Really, thanks! I'm a newbie to LaTex, loving what I found so far and looking forward to what comes. This here is a huge promise :) –  el_olmo Jun 20 '12 at 21:38

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.