## LaTeX forum ⇒ General ⇒ Indent full paragraph

LaTeX specific issues not fitting into one of the other forums of this category.
Aurora
Posts: 17
Joined: Thu Jun 28, 2007 3:42 pm

### Indent full paragraph

hi there,

I have a small problem with Latex.
I want to indent a full paragraph, not only the first line. The only solution I found is to use \begin{quote}. I don't like this at all because I don't want an indention at the right site.
Maybe I can create a quote-like environment with left-only indent!?

Thanks for you help!

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm
Location: Colombia
Aurora wrote:Maybe I can create a quote-like environment with left-only indent!?

Sure you can. Try something like the following
\newenvironment{myindentpar}[1]%  {\begin{list}{}%          {\setlength{\leftmargin}{#1}}%          \item[]%  }  {\end{list}}

And use it like this:
\begin{myindentpar}{3cm}text text text...\end{myindentpar}
1,1,2,3,5,8,13,21,34,55,89,144,233,...

Aurora
Posts: 17
Joined: Thu Jun 28, 2007 3:42 pm
Thank you very much. Works great.

But I have some questions for understanding.
• Are the percent-symbols (%) important for functionality?
• in this line: \newenvironment{myindentpar}[1]%. [1] is a variable for the first parameter!?

Thanks so far.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm
Location: Colombia
Aurora wrote:Are the percent-symbols (%) important for functionality?

Not really (in this case).
Aurora wrote:in this line: \newenvironment{myindentpar}[1]%. [1] is a variable for the first parameter!?

[1] indicates that the myindentpar environment has one argument (in this case, the length you want to use to indent your paragraph).
1,1,2,3,5,8,13,21,34,55,89,144,233,...

nieproszenieja
Posts: 9
Joined: Tue Jul 08, 2008 10:25 pm
Location: Wrocław, Poland
There is a better way to do this - command ' \hangindent=length ' (e.g. \hangindent=1cm, etc.) inside paragraph do the trick.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm
Location: Colombia
nieproszenieja wrote:There is a better way to do this - command ' \hangindent=length ' (e.g. \hangindent=1cm, etc.) inside paragraph do the trick.

Please, explain what you mean with better:
\documentclass{article}\usepackage{lipsum} \newenvironment{myindentpar}[1]%{\begin{list}{}%          {\setlength{\leftmargin}{#1}}%          \item[]%}{\end{list}} \begin{document} \lipsum[1] \begin{myindentpar}{1cm}   \lipsum[1]\end{myindentpar} \hangindent=1cm\lipsum[1] \end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...

localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany
nieproszenieja wrote:There is a better way to do this - command ' \hangindent=length ' (e.g. \hangindent=1cm, etc.) inside paragraph do the trick.

In this case the \hangindent command should be combined with the \hangafter command, which sets the number of lines typeset without indentation. The default setting is one line.
\documentclass[11pt,a4paper]{article}\usepackage[T1]{fontenc}\usepackage[latin1]{inputenc}\usepackage[english]{babel}\usepackage[bindingoffset=1cm,centering,includeheadfoot,margin=2cm]{geometry}\usepackage{blindtext}\usepackage{txfonts} \parindent0em \begin{document}   \hangindent2em   \hangafter=0   \blindtext    \medskip   \blindtext\end{document}

The first paragraph is now indented entirely by the given value. Both commands are TeX primitives.

Best regards
Thorsten¹
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

nieproszenieja
Posts: 9
Joined: Tue Jul 08, 2008 10:25 pm
Location: Wrocław, Poland
gmedina wrote:
\documentclass{article}\usepackage{lipsum} \begin{document}%(some code....)\hangindent=1cm\lipsum[1] \end{document}

Replace 1cm with \parindent (\hangindent=\parindent), the result will be quite the same as yours.
You can also put 'setlength{\parindent}{1cm}' before '\hangindent=1cm', then the result will be the same.

EDIT: tex command \hangafter has also one usefull option (from tex refrence card):
\hangafter = (number) start hanging indent after line n.
If n < 0, indent ﬁrst |n| lines.

orey
Posts: 1
Joined: Sat Aug 11, 2012 9:43 am
I had the problem in a resume where I did not want to have the spaces generated by the list solution.
The solution I found was to create an invisible table with no internal space in cells.
%===============Variables\def \constzeroindent {0cm}\def \constfirstindent {0.5cm}\def \constsecondindent {1cm} %===============Macros\newenvironment{mycustomindent}[1]{\setlength{\parindent}{#1}}{\setlength{\parindent}{\constzeroindent}} \newcommand{\myindentedpar}[1]{\begin{mycustomindent}{\constsecondindent}\begin{tabular}{@{}p{17cm}@{}}#1 \\\end{tabular}\end{mycustomindent}} %===============Use\myindentedpar{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}

Advantage is that it is justified.