Debian Codegraph @

texmf-dist/doc/latex/listparskip/listparskip_user_guide.tex

raw
1 %%
2 %% This is file `listparskip_user_guide.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% listparskip_code.dtx (with options: `user')
8 %%
9 %% This file is from version 1.0 of the free and open-source
10 %% LaTeX package "listparskip," released December 2024.
11 %%
12 %% Copyright 2024 Conrad Kosowsky
13 %%
14 %% This file may be used, distributed, and modified under the
15 %% terms of the LaTeX Public Project License, version 1.3c or
16 %% any later version. The most recent version of this license
17 %% is available online at
18 %%
19 %% https://www.latex-project.org/lppl/
20 %%
21 %% This work has the LPPL status "maintained," and the current
22 %% maintainer is the package author, Conrad Kosowsky. He can
23 %% be reached at [email protected].
24 %%
25 %% PLEASE KNOW THAT THIS FREE SOFTWARE IS PROVIDED WITHOUT
26 %% ANY WARRANTY. SPECIFICALLY, THE "NO WARRANTY" SECTION OF
27 %% THE LATEX PROJECT PUBLIC LICENSE STATES THE FOLLOWING:
28 %%
29 %% THERE IS NO WARRANTY FOR THE WORK. EXCEPT WHEN OTHERWISE
30 %% STATED IN WRITING, THE COPYRIGHT HOLDER PROVIDES THE WORK
31 %% `AS IS’, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
32 %% OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 %% WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34 %% PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
35 %% OF THE WORK IS WITH YOU. SHOULD THE WORK PROVE DEFECTIVE,
36 %% YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR
37 %% CORRECTION.
38 %%
39 %% IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
40 %% TO IN WRITING WILL THE COPYRIGHT HOLDER, OR ANY AUTHOR
41 %% NAMED IN THE COMPONENTS OF THE WORK, OR ANY OTHER PARTY
42 %% WHO MAY DISTRIBUTE AND/OR MODIFY THE WORK AS PERMITTED
43 %% ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL,
44 %% SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT
45 %% OF ANY USE OF THE WORK OR OUT OF INABILITY TO USE THE WORK
46 %% (INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA, DATA BEING
47 %% RENDERED INACCURATE, OR LOSSES SUSTAINED BY ANYONE AS A
48 %% RESULT OF ANY FAILURE OF THE WORK TO OPERATE WITH ANY
49 %% OTHER PROGRAMS), EVEN IF THE COPYRIGHT HOLDER OR SAID
50 %% AUTHOR OR SAID OTHER PARTY HAS BEEN ADVISED OF THE
51 %% POSSIBILITY OF SUCH DAMAGES.
52 %%
53 %% For more information, see the LaTeX Project Public License.
54 %% Derivative works based on this software may come with their
55 %% own license or terms of use, and the package author is not
56 %% responsible for any third-party software.
57 %%
58 %% Happy TeXing!
59 %%
60 \documentclass[12pt]{article}
61 \usepackage[margin=72.27pt]{geometry}
62 \usepackage[factor=700,stretch=14,shrink=14,step=1]{microtype}
63 \usepackage{booktabs}
64 \usepackage{tabularx}
65 \usepackage{enumitem}
66 \setlist{topsep=\smallskipamount,itemsep=\smallskipamount,
67 parsep=0pt,partopsep=0pt}
68 \usepackage{shortvrb}
69 \MakeShortVerb{|}
70
71 \begin{document}
72
73 \def\documentname{User Guide}
74 \newdimen\MacroIndent
75 \input listparskip_heading.tex
76
77 \noindent Most \LaTeX\ users are familiar with the enumerate and itemize environments, and a number of other environments share the same underlying macros and structure. These list environments are useful and versatile, and they come up in many different situations where fine control over vertical spacing is important.\footnote{There is an overlap in terminology. The list environments described in this document are very different from horizontal and vertical lists in the \TeX\ language.} The dimensions |\topsep|, |\parsep|, |\partopsep|, and |\itemsep| control vertical spacing for list environments, and by default, \LaTeX\ determines the space immediately outside a list as follows:
78 \begin{itemize}
79 \item Always add |\topsep| before and after a list
80 \item Add |\parskip| (not |\parsep|) always before a list and usually after it\footnote{\TeX\ treats any text after a list as the start of a new paragraph, so if the next material to be typeset is text, \TeX\ adds \vrb\parskip\ after the list. If the user includes a box or rule instead of text, it does not trigger the start of a paragraph, and \TeX\ does not add \vrb\parskip.}
81 \item If a list begins outside of a paragraph, add |\partopsep| before and after the list
82 \end{itemize}
83 If |\parskip| is nonzero, for example in a formal letter, it is impossible to include a list inside a paragraph without the inter-paragraph space suggesting that the list forms its own paragraph. (Unless the user manually changes |\parskip| or adds negative vertical glue.) Similarly, \LaTeX\ chooses whether to add |\partopsep| after a list independently of what happens at that point in the source code.
84
85 The \textsf{listparskip} package modifies this behavior by making the |\parskip| and |\partopsep| spacing depend more closely on paragraph structure from the source code. Under \textsf{listparskip} rules, the space around lists happens as follows:
86 \begin{itemize}
87 \item Always add |\topsep| before and after a list
88 \item If a list begins outside of a paragraph, add |\parskip| and |\partopsep| before the list
89 \item If a blank line comes immediately after the list in the source code, always add |\partopsep| and usually add |\parskip|
90 \end{itemize}
91 These changes happen automatically after loading the package, and they allow the user to control whether \TeX\ positions a list environment as its own paragraph or as part of the surrounding paragraph. When |\parskip| and |\partopsep| are both 0pt, this package does nothing, but for an example of what can happen when either dimension is positive, see |listparskip_example.pdf|, which is included with the \textsf{listparskip} installation and is available on \textsc{ctan}. Users can load \textsf{listparskip} with the standard |\usepackage{listparskip}| syntax, and the package has no options.
92
93 \begin{figure}[t]
94 \centerline{\bfseries Table 1: Recommended Source Code to Insert after a List\strut}
95 \begin{tabularx}{\textwidth}{lXX}\toprule
96 Next Material to Typeset & No New Paragraph Desired & New Paragraph Desired \\\midrule
97 Text & Nothing & Blank line \\
98 |\item| & Nothing & Nothing or blank line \\
99 Box or Rule & |\nullline| & Blank line, then |\nullline| \\\bottomrule
100 \end{tabularx}
101 \end{figure}
102
103 \begin{figure}[tb]
104 \centerline{\bfseries Table 2: Space after a List When Using \textsf{listparskip}\strut}
105 \begin{tabularx}{\textwidth}{XX}\toprule
106 Material after a List & Vertical Space Used in Addition to |\topsep|\\\midrule
107 Text* & None \\
108 Box & Don't do this\textsuperscript\ddag \\
109 |\item|*\textsuperscript\dag & $\vrb\parsep+\vrb\itemsep$ \\\midrule
110 Blank line, then text* & $\vrb\partopsep+\vrb\parskip$ \\
111 Blank line, then box & Don't do this\textsuperscript\ddag \\
112 Blank line, then |\item|*\textsuperscript\dag &
113 $\vrb\partopsep+\vrb\parsep+\vrb\itemsep$ \\\midrule
114 |\nullline|, then text & |\parskip| \\
115 |\nullline|, then box* & None \\
116 |\nullline|, then |\item|\textsuperscript\dag &
117 $\vrb\parsep+\vrb\itemsep$ \\\midrule
118 Blank line, then |\nullline|, then text &
119 $\vrb\partopsep+2\vrb\parskip$ \\
120 Blank line, then |\nullline|, then box* &
121 $\vrb\partopsep+\vrb\parskip$ \\
122 Blank line, then |\nullline|, then |\item|\textsuperscript\dag &
123 $\vrb\partopsep+2\vrb\parsep+\vrb\itemsep$ \\
124 \bottomrule
125 \end{tabularx}
126 \smallskip
127 \vbox{\footnotesize\noindent\hskip 1.8em\llap{*}Recommended use.
128
129 \noindent\hskip 1.8em\llap{\textsuperscript\dag}For \vrb\item\ in a nested list, the \vrb\parsep\ and \vrb\itemsep\ refer to the dimensions in the outer list, not the list that just ended.
130
131 \noindent\hskip 1.8em\llap{\textsuperscript\ddag}With \textsf{listparskip}, putting a box after the end of a list environment without text or \vrb\nullline\ previously may mess up vertical spacing or paragraph indentation after the box depending on what comes next.}
132 \end{figure}
133
134 Immediately after the end of a list environment, \textsf{listparskip} expects to see a some text, a blank line followed by text, or an |\item|. As a general rule, text means an extra |\topsep|, and a blank line followed by text leads to an extra $\vrb\topsep+\vrb\partopsep+\vrb\parskip$. If you want to put something else, such as a box or rule, after the end of a list environment, you should type |\nullline| before the other material to prevent any spacing mishaps. This macro instructs \TeX\ to behave like it just encountered a line of text except without adding any vertical space. Table~1 shows my recommendations for code to include after a list in various cases depending on the desired result, and Table~2 shows the full rules for what happens after a list with \textsf{listparskip} in various situations. For more information, see |listparskip_code.pdf|, which is included with the \textsf{listparskip} installation and is available on \textsc{ctan}.
135
136 \end{document}
137 \endinput
138 %%
139 %% End of file `listparskip_user_guide.tex'.