| 1 |
\documentclass[a4paper]{ltxdoc} |
| 2 |
\usepackage{hang} |
| 3 |
\usepackage{polyglossia} |
| 4 |
\setdefaultlanguage{english} |
| 5 |
\setotherlanguage{latin} |
| 6 |
\newenvironment{hangingexample}{\medskip\setlength{\hangingleftmargin}{1em}}{\medskip} |
| 7 |
\newenvironment{labeledexample}{\medskip\setlength{\labeledleftmargin}{1em}}{\medskip} |
| 8 |
\newcommand{\lipsum}{\textlatin{Lorem ipsum dolor sit amet, consectetuer |
| 9 |
adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.}} |
| 10 |
\setlength{\parindent}{1em} |
| 11 |
\setlength{\leftmargini}{\parindent} |
| 12 |
\frenchspacing |
| 13 |
\sloppy |
| 14 |
|
| 15 |
\begin{document} |
| 16 |
\title{\textsf{hang} -- environments for hanging \\ |
| 17 |
paragraphs and list items} |
| 18 |
\author{Andreas Nolda} |
| 19 |
\date{2017/02/18 (v.\,2.1)} |
| 20 |
\maketitle |
| 21 |
|
| 22 |
\noindent The \textsf{hang} package provides environments for hanging paragraphs |
| 23 |
and list items. In addition, it defines environments for labeled paragraphs and |
| 24 |
list items. |
| 25 |
|
| 26 |
\section{Hanging paragraphs and list items} |
| 27 |
|
| 28 |
A \emph{hanging} paragraph or list item is a text block where all lines but the |
| 29 |
first one are indented by some \meta{length}: |
| 30 |
|
| 31 |
\begin{hangingexample} |
| 32 |
\begin{hangingpar} |
| 33 |
\lipsum |
| 34 |
\end{hangingpar} |
| 35 |
\end{hangingexample} |
| 36 |
|
| 37 |
\DescribeMacro{\hangingindent} In the following environments, the indentation |
| 38 |
\meta{length} defaults to |1em|. It is controlled by the |\hangingindent| |
| 39 |
length, which can be changed as follows: \begin{quote} |
| 40 |
|\setlength{\hangingindent}{|\meta{length}|}| |
| 41 |
\end{quote} |
| 42 |
|
| 43 |
\DescribeMacro{\hangingleftmargin} The left margin of the whole hanging |
| 44 |
paragraph or list item equals the |\hangingleftmargin| length, which defaults to |
| 45 |
zero. In the above example, it is set to |1em| with |\setlength|. |
| 46 |
|
| 47 |
\subsection{Hanging paragraphs} |
| 48 |
|
| 49 |
\DescribeMacro{hangingpar} The |hangingpar| environment sets \emph{single} |
| 50 |
hanging paragraphs: |
| 51 |
\begin{quote} |
| 52 |
|\begin{hangingpar}| \\ |
| 53 |
\meta{text} \\ |
| 54 |
|\end{hangingpar}| |
| 55 |
\end{quote} |
| 56 |
|
| 57 |
\subsection{Hanging list items} |
| 58 |
|
| 59 |
\DescribeMacro{hanginglist} The |hanginglist| environment sets one or more |
| 60 |
hanging list items: |
| 61 |
\begin{quote} |
| 62 |
|\begin{hanginglist}| \\ |
| 63 |
|\item |\meta{text} \\ |
| 64 |
\vdots \\ |
| 65 |
|\end{hanginglist}| |
| 66 |
\end{quote} |
| 67 |
|
| 68 |
\pagebreak |
| 69 |
\DescribeMacro{compacthang} The |compacthang| environment sets one or more |
| 70 |
hanging list items without vertical space: |
| 71 |
\begin{quote} |
| 72 |
|\begin{compacthang}| \\ |
| 73 |
|\item |\meta{text} \\ |
| 74 |
\vdots \\ |
| 75 |
|\end{compacthang}| |
| 76 |
\end{quote} |
| 77 |
|
| 78 |
\section{Labeled paragraphs and list items} |
| 79 |
|
| 80 |
A \emph{labeled} paragraph or list item consist of a \meta{label} and a text |
| 81 |
block, which is indented by some \meta{length}: |
| 82 |
|
| 83 |
\begin{labeledexample} |
| 84 |
\begin{labeledpar}{\meta{label}}{\meta{label}} |
| 85 |
\lipsum |
| 86 |
\end{labeledpar} |
| 87 |
\end{labeledexample} |
| 88 |
|
| 89 |
The following environments set the indentation \meta{length} to the width of |
| 90 |
their \meta{widest\textunderscore label} argument. |
| 91 |
|
| 92 |
\DescribeMacro{\labeledleftmargin} The left margin of the whole labeled |
| 93 |
paragraph or list item (including the \meta{label}) equals the |
| 94 |
|\labeledleftmargin| length, which defaults to zero, too. In the above example, |
| 95 |
it is again set to |1em|. |
| 96 |
|
| 97 |
\subsection{Labeled paragraphs} |
| 98 |
|
| 99 |
\DescribeMacro{labeledpar} The |labeledpar| environment sets \emph{single} |
| 100 |
labeled paragraphs: |
| 101 |
\begin{quote} |
| 102 |
|\begin{labeledpar}{|\meta{widest\textunderscore label}|}{|\meta{label}|}| \\ |
| 103 |
\meta{text} \\ |
| 104 |
|\end{labeledpar}| |
| 105 |
\end{quote} |
| 106 |
|
| 107 |
\subsection{Labeled list items} |
| 108 |
|
| 109 |
\DescribeMacro{labeledlist} The |labeledlist| environment sets one or more |
| 110 |
labeled list items: |
| 111 |
\begin{quote} |
| 112 |
|\begin{labeledlist}{|\meta{widest\textunderscore label}|}| \\ |
| 113 |
|\item[|\meta{label}|]|\meta{text} \\ |
| 114 |
\vdots \\ |
| 115 |
|\end{labeledlist}| |
| 116 |
\end{quote} |
| 117 |
|
| 118 |
\DescribeMacro{compactlabel} The |compactlabel| environment sets one or more |
| 119 |
labeled list items without vertical space: |
| 120 |
\begin{quote} |
| 121 |
|\begin{compactlabel}{|\meta{widest\textunderscore label}|}| \\ |
| 122 |
|\item[|\meta{label}|]|\meta{text} \\ |
| 123 |
\vdots \\ |
| 124 |
|\end{compactlabel}| |
| 125 |
\end{quote} |
| 126 |
|
| 127 |
\end{document} |