summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/addlines/addlines.sty
blob: 7a7d2b3a28c5541c655657b0c0507e1e17884a0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
%%
%% This is file `addlines.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% addlines.dtx  (with options: `package')
%% 
%%   _______________________________________
%%   Copyright (C) 2007-2018  Will Robertson
%% 
%%   License information appended.
%% 
%% 
\ProvidesPackage{addlines}
  [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{\@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@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{\@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-2018 by Will Robertson <wspr81@gmail.com>
%% 
%% 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 file  addlines.sty.
%% 
%%
%% End of file `addlines.sty'.