# How can I repeat some commands before each paragraph?

I have to use EasyBib to make my bibliography, and I've put it into my LaTeX document by copying/pasting. But I need to have a hanging indent for each item.

I've been able to get the effect I want by putting this before each item:

\hangindent=2.5em
\noindent


However, I have to write this out for every item. Is there a way to automate doing this?

-
\everypar{...} or \parindent=0pt? –  Henri Menke Apr 26 at 21:33
@HenriMenke \noindent doesn't seem to work with that. (I'm using \everypar{\noindent\hangindent=2.5em} and I've tried with/without the \hangindent. It doesn't seem to have any effect. The hanging indent does work though. –  Joe the Person Apr 26 at 21:39
Then try \parindent=0pt. –  Henri Menke Apr 26 at 21:41
@HenriMenke That did work - I had to move the \parindent outside the \everypar If you put your comment as an Answer I'll accept it. –  Joe the Person Apr 26 at 21:44
I would recommend to use bibtex or biblatex to manage your bibliography. Alternatively you can warp the bibliography in \begin{thebibliogrpahy}{99} and \end{thebibliography} and \bibitem before each entry. –  Guido Apr 26 at 22:05

Instead of putting \noindent in front of every item, it is easier to set globally

\parindent=0pt


Furthermore I recommend, that you use either LaTeX's internal thebibliography environment or bibtex.

-

The indentation of the first line for all paragraphs in scope can be set by (see Menke's answer):

\setlength{\parindent}{0pt}


\hangindent has to be repeated for each paragraph. \everypar helps:

\everypar{\setlength{\hangindent}{2.5em}}


But caution is needed, because LaTeX uses \everypar quite often itself, e.g. in \section and friends.

An alternative is moving the paragraphs to the right by setting \leftskip and moving the first line to the left using a negative value for \parindent.

Example file:

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\lipsum[65]

\bigskip

\setlength{\hangindent}{2.5em}
\noindent
\lipsum[65]

\bigskip

\begingroup
\setlength{\parindent}{0pt}%
\everypar{\setlength{\hangindent}{2.5em}}%
\lipsum[65-66]
\par
\endgroup

\bigskip

\begingroup
\par
\setlength{\parindent}{-2.5em}
`