Add tags
LaTeX specific issues not fitting into one of the other forums of this category.
by Aurora on Tue Sep 4th, 2007
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!
-
Aurora
-
- Posts: 17
- Joined: Thu Jun 28th, 2007
by gmedina on Tue Sep 4th, 2007
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 • Open in writeLaTeX
\newenvironment{myindentpar}[1]% {\begin{list}{}% {\setlength{\leftmargin}{#1}}% \item[]% } {\end{list}}
And use it like this: - Code: Select all • Open in writeLaTeX
\begin{myindentpar}{3cm} text text text... \end{myindentpar}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-

gmedina
-
- Posts: 2313
- Joined: Wed Jul 11th, 2007
- Location: Colombia
by Aurora on Tue Sep 4th, 2007
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.
-
Aurora
-
- Posts: 17
- Joined: Thu Jun 28th, 2007
by gmedina on Tue Sep 4th, 2007
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,...
-

gmedina
-
- Posts: 2313
- Joined: Wed Jul 11th, 2007
- Location: Colombia
by nieproszenieja on Tue Jul 8th, 2008
There is a better way to do this - command ' \hangindent=length ' (e.g. \hangindent=1cm, etc.) inside paragraph do the trick.
-
nieproszenieja
-
- Posts: 9
- Joined: Tue Jul 8th, 2008
- Location: Wrocław, Poland
by gmedina on Tue Jul 8th, 2008
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 • Open in writeLaTeX
\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,...
-

gmedina
-
- Posts: 2313
- Joined: Wed Jul 11th, 2007
- Location: Colombia
by localghost on Tue Jul 8th, 2008
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. - Code: Select all • Open in writeLaTeX
\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¹
-

localghost
- Site Moderator
-
- Posts: 8734
- Joined: Fri Feb 2nd, 2007
- Location: Braunschweig, Germany
by nieproszenieja on Wed Jul 9th, 2008
gmedina wrote: - Code: Select all • Open in writeLaTeX
\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 first |n| lines.
-
nieproszenieja
-
- Posts: 9
- Joined: Tue Jul 8th, 2008
- Location: Wrocław, Poland
by orey on Sat Aug 11th, 2012
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. - Code: Select all • Open in writeLaTeX
%===============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.
-
orey
-
- Posts: 1
- Joined: Sat Aug 11th, 2012
Return to General
Users browsing this forum: No registered users and 14 guests
|