From 888bef52c1122e0eff8825c0255ceae0fdeb8202 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 24 Feb 2019 22:52:49 +0000 Subject: commedit (24feb19) git-svn-id: svn://tug.org/texlive/trunk@50116 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/commedit/commedit.sty | 388 ++++++++++++++++++++++ 1 file changed, 388 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/commedit/commedit.sty (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/commedit/commedit.sty b/Master/texmf-dist/tex/latex/commedit/commedit.sty new file mode 100644 index 00000000000..c509575fe5d --- /dev/null +++ b/Master/texmf-dist/tex/latex/commedit/commedit.sty @@ -0,0 +1,388 @@ +%% +%% This is file `commedit.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% commedit.dtx (with options: `style') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from commedit.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file commedit.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% Copyright 2018-2019, Boris Veytsman +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any +%% later version. +%% The latest version of the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Boris Veytsman +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{commedit} +[2019/01/21 v1.02 Commented editions with LaTeX] +\newif\ifCommentedEdition +\CommentedEditionfalse +\newwrite\@commeditout +\AtEndDocument{\ifCommentedEdition\else + \cleardoublepage + \immediate\write\@commeditout{\string\end{commentsBox}}% + \immediate\write\@commeditout{\string\end{document}}% + \closeout\@commeditout +\fi} +\begingroup% +\@tempcnta=1 +\loop + \catcode\@tempcnta=12 % + \advance\@tempcnta\@ne % +\ifnum\@tempcnta<32 % +\repeat % +\catcode`\*=11 % +\catcode`\^^M\active% +\catcode`\^^L\active\let^^L\relax% +\catcode`\^^I\active% +\gdef\@write@comments{% + \let\do\@makeother\dospecials% + \count@ 128\relax% + \loop% + \catcode\count@ 11\relax% + \advance\count@ \@ne% + \ifnum\count@<\@cclvi% + \repeat% + \edef\E{\@backslashchar end\string{\@currenvir\string}}% + \edef\reserved@b{% + \def\noexpand\reserved@b% + ####1\E####2\E####3\relax}% + \reserved@b{% + \ifx\relax##3\relax% + \write\@commeditout{##1}% + \else% + \edef^^M{\noexpand\end{\@currenvir}}% + \ifx\relax##1\relax% + \else% + \@latex@warning{Writing text `##1' before % + \string\end{\@currenvir}\MessageBreak as last line of \@currenvir}% + \write\@commeditout{##1}% + \fi% + \ifx\relax##2\relax% + \else% + \@latex@warning{% + Ignoring text `##2' after \string\end{\@currenvir}}% + \fi% + \fi% + ^^M}% + \catcode`\^^L\active% + \let\L\@undefined% + \def^^L{\@ifundefined L^^J^^J^^J}% + \catcode`\^^I\active% + \let\I\@undefined% + \def^^I{\@ifundefined I\space\space}% + \catcode`\^^M\active% + \edef^^M##1^^M{% + \noexpand\reserved@b##1\E\E\relax}}% +\endgroup% +\begingroup% +\@tempcnta=1 +\loop + \catcode\@tempcnta=12 % + \advance\@tempcnta\@ne % +\ifnum\@tempcnta<32 % +\repeat % +\catcode`\*=11 % +\catcode`\^^M\active% +\catcode`\^^L\active\let^^L\relax% +\catcode`\^^I\active% +\gdef\immediate@write@comments{% + \let\do\@makeother\dospecials% + \count@ 128\relax% + \loop% + \catcode\count@ 11\relax% + \advance\count@ \@ne% + \ifnum\count@<\@cclvi% + \repeat% + \edef\E{\@backslashchar end\string{\@currenvir\string}}% + \edef\reserved@b{% + \def\noexpand\reserved@b% + ####1\E####2\E####3\relax}% + \reserved@b{% + \ifx\relax##3\relax% + \immediate\write\@commeditout{##1}% + \else% + \edef^^M{\noexpand\end{\@currenvir}}% + \ifx\relax##1\relax% + \else% + \@latex@warning{Writing text `##1' before % + \string\end{\@currenvir}\MessageBreak as last line of \@currenvir}% + \immediate\write\@commeditout{##1}% + \fi% + \ifx\relax##2\relax% + \else% + \@latex@warning{% + Ignoring text `##2' after \string\end{\@currenvir}}% + \fi% + \fi% + ^^M}% + \catcode`\^^L\active% + \let\L\@undefined% + \def^^L{\@ifundefined L^^J^^J^^J}% + \catcode`\^^I\active% + \let\I\@undefined% + \def^^I{\@ifundefined I\space\space}% + \catcode`\^^M\active% + \edef^^M##1^^M{% + \noexpand\reserved@b##1\E\E\relax}}% +\endgroup% +\def\commeditPreamble#1{\immediate\closeout\@commeditout + \immediate\openout\@commeditout=#1 + \immediate@write@comments} +\def\endcommeditPreamble{% + \immediate\write\@commeditout{\string\usepackage{commedit}}% + \immediate\write\@commeditout{\string\CommentedEditiontrue}% + \immediate\write\@commeditout{\string\def\string\BaseEditionName{\jobname}}% + \immediate\write\@commeditout{\string\usepackage{graphicx}}% + \immediate\write\@commeditout{\string\usepackage[strict]{changepage}}% + \immediate\write\@commeditout{\string\begin{document}}% + \immediate\write\@commeditout{\string\begin{commentsBox}}} +\def\commeditComments{\@write@comments} +\def\endcommeditComments{% + \write\@commeditout{\string\par}} +\def\commeditText{\clearpage + \immediate\write\@commeditout{\string\end{commentsBox}}% +\immediate@write@comments} +\def\endcommeditText{% + \immediate\write\@commeditout{\string\par}% + \immediate\write\@commeditout{\string\begin{commentsBox}}} +\newcount\@commedit@base@pageno +\@commedit@base@pageno=1\relax +\RequirePackage{everyshi} +\newcommand\@EveryShipoutEnd@Hook{\ifCommentedEdition\else + \immediate\write\@commeditout{\string\end{commentsBox}}% + \immediate\write\@commeditout{\string\typesetComments{\the\@commedit@base@pageno}}% + \immediate\write\@commeditout{\string\begin{commentsBox}}% + \global\advance\@commedit@base@pageno by 1\relax +\fi} +\renewcommand{\@EveryShipout@Output}{% + \@EveryShipout@Hook% + \@EveryShipout@AtNextHook% + \gdef\@EveryShipout@AtNextHook{}% + \@EveryShipout@Org@Shipout\box\@cclv\relax + \@EveryShipoutEnd@Hook% + } +\RequirePackage{etoolbox} +\AtEndPreamble{\ifCommentedEdition + \begingroup\@floatplacement\@dblfloatplacement + \makeatletter\let\@writefile\@gobbletwo + \global \let \@multiplelabels \relax + \@input{\BaseEditionName.aux}\endgroup + \fi} +\newlength\commentscolskip +\setlength\commentscolskip{6mm} +\newlength\commentscolwidth +\setlength\commentscolwidth{55.5mm} +\newlength\commentscolTheight +\setlength\commentscolTheight{256mm} +\newlength\commentscolSheight +\setlength\commentscolSheight{58mm} +\newlength\basepageboxwidth +\setlength\basepageboxwidth{153mm} +\def\basepageargs#1{\gdef\@basepageargs{#1}} +\basepageargs{} +\def\commentsOddPageSetup#1#2#3{% + \gdef\@commeditOddLeftCols{#1}% + \gdef\@commeditOddMiddleCols{#2}% + \gdef\@commeditOddRightCols{#3}} +\commentsOddPageSetup{0}{2}{1} +\def\commentsEvenPageSetup#1#2#3{% + \gdef\@commeditEvenLeftCols{#1}% + \gdef\@commeditEvenMiddleCols{#2}% + \gdef\@commeditEvenRightCols{#3}} +\commentsEvenPageSetup{1}{2}{0} +\def\commentsContinuationPageSetup#1{% + \gdef\@commeditContinuationCols{#1}} +\commentsContinuationPageSetup{3} +\let\@commentstexttop\relax +\let\@commentstextbottom\relax +\def\commentsraggedbottom{% + \def\@commentstextbottom{\vskip \z@ \@plus.0001fil}% + \let\@commentstexttop\relax} +\commentsraggedbottom +\def\commentsflushbottom{% + \let\@commentstextbottom\relax + \let\@commentstexttop\relax} +\newbox\@tempboxb +\def\commentsHook#1{\gdef\@commentsHook{#1}} +\commentsHook{} +\newbox\@commedit@box +\newbox\@commentsfootins +\long\def\@commentsfootnotetext#1{% + \global\setbox\@commentsfootins\vbox{% + \unvbox\@commentsfootins + \reset@font\footnotesize + \hsize\commentscolwidth + \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup}} +\def\comments@xfloat#1[#2]{% + \@nodocument + \def \@captype {#1}% + \setbox\@tempboxb + \color@vbox + \normalcolor + \vbox \bgroup + \hsize\columnwidth + \@parboxrestore + \@floatboxreset} +\def\comments@end@float{% + \@endfloatbox + \vskip \intextsep + \box\@tempboxb + \penalty\interlinepenalty + \vskip\intextsep} +\def\commentsBox{\hsize=\commentscolwidth\global\setbox\@commedit@box=\vbox\bgroup + \let\@footnotetext=\@commentsfootnotetext + \let\@dblfloat\@float + \let\@xfloat=\comments@xfloat + \let\end@float\comments@end@float + \let\end@dblfloat\comments@end@float + \let\columnwidth=\commentscolwidth + \normalsize\normalfont + \@commentsHook + \unvbox\@commedit@box} +\def\endcommentsBox{\egroup} +\newbox\@commedit@pagebox +\def\typesetComments#1{\clearpage\bgroup + \let\columnwidth=\commentscolwidth + \setbox\@commedit@pagebox=\hbox{}\splittopskip=\z@\topskip=\z@ + \ifvoid\@commentsfootins\else + \setbox\@commedit@box=\vbox{\unvbox\@commedit@box + \vskip \skip\footins + \color@begingroup + \normalcolor + \footnoterule + \unvbox \@commentsfootins + \color@endgroup}% + \fi + \setbox\@commedit@box=\vbox{\unvbox\@commedit@box\vfill}% + \checkoddpage\ifoddpage + \global\def\@commeditLeftCols{\@commeditOddLeftCols}% + \global\def\@commeditMiddleCols{\@commeditOddMiddleCols}% + \global\def\@commeditRightCols{\@commeditOddRightCols}% + \else + \global\def\@commeditLeftCols{\@commeditEvenLeftCols}% + \global\def\@commeditMiddleCols{\@commeditEvenMiddleCols}% + \global\def\@commeditRightCols{\@commeditEvenRightCols}% + \fi + \ifnum\@commeditLeftCols>0\relax + \@tempcnta=\@commeditLeftCols\relax + \loop + \setbox\@tempboxb=\vsplit\@commedit@box to + \commentscolTheight\relax + \setbox\@tempboxb=\vbox to \commentscolTheight{% + \@commentstexttop + \unvbox\@tempboxb + \@commentstextbottom}% + \setbox\@commedit@pagebox=\hbox{\noindent\box\@commedit@pagebox + \box\@tempboxb + \hskip\commentscolskip\relax}% + \global\setbox\@commedit@box=\box\@commedit@box + \advance\@tempcnta by -1\relax + \ifnum\@tempcnta>0\repeat + \fi + \setbox\@tempboxa=\hbox{}% + \ifnum\@commeditMiddleCols>0\relax + \@tempcnta=\@commeditMiddleCols\relax + \loop + \setbox\@tempboxb=\vsplit\@commedit@box to + \commentscolSheight\relax + \setbox\@tempboxb=\vbox to \commentscolSheight{% + \@commentstexttop + \unvbox\@tempboxb + \@commentstextbottom}% + \setbox\@tempboxa=\hbox{\noindent\box\@tempboxa + \box\@tempboxb}% + \global\setbox\@commedit@box=\box\@commedit@box + \advance\@tempcnta by -1\relax + \ifnum\@tempcnta>0\relax + \setbox\@tempboxa=\hbox{\noindent\box\@tempboxa + \hskip\commentscolskip\relax}% + \repeat + \fi + \ifx\@basepageargs\@empty\relax + \def\@commedit@args{page=#1}% + \else + \edef\@commedit@args{page=#1,\@basepageargs}% + \fi + \hsize=\basepageboxwidth + \setbox\@tempboxa=\vbox to \commentscolTheight \bgroup + \hbox{\fbox{\noindent\expandafter\includegraphics\expandafter[\@commedit@args]{\BaseEditionName.pdf}}}% + \vfill\box\@tempboxa\egroup + \setbox\@commedit@pagebox=\hbox{\box\@commedit@pagebox + \box\@tempboxa}% + \ifnum\@commeditRightCols>0\relax + \@tempcnta=\@commeditRightCols\relax + \loop + \setbox\@tempboxb=\vsplit\@commedit@box to + \commentscolTheight\relax + \setbox\@tempboxb=\vbox to \commentscolTheight{% + \@commentstexttop + \unvbox\@tempboxb + \@commentstextbottom}% + \setbox\@commedit@pagebox=\hbox{\noindent\box\@commedit@pagebox + \hskip\commentscolskip\relax + \box\@tempboxb}% + \global\setbox\@commedit@box=\box\@commedit@box + \advance\@tempcnta by -1\relax + \ifnum\@tempcnta>0\repeat + \fi + \noindent\box\@commedit@pagebox\par + \global\setbox\@commedit@box=\box\@commedit@box + \egroup\vfill\clearpage + \ifdim\ht\@commedit@box>\baselineskip + \typesetContinuation\fi} +\def\typesetContinuation{\clearpage\bgroup + \setbox\@commedit@pagebox=\hbox{}\splittopskip=\z@\relax + \@tempcnta=\@commeditContinuationCols\relax + \loop + \setbox\@tempboxb=\vsplit\@commedit@box to + \commentscolTheight\relax + \setbox\@tempboxb=\vbox to \commentscolTheight{% + \@commentstexttop + \unvbox\@tempboxb + \@commentstextbottom}% + \setbox\@commedit@pagebox=\hbox{\noindent\box\@commedit@pagebox + \box\@tempboxb}% + \global\setbox\@commedit@box=\box\@commedit@box + \advance\@tempcnta by -1\relax + \ifnum\@tempcnta>0\relax + \setbox\@commedit@pagebox=\hbox{\noindent\box\@commedit@pagebox + \hskip\commentscolskip\relax}% + \repeat + \noindent\box\@commedit@pagebox\par + \global\setbox\@commedit@box=\box\@commedit@box + \egroup\vfill\clearpage + \ifdim\ht\@commedit@box>\baselineskip + \typesetContinuation\fi} +\endinput +%% +%% End of file `commedit.sty'. -- cgit v1.2.3