summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/threadcol/threadcol.sty
blob: a27a5d8644adad5db53938a785d4327f7c87e2b4 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
%%
%% This is file `threadcol.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% threadcol.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 2013 by Scott Pakin <scott+thrcl@pakin.org>
%% 
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3c of this license
%% or (at your option) any later version.  The latest version of this
%% license is in:
%% 
%%    http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{threadcol}
    [2013/01/06 v1.0 Convert columns to PDF article threads]
    \usepackage{threadcol}
\RequirePackage{ifpdf}
\RequirePackage{etoolbox}
\def\thrcl@thread@name{Entire document}
\newcommand*{\setthreadname}{%
  \@ifstar{\gdef\thrcl@thread@name}{\clearpage\gdef\thrcl@thread@name}%
}
\newbox\thrcl@threaded@box
\def\thrcl@box#1{%
  \ifx\thrcl@thread@name\@empty
    \box#1
  \else
    \setbox\thrcl@threaded@box=\vbox{%
      \pdfstartthread name {\thrcl@thread@name}%
      \copy#1
      \pdfendthread
    }%
    \box\thrcl@threaded@box
  \fi
}
\let\thrcl@orig@outputpage=\@outputpage
\def\thrcl@patchcmd#1#2#3{%
  \ifx\thrcl@patches@succeeded Y
    \patchcmd{#1}{#2}{#3}{}{\let\thrcl@patches@succeeded=N}%
  \fi
}
\let\thrcl@outputdblcol=\@outputdblcol
\let\thrcl@outputpage=\@outputpage
\let\thrcl@comdblflelt=\@comdblflelt
\let\thrcl@patches@succeeded=Y
\ifpdf
  \thrcl@patchcmd
    {\thrcl@outputdblcol}%
    {\box\@leftcolumn\hss}%
    {\thrcl@box\@leftcolumn\hss}%
  \thrcl@patchcmd
    {\thrcl@outputdblcol}%
    {\box\@outputbox\hss}%
    {\thrcl@box\@outputbox\hss}%
  \thrcl@patchcmd
    {\thrcl@outputdblcol}%
    {\@outputpage}%
    {\thrcl@orig@outputpage}%
  \thrcl@patchcmd
    {\thrcl@outputdblcol}%
    {\@outputpage}%
    {\thrcl@orig@outputpage}%
  \thrcl@patchcmd
    {\thrcl@outputpage}%
    {\box\@outputbox}%
    {\thrcl@box\@outputbox}%
  \thrcl@patchcmd
    {\thrcl@comdblflelt}%
    {\box}%
    {\thrcl@box}%
  \ifx\thrcl@patches@succeeded Y
    \global\let\@outputdblcol=\thrcl@outputdblcol
    \global\let\@outputpage=\thrcl@outputpage
    \global\let\@comdblflelt=\thrcl@comdblflelt
  \else
    \PackageError{threadcol}{Failed to patch the output routine}{%
      The threadcol package needs to modify LaTeX's
      \protect\@outputdblcol\space macro to\MessageBreak
      incorporate support for PDF article threads.  These
      modifications failed,\MessageBreak
      presumably due to a class or package that redefined
      \protect\@outputdblcol\space in a\MessageBreak
      form incompatible with what threadcol expects.%
    }%
  \fi
\else
  \PackageWarningNoLine{threadcol}{%
    This package has an effect only when running\MessageBreak
    pdfLaTeX or LuaLaTeX and only when in\MessageBreak
    PDF-generating mode%
  }%
\fi
\endinput
%%
%% End of file `threadcol.sty'.