diff options
author | Karl Berry <karl@freefriends.org> | 2020-05-19 21:06:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-05-19 21:06:04 +0000 |
commit | 98d69e0965a2ddde92ebcccacddbd6de68e7d2f4 (patch) | |
tree | 17cf01da6f6cbaaf23380d7751f29145a10bfb32 /Master/texmf-dist/source/latex/parskip/parskip.dtx | |
parent | 2683b9f6b43fe0c9b72c32568ccb0ecffd9e6814 (diff) |
parskip (19may20)
git-svn-id: svn://tug.org/texlive/trunk@55212 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/parskip/parskip.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/parskip/parskip.dtx | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/Master/texmf-dist/source/latex/parskip/parskip.dtx b/Master/texmf-dist/source/latex/parskip/parskip.dtx index dd0a6b07dfe..eea08157f68 100644 --- a/Master/texmf-dist/source/latex/parskip/parskip.dtx +++ b/Master/texmf-dist/source/latex/parskip/parskip.dtx @@ -107,6 +107,12 @@ % specify the vertical space between paragraphs. If the option is % not given (or given without a value) then \verb=.5\baselineskip= % plus \texttt{2pt} of stretch is assumed. +% \item[\option{tocskip}] +% By default the \cs{parskip} is zero within \cs{tableofcontents} +% and similar lists, regardless of its value elsewhere. With the +% option \texttt{tocskip} it can be given a different value. If +% used without an explicit value you get the same \cs{parskip} as elsewhere +% within these lists. % \item[\option{indent}] % With the package option \texttt{indent} it is possible to explicitly set % the paragraph indentation. Using this option without a value keeps the @@ -177,7 +183,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesPackage{parskip}[2020-01-22 v2.0d non-zero parskip adjustments] +\ProvidesPackage{parskip}[2020-05-19 v2.0e non-zero parskip adjustments] % \end{macrocode} % % @@ -218,6 +224,14 @@ \DeclareStringOption{skip} % \end{macrocode} % +% The key \option{tocskip} defines the vertical separation inside the lists +% \cs{tableofcontents}, \cs{listoffigures} and \cs{listoftables}. By +% default there is no extra separatation (i.e., \texttt{0pt}). If +% specified without a value the standard \cs{parskip} is used, +% otherwise the given value. +% \begin{macrocode} +\DeclareStringOption[0pt]{tocskip}[\parskip] +% \end{macrocode} % % Execute any package options: % \begin{macrocode} @@ -319,12 +333,39 @@ % Within a table of contents or a list of figures we don't want any % additional vertical spacing just because the individual lines in % such a list are implemented as one-line paragraphs. So we locally -% set the \cs{parskip} to zero. Should be really something that is +% set the \cs{parskip} to zero by default. Should be really something that is % done already in \LaTeX{}. +% \changes{v2.0e}{2020/05/19}{Fix space at start of \cs{@starttoc} (gh/12)} % \begin{macrocode} \patchcmd\@starttoc {\begingroup \makeatletter} - {\begingroup \makeatletter \parskip\z@} + {\begingroup \makeatletter +% \end{macrocode} +% Just setting \cs{parskip} to zero as it was done in the original +% version of the package, does not always work. If the list starts +% out with an ordinary paragraph (and not with \cs{addvspace} as it +% usually does) we will get a zero \cs{parskip} but the heading +% above assumes we get the normal \cs{parskip} and has therefore +% removed that amount from its own vertical skip. As long as the +% parskip value is not too large people didn't notice that heading +% and list moved closer to each other but if you use, say, +% \texttt{[skip=20pt]} you will even see an overlap. +% +% We therefore do the following: we look at the last skip, undo it +% and then issue a skip that is equal to \cs{parskip} + +% \cs{lastskip}. +% This way the skip seen by any following code has the right value +% which is important for \cs{addvspace} calulations. Only then we +% locally set \cs{parskip} to zero or rather to +% \cs{parskip@tocskip}, the parameter that the user can set through +% an option. +% \changes{v2.0e}{2020/05/19}{Add \texttt{tocskip} option} +% \begin{macrocode} + \skip@\lastskip + \advance\skip@\parskip + \vskip-\lastskip + \vskip\skip@ + \parskip\parskip@tocskip} {}{\typeout{Couldn't patch \string\@starttoc}} % \end{macrocode} % |