%%
%% 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'.
