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/tex/latex/addlines/addlines.sty | 71 ++++++++++++++++------- 1 file changed, 51 insertions(+), 20 deletions(-) (limited to 'Master/texmf-dist/tex/latex/addlines') 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