General ⇒ Indent full paragraph
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!
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!
NEW: TikZ book now 40% off at Amazon.com for a short time.
Indent full paragraph
Aurora wrote: Maybe I can create a quote-like environment with left-only indent!?
Sure you can. Try something like the following
Code: Select all
\newenvironment{myindentpar}[1]%
{\begin{list}{}%
{\setlength{\leftmargin}{#1}}%
\item[]%
}
{\end{list}}
Code: Select all
\begin{myindentpar}{3cm}
text text text...
\end{myindentpar}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Indent full paragraph
Thank you very much. Works great.
But I have some questions for understanding.
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!?
Indent full paragraph
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,...
-
- Posts: 9
- Joined: Tue Jul 08, 2008 10:25 pm
Re: Indent full paragraph
There is a better way to do this - command ' \hangindent=length ' (e.g. \hangindent=1cm, etc.) inside paragraph do the trick.
Indent full paragraph
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:
Code: Select all
\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: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Indent full paragraph
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.nieproszenieja wrote:There is a better way to do this - command ' \hangindent=length ' (e.g. \hangindent=1cm, etc.) inside paragraph do the trick.
Code: Select all
\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}
Best regards
Thorsten¹
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 9
- Joined: Tue Jul 08, 2008 10:25 pm
Indent full paragraph
Replace 1cm with \parindent (\hangindent=\parindent), the result will be quite the same as yours.gmedina wrote:Code: Select all
\documentclass{article} \usepackage{lipsum} \begin{document} %(some code....) \hangindent=1cm \lipsum[1] \end{document}
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 first |n| lines.
Indent full paragraph
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.
Advantage is that it is justified.
The solution I found was to create an invisible table with no internal space in cells.
Code: Select all
%===============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.}