From 3784b4ecbad18fe0da7a55a937f054e5aa009cee Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 5 Dec 2018 23:00:57 +0000 Subject: addlines (6dec18) git-svn-id: svn://tug.org/texlive/trunk@49326 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/addlines/README | 23 -- Master/texmf-dist/doc/latex/addlines/README.md | 20 ++ .../doc/latex/addlines/addlines-example.ltx | 48 ---- Master/texmf-dist/doc/latex/addlines/addlines.pdf | Bin 137876 -> 135431 bytes .../texmf-dist/source/latex/addlines/addlines.dtx | 249 +++++++++------------ .../texmf-dist/source/latex/addlines/addlines.ins | 44 +--- Master/texmf-dist/tex/latex/addlines/addlines.sty | 71 ++++-- 7 files changed, 178 insertions(+), 277 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/addlines/README create mode 100644 Master/texmf-dist/doc/latex/addlines/README.md delete mode 100644 Master/texmf-dist/doc/latex/addlines/addlines-example.ltx diff --git a/Master/texmf-dist/doc/latex/addlines/README b/Master/texmf-dist/doc/latex/addlines/README deleted file mode 100644 index 379d8f87fa8..00000000000 --- a/Master/texmf-dist/doc/latex/addlines/README +++ /dev/null @@ -1,23 +0,0 @@ -____________________ -The addlines package -v0.2 - -This package provides the command \addlines for adding -or removing space in the textblock of the page it's -used on. E.g., adding an extra line of text to the page -so that a section fits better on the next page. - -It will also add space to the *facing* page in a -two-sided document. - -An inverse command is provided if you prefer it: - \removelines{ x } == \addlines{ -x } - -See addlines.pdf for more info. - -______________ -Will Robertson -wspr 81 [at] gmail [dot] com - -Copyright 2007-2008 -Distributed under the LaTeX Project Public License diff --git a/Master/texmf-dist/doc/latex/addlines/README.md b/Master/texmf-dist/doc/latex/addlines/README.md new file mode 100644 index 00000000000..1d411d4fee2 --- /dev/null +++ b/Master/texmf-dist/doc/latex/addlines/README.md @@ -0,0 +1,20 @@ +The addlines package +==================== + +This package provides the command `\addlines` for adding +or removing space in the textblock of the page it's +used on. E.g., adding an extra line of text to the page +so that a section fits better on the next page. + +It will also add space to the *facing* page in a +two-sided document, and two-column documents are also supported. + +See `addlines.pdf` for more commands and additional info. + + +Copyright and Licence +--------------------- + +* Author: Will Robertson +* Copyright: 2007-2018 +* Distributed under the LaTeX Project Public License v1.3c or later at your choice. diff --git a/Master/texmf-dist/doc/latex/addlines/addlines-example.ltx b/Master/texmf-dist/doc/latex/addlines/addlines-example.ltx deleted file mode 100644 index 78b833c6eab..00000000000 --- a/Master/texmf-dist/doc/latex/addlines/addlines-example.ltx +++ /dev/null @@ -1,48 +0,0 @@ -%% -%% This is file `addlines-example.ltx', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% addlines.dtx (with options: `example') -%% -%% _______________________________________ -%% Copyright (C) 2007-2008 Will Robertson -%% -%% License information appended. -%% -\documentclass[twoside]{article} -\usepackage[a5paper,width=30em,lines=30]{geometry} -\usepackage{lipsum} -\usepackage{addlines} -\begin{document} -\lipsum[1-5] - -\emph{Here is the command used correctly on an even page.} -\addlines - -\lipsum[6-15] - -\emph{Here is the command used erroneously on an odd page.} -\addlines - -\lipsum[16-20] -\end{document} -%% -%% Copyright (C) 2007-2008 by Will Robertson -%% -%% Distributable under the LaTeX Project Public License, -%% version 1.3c or higher (your choice). The latest version of -%% this license is at: http://www.latex-project.org/lppl.txt -%% -%% This work is "maintained" (as per LPPL maintenance status) -%% by Will Robertson. -%% -%% This work consists of the files addlines.dtx and -%% addlines.ins, -%% and the derived files addlines.pdf, -%% addlines.sty, and -%% addlines-example.ltx. -%% -%% -%% End of file `addlines-example.ltx'. diff --git a/Master/texmf-dist/doc/latex/addlines/addlines.pdf b/Master/texmf-dist/doc/latex/addlines/addlines.pdf index 5750611c75d..aeea39f048d 100644 Binary files a/Master/texmf-dist/doc/latex/addlines/addlines.pdf and b/Master/texmf-dist/doc/latex/addlines/addlines.pdf differ diff --git a/Master/texmf-dist/source/latex/addlines/addlines.dtx b/Master/texmf-dist/source/latex/addlines/addlines.dtx index cadadd3d2f6..652e704a545 100644 --- a/Master/texmf-dist/source/latex/addlines/addlines.dtx +++ b/Master/texmf-dist/source/latex/addlines/addlines.dtx @@ -1,83 +1,10 @@ % \iffalse %<*internal> -\iffalse -% -%<*readme> -____________________ -The addlines package -v0.2 - -This package provides the command \addlines for adding -or removing space in the textblock of the page it's -used on. E.g., adding an extra line of text to the page -so that a section fits better on the next page. - -It will also add space to the *facing* page in a -two-sided document. - -An inverse command is provided if you prefer it: - \removelines{ x } == \addlines{ -x } - -See addlines.pdf for more info. - -______________ -Will Robertson -wspr 81 [at] gmail [dot] com - -Copyright 2007-2008 -Distributed under the LaTeX Project Public License -% -%<*internal> -\fi \begingroup -% -%<*batchfile> \input docstrip.tex -\keepsilent -\preamble - - _______________________________________ - Copyright (C) 2007-2008 Will Robertson - - License information appended. - - -\endpreamble -\postamble - -Copyright (C) 2007-2008 by Will Robertson - -Distributable under the LaTeX Project Public License, -version 1.3c or higher (your choice). The latest version of -this license is at: http://www.latex-project.org/lppl.txt - -This work is "maintained" (as per LPPL maintenance status) -by Will Robertson. - -This work consists of the files addlines.dtx and - addlines.ins, - and the derived files addlines.pdf, - addlines.sty, and - addlines-example.ltx. - -\endpostamble -\askforoverwritefalse -\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}} -\generate{\file{\jobname-example.ltx}{\from{\jobname.dtx}{example}}} -% -%\endbatchfile -%<*internal> -\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}} -\nopreamble\nopostamble -\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}} -\generate{\file{prepare.sh}{\from{\jobname.dtx}{prepare}}} +\keepsilent\nopreamble\nopostamble\askforoverwritefalse \generate{\file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}}} \endgroup -\immediate\write18{makeindex -s gind.ist -o \jobname.ind \jobname.idx} -\immediate\write18{makeindex -s gglo.ist -o \jobname.gls \jobname.glo} -% -% -%<*driver> \documentclass{ltxdoc} \EnableCrossrefs \CodelineIndex @@ -86,7 +13,7 @@ This work consists of the files addlines.dtx and \begin{document} \DocInput{addlines.dtx} \end{document} -% +% % \fi % % \GetFileInfo{\jobname.sty} @@ -94,19 +21,21 @@ This work consists of the files addlines.dtx and % \makeatletter % % \title{The \pkg{\jobname} package} -% \author{Will Robertson} +% \author{Will Robertson\\ \url{http://github.com/wspr/will2e}} % \date{\filedate \qquad \fileversion} % % \maketitle % % \noindent % This is a small package that defines a user command for adding lines -% to the current (and facing page, if appropriate). This is intended to be used in the -% final typesetting +% to the current (and facing page, if appropriate) as a wrapper around the +% \LaTeX\ command \cmd\enlargethispage. +% This is intended to be used in the final typesetting % process of a manuscript for running pages long or short in order to % fit their material better (starting a paragraph on the next page, % for example). % +% \DescribeMacro{\addlines} % The \cmd\addlines\ command adds enough vertical space to % the current text block to fit in one more line of text. An optional % argument specifies the number of lines to add; negative numbers @@ -116,18 +45,31 @@ This work consists of the files addlines.dtx and % \begin{tabular}{l>{\itshape\small}l} % |\addlines| & adds one line to the current page height\\ % |\addlines[2]| & adds two lines to the current page\\ -% |\addlines[-1]| & subtracts one line from the current page height +% |\addlines[-0.5]| & subtracts half a line from the current page height % \end{tabular} % \end{center} +% This command should be placed somewhere near the middle of the page +% that it is intending to affect, and not be placed in the middle of +% a paragraph or similar. +% +% \DescribeMacro{\addlines*} +% A starred form of the command (\eg, \verb|\addlines*[2]|) performs +% the same function as above without any checking and only on the current page. +% In two-column mode this command adds lines only to the current \emph{column}. % -% The command should be placed somewhere near the middle of the page -% that it is intending to affect. Too near the top and it may not be -% seen in time (\LaTeX's page breaking routine is asynchronous). +% \DescribeMacro{\squeezepage} +% When needing to break troublesome material on a page, it's sometimes necessary +% to add to the amount of space added by \cmd\addlines, and additionally to ask \LaTeX\ +% to squeeze the paage up (using shrinkability of the vertical boxes). +% When used without an optional argument \cmd\squeezepage\ doesn't add any additional +% space but does try to squeeze the page. +% \cmd\squeezepage\oarg{lines} adds extra space before doing so. % +% \DescribeMacro{\removelines} % For syntactic sugar, \cmd{\addline} is a synonym for \cmd\addlines, % and \cmd{\removeline\textcolor{gray}(s\textcolor{gray})} is the opposite of \cmd\addlines. % -% As alluded to in the introduction, for a double-sided document +% For a double-sided document % (\eg, if the class option |[twoside]| is in % effect) extra height must be added to \emph{both pages} on a spread % for things to look good. If \cmd\addlines\ is called on an even page @@ -135,6 +77,12 @@ This work consists of the files addlines.dtx and % facing page. Conversely, on an odd page (\ie, a \emph{recto} or right-side % page) an error is produced, but the space is still added. % +% For a two-column document the situation is rather more complex --- the \cmd\addlines\ +% call must be located within the first column, and for a twosided twocolumn layout +% it must be the first column of the even page. The package attempts to +% enforce this, calling similar errors if \cmd\addlines\ is found in the wrong +% location in the source. +% % These errors can be suppressed by loading \pkg{addlines} with the |[draft]| % package option. The option that indicates that errors should % be shown is |[final]|; this is activated by default but could be overridden with a |[draft]| @@ -142,7 +90,8 @@ This work consists of the files addlines.dtx and % % \subsection*{Notes} % This command is a wrapper around the more basic command -% \cmd\enlargethispage. It uses the \pkg{changepage} package to check if +% \cmd\enlargethispage\ (for \cmd\addlines) and \verb|\enlargethispage*| (for \cmd\squeezepage). +% It uses the \pkg{changepage} package to check if % the command is called on an even page, and the \pkg{afterpage} % package to add material to a facing odd page if necessary. % @@ -155,40 +104,14 @@ This work consists of the files addlines.dtx and % other packages that modify \LaTeX's output routine (\ie, the % algorithm used to chunk the document into discrete pages). % -% Uses $\varepsilon$-\TeX\ because I'm lazy. -% -% \subsection*{Example document} -% -% \begin{macrocode} -%<*example> -\documentclass[twoside]{article} -\usepackage[a5paper,width=30em,lines=30]{geometry} -\usepackage{lipsum} -\usepackage{addlines} -\begin{document} -\lipsum[1-5] - -\emph{Here is the command used correctly on an even page.} -\addlines - -\lipsum[6-15] - -\emph{Here is the command used erroneously on an odd page.} -\addlines - -\lipsum[16-20] -\end{document} -% -% \end{macrocode} -% % \subsection*{Change history} % \begin{description} % \item[0.1] Initial version implementing the basic commands. % \item[0.2] Switched from \pkg{chngpage} to \pkg{changepage} and added package options |[draft]| and |[final]|. % \item[0.2a] Remove \verb|\usepackage{etex}| for better compatibility with \LaTeX\ 2015. +% \item[0.3] Added \verb|\addlines*|, \verb|\squeezepage|, and two-column support. % \end{description} % -% % % \StopEventually{} % @@ -201,7 +124,7 @@ This work consists of the files addlines.dtx and % % \begin{macrocode} \ProvidesPackage{addlines} - [2015/07/08 v0.2a Add/remove lines from a page] + [2018/12/05 v0.3 Add/remove lines from a page] % \end{macrocode} % % Packages: @@ -221,21 +144,63 @@ This work consists of the files addlines.dtx and % \begin{macro}{\addlines} % \oarg{Number of lines to add to the text height} % \begin{macrocode} -\newcommand\addlines[1][1]{% +\newcommand\addlines{\@ifstar\addlines@a\addlines@b} +\newcommand\addlines@a[1][1]{\addlines@here{#1}} +\newcommand\addlines@b[1][1]{\addlines@do{#1}} +\newcommand\addlines@here[1]{\enlargethispage{#1\baselineskip}} +\newcommand\addlines@do[1]{% + \if@twocolumn + \addlines@twocol{#1}% + \else + \addlines@onecol{#1}% + \fi +} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\addlines@onecol[1]{% + \addlines@here{#1}% + \if@twoside + \checkoddpage + \ifoddpage + \addlines@error{page} + \else + \afterpage{\addlines@here{#1}}% + \fi + \fi} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\addlines@twocol[1]{% \enlargethispage{#1\baselineskip}% - \if@addlines@checkpage@ - \if@twoside - \checkoddpage - \ifoddpage - \PackageError{addlines} - {You're adding lines to the wrong page} - {Extra lines need to be added to both sides of a doublepage spread.^^J - This error might clear up after a recompile, though.}% - \else - \afterpage{\enlargethispage{#1\baselineskip}}% - \fi + \if@firstcolumn + \afterpage{\enlargethispage{#1\baselineskip}}% + \else + \addlines@error{column}% + \fi + \if@twoside + \checkoddpage + \ifoddpage + \addlines@error{page}% + \else + \afterpage{\afterpage{\addlines@here{#1}}}% + \afterpage{\afterpage{\afterpage{\addlines@here{#1}}}}% \fi \fi} +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\addlines@error[1]{% + \if@addlines@checkpage@ + \PackageError{addlines} + {\MessageBreak You're adding lines to the wrong #1} + {Extra lines need to be added to all columns and both sides of a doublepage spread.^^J + This error might clear up after a recompile, though.}% + \fi +} +% \end{macrocode} +% +% \begin{macrocode} \let\addline\addlines % \end{macrocode} % \end{macro} @@ -244,12 +209,21 @@ This work consists of the files addlines.dtx and % \oarg{Number of lines to remove from the text height} % Works with negative numbers through the miracles of $\varepsilon$-\TeX. % \begin{macrocode} -\newcommand\removelines[1][1]{% - \addlines[\numexpr -1*(#1) \relax]} +\newcommand\removelines{\@ifstar\removelines@a\removelines@b} +\newcommand\removelines@a[1][1]{\addlines@here{\numexpr -1*(#1) \relax}} +\newcommand\removelines@b[1][1]{\addlines@do{\numexpr -1*(#1) \relax}} \let\removeline\removelines % \end{macrocode} % \end{macro} % +% \begin{macro}{\squeezepage} +% \oarg{Number of lines to add to the text height} +% \begin{macrocode} +\newcommand\squeezepage[1][0]{\enlargethispage*{#1\baselineskip}} +% \end{macrocode} +% \end{macro} +% +% % Finally, we don't want sloppy page number checking: % \begin{macrocode} \strictpagechecktrue @@ -285,7 +259,8 @@ This work consists of the files addlines.dtx and {\endlist} \usepackage{xcolor} -\usepackage{array,booktabs,calc,enumitem,fancyvrb,addlines,ifthen,refstyle,varioref,titlesec,url} +\usepackage{array,booktabs,calc,enumitem,fancyvrb,ifthen,refstyle,varioref,titlesec,url} +\usepackage{addlines} \usepackage[sc,osf]{mathpazo} @@ -295,11 +270,7 @@ This work consists of the files addlines.dtx and \definecolor{niceblue}{rgb}{0.2,0.4,0.8} \def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}} -\newcommand*\name[1]{{#1}} \newcommand*\pkg[1]{\textsf{#1}} -\newcommand*\feat[1]{\texttt{#1}} -\newcommand*\opt[1]{\texttt{#1}} -\newcommand*\note[1]{\unskip\footnote{#1}} \let\latin\textit \def\eg{\latin{e.g.}} \def\Eg{\latin{E.g.}} @@ -307,25 +278,9 @@ This work consists of the files addlines.dtx and \def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}} \def\CTAN{\textsc{ctan}} -\newcounter{argument} -\g@addto@macro\endmacro{\setcounter{argument}{0}} -\newcommand*\darg[1]{% - \stepcounter{argument}% - {\ttfamily\char`\#\theargument~:~}#1\par\noindent\ignorespaces} -\newcommand*\doarg[1]{% - \stepcounter{argument}% - {\ttfamily\makebox[0pt][r]{[}\char`\#\theargument]:~}#1\par\noindent\ignorespaces} - \def\codeline{\par\hspace{\parindent}}% two \indents in total % \end{macrocode} % -%<*prepare> -rm addlines.zip -latex addlines.dtx -mv README.txt README - -zip addlines.zip addlines.dtx addlines.ins addlines.pdf README -% %\fi % \typeout{*************************************************************} % \typeout{*} diff --git a/Master/texmf-dist/source/latex/addlines/addlines.ins b/Master/texmf-dist/source/latex/addlines/addlines.ins index 28329326489..3eef000b1d7 100644 --- a/Master/texmf-dist/source/latex/addlines/addlines.ins +++ b/Master/texmf-dist/source/latex/addlines/addlines.ins @@ -1,64 +1,30 @@ -%% -%% This is file `addlines.ins', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% addlines.dtx (with options: `batchfile') -%% -%% _______________________________________ -%% Copyright (C) 2007-2008 Will Robertson -%% -%% License information appended. -%% -%% \input docstrip.tex \keepsilent \preamble _______________________________________ - Copyright (C) 2007-2008 Will Robertson + Copyright (C) 2007-2018 Will Robertson License information appended. + \endpreamble \postamble -Copyright (C) 2007-2008 by Will Robertson +Copyright (C) 2007-2018 by Will Robertson Distributable under the LaTeX Project Public License, version 1.3c or higher (your choice). The latest version of this license is at: http://www.latex-project.org/lppl.txt -This work is "maintained" (as per LPPL maintenance status) +This work is "maintained" (as per LPPL maintenance status) by Will Robertson. This work consists of the files addlines.dtx and addlines.ins, - and the derived files addlines.pdf, - addlines.sty, and - addlines-example.ltx. + and the derived file addlines.sty. \endpostamble \askforoverwritefalse \generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}} -\generate{\file{\jobname-example.ltx}{\from{\jobname.dtx}{example}}} \endbatchfile -%% -%% Copyright (C) 2007-2008 by Will Robertson -%% -%% Distributable under the LaTeX Project Public License, -%% version 1.3c or higher (your choice). The latest version of -%% this license is at: http://www.latex-project.org/lppl.txt -%% -%% This work is "maintained" (as per LPPL maintenance status) -%% by Will Robertson. -%% -%% This work consists of the files addlines.dtx and -%% addlines.ins, -%% and the derived files addlines.pdf, -%% addlines.sty, and -%% addlines-example.ltx. -%% -%% -%% End of file `addlines.ins'. diff --git a/Master/texmf-dist/tex/latex/addlines/addlines.sty b/Master/texmf-dist/tex/latex/addlines/addlines.sty index d70134a001d..7a7d2b3a28c 100644 --- a/Master/texmf-dist/tex/latex/addlines/addlines.sty +++ b/Master/texmf-dist/tex/latex/addlines/addlines.sty @@ -7,40 +7,73 @@ %% addlines.dtx (with options: `package') %% %% _______________________________________ -%% Copyright (C) 2007-2008 Will Robertson +%% Copyright (C) 2007-2018 Will Robertson %% %% License information appended. %% +%% \ProvidesPackage{addlines} - [2015/07/08 v0.2a Add/remove lines from a page] + [2018/12/05 v0.3 Add/remove lines from a page] \RequirePackage{afterpage,changepage} \newif\if@addlines@checkpage@ \DeclareOption{final}{\@addlines@checkpage@true} \DeclareOption{draft}{\@addlines@checkpage@false} \ExecuteOptions{final} \ProcessOptions -\newcommand\addlines[1][1]{% +\newcommand\addlines{\@ifstar\addlines@a\addlines@b} +\newcommand\addlines@a[1][1]{\addlines@here{#1}} +\newcommand\addlines@b[1][1]{\addlines@do{#1}} +\newcommand\addlines@here[1]{\enlargethispage{#1\baselineskip}} +\newcommand\addlines@do[1]{% + \if@twocolumn + \addlines@twocol{#1}% + \else + \addlines@onecol{#1}% + \fi +} +\newcommand\addlines@onecol[1]{% + \addlines@here{#1}% + \if@twoside + \checkoddpage + \ifoddpage + \addlines@error{page} + \else + \afterpage{\addlines@here{#1}}% + \fi + \fi} +\newcommand\addlines@twocol[1]{% \enlargethispage{#1\baselineskip}% - \if@addlines@checkpage@ - \if@twoside - \checkoddpage - \ifoddpage - \PackageError{addlines} - {You're adding lines to the wrong page} - {Extra lines need to be added to both sides of a doublepage spread.^^J - This error might clear up after a recompile, though.}% - \else - \afterpage{\enlargethispage{#1\baselineskip}}% - \fi + \if@firstcolumn + \afterpage{\enlargethispage{#1\baselineskip}}% + \else + \addlines@error{column}% + \fi + \if@twoside + \checkoddpage + \ifoddpage + \addlines@error{page}% + \else + \afterpage{\afterpage{\addlines@here{#1}}}% + \afterpage{\afterpage{\afterpage{\addlines@here{#1}}}}% \fi \fi} +\newcommand\addlines@error[1]{% + \if@addlines@checkpage@ + \PackageError{addlines} + {\MessageBreak You're adding lines to the wrong #1} + {Extra lines need to be added to all columns and both sides of a doublepage spread.^^J + This error might clear up after a recompile, though.}% + \fi +} \let\addline\addlines -\newcommand\removelines[1][1]{% - \addlines[\numexpr -1*(#1) \relax]} +\newcommand\removelines{\@ifstar\removelines@a\removelines@b} +\newcommand\removelines@a[1][1]{\addlines@here{\numexpr -1*(#1) \relax}} +\newcommand\removelines@b[1][1]{\addlines@do{\numexpr -1*(#1) \relax}} \let\removeline\removelines +\newcommand\squeezepage[1][0]{\enlargethispage*{#1\baselineskip}} \strictpagechecktrue %% -%% Copyright (C) 2007-2008 by Will Robertson +%% Copyright (C) 2007-2018 by Will Robertson %% %% Distributable under the LaTeX Project Public License, %% version 1.3c or higher (your choice). The latest version of @@ -51,9 +84,7 @@ %% %% This work consists of the files addlines.dtx and %% addlines.ins, -%% and the derived files addlines.pdf, -%% addlines.sty, and -%% addlines-example.ltx. +%% and the derived file addlines.sty. %% %% %% End of file `addlines.sty'. -- cgit v1.2.3