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/doc/latex/commedit/README | 8 + Master/texmf-dist/doc/latex/commedit/commedit.pdf | Bin 0 -> 309334 bytes Master/texmf-dist/doc/latex/commedit/commented.pdf | Bin 0 -> 233131 bytes Master/texmf-dist/doc/latex/commedit/sample.pdf | Bin 0 -> 89582 bytes Master/texmf-dist/doc/latex/commedit/sample.tex | 186 ++++ Master/texmf-dist/doc/latex/commedit/vitruvian.jpg | Bin 0 -> 63756 bytes Master/texmf-dist/source/latex/commedit/Makefile | 74 ++ .../texmf-dist/source/latex/commedit/commedit.dtx | 1068 ++++++++++++++++++++ .../texmf-dist/source/latex/commedit/commedit.ins | 28 + Master/texmf-dist/tex/latex/commedit/commedit.sty | 388 +++++++ 10 files changed, 1752 insertions(+) create mode 100644 Master/texmf-dist/doc/latex/commedit/README create mode 100644 Master/texmf-dist/doc/latex/commedit/commedit.pdf create mode 100644 Master/texmf-dist/doc/latex/commedit/commented.pdf create mode 100644 Master/texmf-dist/doc/latex/commedit/sample.pdf create mode 100644 Master/texmf-dist/doc/latex/commedit/sample.tex create mode 100644 Master/texmf-dist/doc/latex/commedit/vitruvian.jpg create mode 100644 Master/texmf-dist/source/latex/commedit/Makefile create mode 100644 Master/texmf-dist/source/latex/commedit/commedit.dtx create mode 100644 Master/texmf-dist/source/latex/commedit/commedit.ins create mode 100644 Master/texmf-dist/tex/latex/commedit/commedit.sty (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/commedit/README b/Master/texmf-dist/doc/latex/commedit/README new file mode 100644 index 00000000000..ef29c81102c --- /dev/null +++ b/Master/texmf-dist/doc/latex/commedit/README @@ -0,0 +1,8 @@ + Creation commented edition with LaTeX + + Boris Veytsman + +This package is intended for commented editions. An example of +commented edition is a teacher's book based on a student's +textbook. Each page of a teacher's book is a page from the textbook +and comments for the teacher. diff --git a/Master/texmf-dist/doc/latex/commedit/commedit.pdf b/Master/texmf-dist/doc/latex/commedit/commedit.pdf new file mode 100644 index 00000000000..3d57c862374 Binary files /dev/null and b/Master/texmf-dist/doc/latex/commedit/commedit.pdf differ diff --git a/Master/texmf-dist/doc/latex/commedit/commented.pdf b/Master/texmf-dist/doc/latex/commedit/commented.pdf new file mode 100644 index 00000000000..963da35e9b8 Binary files /dev/null and b/Master/texmf-dist/doc/latex/commedit/commented.pdf differ diff --git a/Master/texmf-dist/doc/latex/commedit/sample.pdf b/Master/texmf-dist/doc/latex/commedit/sample.pdf new file mode 100644 index 00000000000..3720cb05247 Binary files /dev/null and b/Master/texmf-dist/doc/latex/commedit/sample.pdf differ diff --git a/Master/texmf-dist/doc/latex/commedit/sample.tex b/Master/texmf-dist/doc/latex/commedit/sample.tex new file mode 100644 index 00000000000..c213b45f0bf --- /dev/null +++ b/Master/texmf-dist/doc/latex/commedit/sample.tex @@ -0,0 +1,186 @@ +\documentclass{book} +\usepackage[papersize={204mm,275mm}, top=17mm, +bottom=17mm, outer=22mm, inner=20mm, includeheadfoot=false]{geometry} +\usepackage{lipsum} +\usepackage{commedit} +\clearpage +\begin{commeditPreamble}{commented.tex} + \documentclass{book} + \usepackage[papersize={230mm,288mm}, top=15mm, + bottom=17mm, outer=11mm, inner=4.5mm, includeheadfoot=false]{geometry} + \usepackage{kantlipsum} + \usepackage{ragged2e} + \usepackage{booktabs} + \usepackage{commedit} + \basepageargs{width=140mm} + \commentsHook{\RaggedRight\parskip=0pt\parindent=1em\relax} +\end{commeditPreamble} + +\begin{commeditText} + \frontmatter + \title{Commented edition} + \author{Boris Veytsman} + \date{November 2018} + \maketitle + + \chapter{Introduction} + \label{sec:intro-commented} + + This is the introuduction for the commented edition. Note that we + use \textsl{lipsum} for the base edition and \textsl{kantlipsum} for + the commented edition. + + Some gibberish\footnote{We can use footnotes here.}\ldots + + \kant[6-20] + + \mainmatter + + \chapter{First chapter} + \label{sec:first-commented} +\end{commeditText} + +\begin{document} +\frontmatter +\title{Base edition} +\author{Boris Veytsman} +\date{November 2018} +\maketitle + +\chapter{Foreword} +\label{chap:foreword} + +The foreword for the base edition + +\lipsum[1-5] + +\begin{commeditText} + + Now we switch back to the commented edition\footnote{A footnote}. + + Some equation in the text. + \begin{equation} + \label{eq:pi} + e^{i\pi}=-1, + \end{equation} + and another one + \begin{equation} + \label{eq:sin} + sin^2\phi+\cos^2\phi=1. + \end{equation} + + And more gibberish: + + \kant[5-12] + +\end{commeditText} + +\mainmatter + +\chapter{Some thoughts} +\label{chap:thoughts} + +Here we switch back to the base edition. +\begin{commeditComments} + Comments for the chapter~\ref{chap:thoughts} of the base + edition\footnote{A footnote}. + \begin{equation} + e=mc^2 + \end{equation} + \kant[6] +\end{commeditComments} + +An equation for the base edition: +\begin{equation} + \label{eq:Einstein} + e=mc^2. +\end{equation} + +And pseudo-lating gibberish. + +\lipsum[6-12] + + +\begin{commeditComments} + We can reference base equation~(\ref{eq:Einstein}) on base + page~(\pageref{eq:Einstein}) and commented edition + equations~(\ref{eq:pi}) and (\ref{eq:sin}) on the commented edition + page~(\pageref{eq:pi}). + + More gibberish\footnote{A footnote for the comments.}. + + \kant[7] +\end{commeditComments} + +More gibberish for base edition. + +\lipsum[15-17] + +\begin{commeditComments} + Comments. + \kant[4] + \begin{equation} + u=v\cdot a + \end{equation} +\end{commeditComments} + +\lipsum[3-2] + +\begin{commeditComments} + \begin{itemize} + \item item + \item item + \item item + \end{itemize} + + + \pagebreak + More comments. Note the continuation pages\ldots + \kant[8-20] +\end{commeditComments} + +\lipsum[9-20] + +\begin{commeditComments} + Here we add a figure. + + \begin{figure} + \centering + \includegraphics[width=\columnwidth]{vitruvian} + \caption{Vitruvian man} + \label{fig:vitruvian} + \end{figure} + + There is no difference between starred and unstarred floats + \begin{table*} + \centering + \begin{tabular}{ll} + \toprule + Gnus & Gnats\\ + \midrule + 12 & 20\\ + 24 & 10\\ + \bottomrule + \end{tabular} + \caption{A table} + \label{tab:table} + \end{table*} + +\end{commeditComments} + +\begin{commeditText} + \section{Final text} + + + Here we add a real float. Note that it floats to the top of the + page. + + \begin{figure}[t] + \centering + \includegraphics[width=.5\columnwidth]{vitruvian} + \caption{Another vitruvian man} + \label{fig:vitruvian1} + \end{figure} +\end{commeditText} + +\end{document} diff --git a/Master/texmf-dist/doc/latex/commedit/vitruvian.jpg b/Master/texmf-dist/doc/latex/commedit/vitruvian.jpg new file mode 100644 index 00000000000..406573b7d0e Binary files /dev/null and b/Master/texmf-dist/doc/latex/commedit/vitruvian.jpg differ diff --git a/Master/texmf-dist/source/latex/commedit/Makefile b/Master/texmf-dist/source/latex/commedit/Makefile new file mode 100644 index 00000000000..b78bfb28310 --- /dev/null +++ b/Master/texmf-dist/source/latex/commedit/Makefile @@ -0,0 +1,74 @@ +# +# Makefile for commedit package +# +# This file is in public domain +# +# $Id: Makefile,v 1.2 2012-02-25 21:06:49 boris Exp $ +# + +PACKAGE=commedit + +SAMPLESTEX = sample.tex + +SAMPLESPDF = ${SAMPLESTEX:%.tex=%.pdf} commented.pdf + +all: $(PACKAGE).pdf $(SAMPLESPDF) + + +%.pdf: %.dtx $(PACKAGE).sty + pdflatex $< + - bibtex $* + pdflatex $< + - makeindex -s gind.ist -o $*.ind $*.idx + - makeindex -s gglo.ist -o $*.gls $*.glo + pdflatex $< + while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log) \ + do pdflatex $<; done + + +%.pdf: %.tex $(PACKAGE).sty + pdflatex $< + - bibtex $* + pdflatex $< + - makeindex -o $*.ind $*.idx + pdflatex $< + while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log) \ + do pdflatex $<; done + +commented.tex: sample.tex + pdflatex $< + +%.sty: %.ins %.dtx + pdflatex $< + + + +.PRECIOUS: $(PACKAGE).cfg $(PACKAGE).sty + + +clean: + $(RM) *.sty *.log *.aux \ + *.cfg *.glo *.idx *.toc \ + *.ilg *.ind *.out *.lof \ + *.lot *.bbl *.blg *.gls \ + *.dvi *.ps *.hd commented.tex + +distclean veryclean: clean + $(RM) *.pdf + +# +# Archive for the distribution. Includes typeset documentation +# +archive: all clean + COPYFILE_DISABLE=1 tar -C .. -czvf ../$(PACKAGE).tgz \ + --exclude '*~' --exclude '*.tgz' --exclude .git \ + --exclude .gitignore $(PACKAGE) ;\ + mv ../$(PACKAGE).tgz .; + +zip: all clean + ${MAKE} ${PACKAGE}.sty + ${RM} *.log + cd .. && zip -r ${PACKAGE}.zip ${PACKAGE} \ + -x '*/.git' -x '*/.gitignore' \ + -x '*/.git/*' -x '*/.gitignore' \ + -x '*/*.ins' diff --git a/Master/texmf-dist/source/latex/commedit/commedit.dtx b/Master/texmf-dist/source/latex/commedit/commedit.dtx new file mode 100644 index 00000000000..f60bcf8660a --- /dev/null +++ b/Master/texmf-dist/source/latex/commedit/commedit.dtx @@ -0,0 +1,1068 @@ +% \iffalse +% +%% 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 +%% +% \begin{macrocode} +% +%<*gobble> +% \fi +% \CheckSum{0} +% +% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +% +%\iffalse +% \begin{macrocode} +\documentclass{ltxdoc} +\usepackage{hypdoc} +\usepackage{tikz} +\PageIndex +\CodelineIndex +\RecordChanges +\EnableCrossrefs +\begin{document} + \DocInput{commedit.dtx} +\end{document} +% \end{macrocode} +% +% \fi +% \MakeShortVerb{|} +% \GetFileInfo{commedit.dtx} +% +% +% \title{Creating commented editions\thanks{\copyright 2018--2019 +% Boris Veytsman} +% \thanks{This package was commissined by Instituto de Matem\'atica +% Pura e Aplicada, \url{https://impa.br}}} +% \author{Boris Veytsman \thanks{borisv@lk.net}} +% \date{\filedate, \fileversion} +% \maketitle +% +% \begin{abstract} +% The \textsl{commedit} package is intended to typeset commented editions. +% \end{abstract} +% +% \tableofcontents +% +% \clearpage +% +%\section{Introduction} +%\label{sec:intro} +% +% This package is intended for commented editions. An example of +% commented edition is a teacher's book based on a student's +% textbook. Each page of a teacher's book is a page from the textbook +% \emph{and} comments for the teacher. +% +% \begin{figure} +% \centering +% \begin{tikzpicture} +% \draw (0,0) rectangle node {Comments} (2,8); +% \draw (2.2, 2) rectangle node {Base page} (6.4, 8); +% \draw (2.2, 0) rectangle node {Comments} (4.2, 1.8); +% \draw (4.4, 0) rectangle node {Comments} (6.4, 1.8); +% \end{tikzpicture} +% \caption{A page of a commented edition. This page has one +% ``tall'' and two ``short'' columns.} +% \label{fig:commented_edition} +% \end{figure} +% +% The aim is to have a single source for two books: the ``base'' +% edition and the commented edition, which reproduces the pages from +% the base one and adds comments around it (see +% Figure~\ref{fig:commented_edition}). In fact, commented edition can +% have both base pages with comments, and ``normal'' pages with free +% text. +% +% The implementation of this idea is the following. We insert into +% the base file comments in the form +% \begin{verbatim} +% \begin{commeditComments} +% ... +% \end{commeditComments} +% \end{verbatim} +% +% Processing the base source gives us the base PDF file \emph{and} the +% commented edition \path{.tex} file. Processing the latter gives us +% the commented edition. +% +% During the processing the base PDF file must be present, +% since the commented edition uses it to extract the pages to include +% into the output. You also need the base AUX file to process the +% labels in the base documents. +% +% +%\section{User manual} +%\label{sec:user_manual} +% +% +%\subsection{Document structure} +%\label{sec:ug_structure} +% +% +% +% \begin{figure} +% \centering +% \begin{verbatim} +% \documentclass... % Document class for the main edition +% ... +% \usepackage{commedit} +% \begin{commeditPreamble}{filename} +% \documentclass... % Document class for the main edition +% \usepackage{commedit} +% Preamble for commented edition +% \end{commeditPreamble} +% ... +% \begin{document} +% +% \begin{commeditText} +% Text for the commented edition +% \end{commeditText} +% +% Base text +% Base text +% ... +% \begin{commeditComments} +% Comments text +% \end{commeditComments} +% Base text +% .... +% \begin{commeditComments} +% Comments text +% \end{commeditComments} +% Base text +% .... +% \begin{comments} +% Comments text +% \end{comments} +% Base text +% .... +% \begin{commeditText} +% Text for the commented edition +% \end{commeditText} +% Base test +% \end{document} +% \end{verbatim} +% \caption{Structure of the main source file} +% \label{fig:source} +% \end{figure} +% +% The structure of the main source file is shown on +% Figure~\ref{fig:source}. It has three kinds of special +% environments: +% \begin{enumerate} +% \item Exactly one \texttt{commeditPreamble} +% environment in the preamble. +% \item Zero or more \texttt{commeditText} environments anywhere +% \emph{after} \texttt{commeditPreamble}. +% \item Zero or more \texttt{commeditComments} environments anywhere +% \emph{after} \texttt{commeditPreamble}. +% \end{enumerate} +% Below we discuss there environments in detail. +% +% +%\subsection{Setting up commenting edition} +%\label{sec:ug_setup} +% +% +% +% \DescribeEnv{commeditPreamble}% +% The environment \cs{begin\{commeditPreamble\}}\marg{filename} \ldots +% \cs{end\{commeditPreamble\}} must be present in the preamble of the +% base document. It has one mandatory argument, the name of the +% commented edition file. The contents of the environment are written +% as the preamble of the file \path{filename.tex}, so they must start +% with \cs{documentclass}, which might be different from the document +% class of the base edition. \texttt{commeditPreamble} may add +% additional packages. Note that commented edition reads the +% \texttt{.aux} file of the base edition. Since packages like +% \textsl{babel} or \textsl{hyperref} change the format of this file, +% their usage must be the same in the base and commented edition: +% either both editions use such package, or both do not use it. +% +% The following commands are recognized in this environment. +% +% +% +% \DescribeMacro{\commentscolskip}% +% The length \cs{commentscolskip} is the distance between comment +% columns. By default 6\,mm. +% +% \DescribeMacro{\commentscolwidth}% +% The length \cs{commentscolwidth} is the width of the comment +% columns. By default 55.5\,mm. +% +% +% \DescribeMacro{\commentscolTheight}% +% \DescribeMacro{\commentscolSheight}% +% The lengths \cs{commentscolTheight} and \cs{commentscolSheight} are +% the heights of ``tall'' and ``short'' comment columns (see +% Figre~\ref{fig:commented_edition}. By default 256\,mm and 58\,mm. +% +% \DescribeMacro{\basepageboxwidth}% +% The width of the box with the base page is \cs{basepageboxwidth}. +% The height of the box is \cs{commentscolTheight}. The base page is +% aligned with the top left point of this box. By default 153\,mm. +% +% \DescribeMacro{\basepageargs}% +% The base pages are included with \cs{includegraphics} command. +% \cs{basepageargs} can be used to set up arguments of this command, +% for example, if you want to scale the pages, +% \begin{verbatim} +% \basepageargs{width=153 mm, height=100mm} +% \end{verbatim} +% +% +% \DescribeMacro{\commentsOddPageSetup}% +% \DescribeMacro{\commentsEvenPageSetup}% +% The setup of the pages is set by the macros +% \cs{commentsOddPageSetup}\marg{Number of left tall +% columns}\marg{Number of short columns}\marg{Number of right tall +% columns} and \cs{commentsEvenPageSetup}\marg{Number of left tall +% columns}\marg{Number of short columns}\marg{Number of right tall +% columns}. The defaults are +% \begin{verbatim} +% \commentsOddPageSetup{0}{2}{1} +% \commentsEvenPageSetup{1}{2}{0} +% \end{verbatim} +% +% \DescribeMacro{\commentsContinuationPageSetup}% +% If comments overflow the the base edition pages, they continue on +% \emph{continuation pages.} The command +% \cs{commentsContinuationPageSetup}\marg{number of columns} sets up +% the number of columns for these pages (by default 3). +% +% \DescribeMacro{\commentsHook}% +% A hook executed for all comments pages, for example +% \begin{verbatim} +% \commentsHook{\small\normalfont} +% \end{verbatim} +% +% +% The environemnt must \emph{not} include the \cs{begin{document}} +% line since it is added, along with some technical stuff, by the +% package itself. +% +% \DescribeMacro{\commentsraggedbottom}% +% \DescribeMacro{\commentsflushbottom}% +% The commands \cs{commentsraggedbottom} and \cs{commentsflushbottom} +% produce either columns of comments with no stretchability, or with +% aligned last lines. The default is \cs{commentsraggedbottom}. +% +% +%\subsection{Commented pages} +%\label{sec:ug_commeditComments} +% +% \DescribeEnv{commeditComments}% +% The enivronment \texttt{commeditComments} sets up comments for the +% page of the base edition. There could be several such environments +% on the given base edition page---actually, since in \TeX\ pagination +% is done algorithmically, one cannot determine beforehand how many of +% them are there. +% +% +%\subsection{Normal pages} +%\label{sec:ug_commeditText} +% +% \DescribeEnv{commeditText}% +% Normal pages in the commented edition are set up with the +% environment \texttt{commeditText}. Note that setting up normal +% pages can begin only if the comments for the current page are +% flushed. Therefore \texttt{commeditText} inserts \cs{clearpage} +% into the base edition. +% +% +% +%\subsection{Floats and other \TeX nicalities} +%\label{sec:floats} +% +% In the commented edition the normal \LaTeX\ output routine is +% changed. This means that a number of familiar \LaTeX\ features do +% not work or work differently from the way one used to. +% +% \DescribeEnv{figure}% +% \DescribeEnv{table}% +% On the comments pages only one column floats are allowed, and +% these actually do not float: they are output where they are +% introduced (as if they were using \texttt{h!} specifier). +% +% \DescribeMacro{\marginpar}% +% You cannot use \cs{marginpar} commands for pages with +% comments. You still can use them with the ``normal pages'', +% however. +% +% \DescribeMacro{\footnote} +% All footnotes for the commented pages are printed at the end of +% the commented pages. +% +% \DescribeMacro{\pagebreak}% +% \DescribeMacro{\newpage}% +% \DescribeMacro{\clearpage}% +% Page breaking commands start new columns instead of new pages. +% +% +%\StopEventually{\clearpage} +% +% \clearpage +% +% \section{Implementation} +% \label{sec:implementation} +% \begin{macrocode} +%<*style> +% \end{macrocode} +% +% +%\subsection{Base file commands} +%\label{sec:base} +% +% \begin{macro}{\ifCommentedEdition} +% Whether this is a base or commented edition. +% \begin{macrocode} +\newif\ifCommentedEdition +\CommentedEditionfalse +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\@commeditout} +% \changes{v1.01}{2019/01/03}{Added last page at the end of document} +% The file to write the the data to +% \begin{macrocode} +\newwrite\@commeditout +\AtEndDocument{\ifCommentedEdition\else + \cleardoublepage + \immediate\write\@commeditout{\string\end{commentsBox}}% + \immediate\write\@commeditout{\string\end{document}}% + \closeout\@commeditout +\fi} +% \end{macrocode} +% \end{macro} +% +% +% +% +% \begin{macro}{\@write@comments} +% \changes{v1.01}{2019/01/03}{Moved to \cs{protected@write}} +% The workhorse. Mainly from Scott Pakin's \texttt{filecontents} +% package and \LaTeX\ kernel. The commments are from them. +% \begin{macrocode} +\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% +% \end{macrocode} +% If there are active characters in the upper half (e.g., from +% \texttt{inputenc} there would be confusion so we render everything +% harmless. +% \begin{macrocode} + \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% +% \end{macrocode} +% There was no |\end{filecontents}| +% \begin{macrocode} + \write\@commeditout{##1}% + \else% +% \end{macrocode} +% There was a |\end{filecontents}|, so stop this time. +% \begin{macrocode} + \edef^^M{\noexpand\end{\@currenvir}}% + \ifx\relax##1\relax% + \else% +% \end{macrocode} +% Text before the |\end|, write it with a warning. +% \begin{macrocode} + \@latex@warning{Writing text `##1' before % + \string\end{\@currenvir}\MessageBreak as last line of \@currenvir}% + \write\@commeditout{##1}% + \fi% + \ifx\relax##2\relax% + \else% +% \end{macrocode} +% Text after the |\end|, ignore it with a warning. +% \begin{macrocode} + \@latex@warning{% + Ignoring text `##2' after \string\end{\@currenvir}}% + \fi% + \fi% + ^^M}% +% \end{macrocode} +% +% \begin{macrocode} + \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% +% \end{macrocode} +% +% +% \end{macro} +% +% \begin{macro}{\immediate@write@commments} +% \changes{v1.01}{2019/01/03}{Added macro} +% The version of \cs{@write@comments}, which does not wait till the +% end of page +% \begin{macrocode} +\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% +% \end{macrocode} +% If there are active characters in the upper half (e.g., from +% \texttt{inputenc} there would be confusion so we render everything +% harmless. +% \begin{macrocode} + \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% +% \end{macrocode} +% There was no |\end{filecontents}| +% \begin{macrocode} + \immediate\write\@commeditout{##1}% + \else% +% \end{macrocode} +% There was a |\end{filecontents}|, so stop this time. +% \begin{macrocode} + \edef^^M{\noexpand\end{\@currenvir}}% + \ifx\relax##1\relax% + \else% +% \end{macrocode} +% Text before the |\end|, write it with a warning. +% \begin{macrocode} + \@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% +% \end{macrocode} +% Text after the |\end|, ignore it with a warning. +% \begin{macrocode} + \@latex@warning{% + Ignoring text `##2' after \string\end{\@currenvir}}% + \fi% + \fi% + ^^M}% +% \end{macrocode} +% +% \begin{macrocode} + \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% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\commeditPreamble} +% \changes{v1.01}{2019/01/03}{Moved to \cs{immediate@write@comments}} +% Writing the preamble +% \begin{macrocode} +\def\commeditPreamble#1{\immediate\closeout\@commeditout + \immediate\openout\@commeditout=#1 + \immediate@write@comments} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\endcommeditPreamble} +% Close the preamble +% \begin{macrocode} +\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}}} +% \end{macrocode} +% +% \end{macro} +% +% +% \begin{macro}{\commeditComments} +% The main environment +% \begin{macrocode} +\def\commeditComments{\@write@comments} +% \end{macrocode} +% +% \end{macro} +% +% +% \begin{macro}{\endcommeditComments} +% We add \cs{par} at the end of each comments +% \begin{macrocode} +\def\endcommeditComments{% + \write\@commeditout{\string\par}} +% \end{macrocode} +% +% +% \end{macro} +% +% \begin{macro}{\commeditText} +% Normal pages. We issue \cs{clearpage}, which might close the +% current comments and open the new one, close the just opened +% comments, typeset the text in the commented edition and reopen the +% comments. +% \begin{macrocode} +\def\commeditText{\clearpage + \immediate\write\@commeditout{\string\end{commentsBox}}% +\immediate@write@comments} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\endcommeditText} +% Opening the new comments page +% \begin{macrocode} +\def\endcommeditText{% + \immediate\write\@commeditout{\string\par}% + \immediate\write\@commeditout{\string\begin{commentsBox}}} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\commedit@base@pageno} +% The true page number of the current page +% \begin{macrocode} +\newcount\@commedit@base@pageno +\@commedit@base@pageno=1\relax +% \end{macrocode} +% +% \end{macro} +% +% We write the commands to every shipout. First, we need a package. +% |atbegshi| is more powerful, but for our purpose |everyshi| is fine. +% \begin{macrocode} +\RequirePackage{everyshi} +% \end{macrocode} +% We need to patch this package, however, since we want to execute the +% hook \emph{after} shipout! +% +% +% \begin{macro}{\@EveryShipoutEnd@Hook} +% \changes{v1.01}{2019/01/03}{Added macro} +% We define the hook +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@EveryShipout@Output} +% \changes{v1.01}{2019/01/03}{Redefined} +% And add to the macro +% \begin{macrocode} +\renewcommand{\@EveryShipout@Output}{% + \@EveryShipout@Hook% + \@EveryShipout@AtNextHook% + \gdef\@EveryShipout@AtNextHook{}% + \@EveryShipout@Org@Shipout\box\@cclv\relax + \@EveryShipoutEnd@Hook% + } +% \end{macrocode} +% +% \end{macro} +% +% +%\subsection{Typesetting commented edition} +%\label{sec:commentedEdition} +% +% +% +%\subsubsection{Setting things up} +%\label{sec:setup_commented_edition} +% +% We need to read the aux file for the base edition +% \begin{macrocode} +\RequirePackage{etoolbox} +\AtEndPreamble{\ifCommentedEdition + \begingroup\@floatplacement\@dblfloatplacement + \makeatletter\let\@writefile\@gobbletwo + \global \let \@multiplelabels \relax + \@input{\BaseEditionName.aux}\endgroup + \fi} +% \end{macrocode} +% +% +% +% \begin{macro}{\commentscolskip} +% The distance between columns +% \begin{macrocode} +\newlength\commentscolskip +\setlength\commentscolskip{6mm} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\commentscolwidth} +% The width of the comments column +% \begin{macrocode} +\newlength\commentscolwidth +\setlength\commentscolwidth{55.5mm} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\commentscolTheight} +% The height of the ``tall'' columns +% \begin{macrocode} +\newlength\commentscolTheight +\setlength\commentscolTheight{256mm} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\commentscolSheight} +% The height of the ``short'' columns +% \begin{macrocode} +\newlength\commentscolSheight +\setlength\commentscolSheight{58mm} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\basepageboxwidth} +% The width of the base page box +% \begin{macrocode} +\newlength\basepageboxwidth +\setlength\basepageboxwidth{153mm} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\basepageargs} +% Arguments for \cs{includegraphics} +% \begin{macrocode} +\def\basepageargs#1{\gdef\@basepageargs{#1}} +\basepageargs{} +% \end{macrocode} +% +% +% \end{macro} +% +% \begin{macro}{\commentsOddPageSetup} +% The odd page structure +% \begin{macrocode} +\def\commentsOddPageSetup#1#2#3{% + \gdef\@commeditOddLeftCols{#1}% + \gdef\@commeditOddMiddleCols{#2}% + \gdef\@commeditOddRightCols{#3}} +\commentsOddPageSetup{0}{2}{1} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\commentsEvenPageSetup} +% The even page structure +% \begin{macrocode} +\def\commentsEvenPageSetup#1#2#3{% + \gdef\@commeditEvenLeftCols{#1}% + \gdef\@commeditEvenMiddleCols{#2}% + \gdef\@commeditEvenRightCols{#3}} +\commentsEvenPageSetup{1}{2}{0} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\commentsContinuationPageSetup} +% The number of continuation columns +% \begin{macrocode} +\def\commentsContinuationPageSetup#1{% + \gdef\@commeditContinuationCols{#1}} +\commentsContinuationPageSetup{3} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\@commentstexttop} +% \changes{v1.02}{2019/01/21}{Added macro} +% Top of the column +% \begin{macrocode} +\let\@commentstexttop\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@commentstextbottom} +% \changes{v1.02}{2019/01/21}{Added macro} +% Top of the column +% \begin{macrocode} +\let\@commentstextbottom\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\commentsraggedbottom} +% \changes{v1.02}{2019/01/21}{Added macro} +% Ragged bottom columns (the default) +\def\commentsraggedbottom{% + \def\@commentstextbottom{\vskip \z@ \@plus.0001fil}% + \let\@commentstexttop\relax} +\commentsraggedbottom +% \end{macro} +% +% \begin{macro}{\commentsflushbottom} +% \changes{v1.02}{2019/01/21}{Added macro} +% Flushed bottom columns +\def\commentsflushbottom{% + \let\@commentstextbottom\relax + \let\@commentstexttop\relax} +% \end{macro} +% +% \begin{macro}{\@tempboxb} +% \changes{v1.02}{2019/01/21}{Added macro} +% A temp box +% \begin{macrocode} +\newbox\@tempboxb +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\commentsHook} +% Everything we did not think about\ldots +% \begin{macrocode} +\def\commentsHook#1{\gdef\@commentsHook{#1}} +\commentsHook{} +% \end{macrocode} +% +% \end{macro} +% +% +% +%\subsubsection{Gathering comments} +%\label{sec:commentsBox} +% +% \begin{macro}{\@commedit@box} +% The box with comments +% \begin{macrocode} +\newbox\@commedit@box +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\@commentsfootins} +% \changes{v1.02}{2019/01/20}{Added macro} +% The box for footnotes in comments +% \begin{macrocode} +\newbox\@commentsfootins +% \end{macrocode} +% +% \end{macro} +% +% +% \begin{macro}{\@commentsfootnotetext} +% \changes{v1.02}{2019/01/20}{Added macro} +% The version of \cs{footnotetext} for comments +% \begin{macrocode} +\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}} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\comments@xfloat} +% \changes{v1.02}{2019/01/20}{Added macro} +% The version of \cs{@xfloat} inside comments +% \begin{macrocode} +\def\comments@xfloat#1[#2]{% + \@nodocument + \def \@captype {#1}% + \setbox\@tempboxb + \color@vbox + \normalcolor + \vbox \bgroup + \hsize\columnwidth + \@parboxrestore + \@floatboxreset} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\comments@end@float} +% \changes{v1.02}{2019/01/20}{Added macro} +% We do not move float to the list, but just typeset it in place. +% \begin{macrocode} +\def\comments@end@float{% + \@endfloatbox + \vskip \intextsep + \box\@tempboxb + \penalty\interlinepenalty + \vskip\intextsep} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\commentsBox} +% \changes{v1.02}{2019/01/20}{Added footnotes, floats} +% The box of comments +% \begin{macrocode} +\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} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\endcommentsBox} +% Closing the box +% \begin{macrocode} +\def\endcommentsBox{\egroup} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\@commedit@page@box} +% The box to hold the page so far with comments +% \begin{macrocode} +\newbox\@commedit@pagebox +% \end{macrocode} +% +% \end{macro} +% +% +% \begin{macro}{\typesetComments} +% \changes{v1.01}{2019/01/03}{Added \cs{vfill} to \cs{@commedit@box}} +% \changes{v1.02}{2019/01/20}{Added footnotes to the end of the box} +% Typesetting the box of comments +% \begin{macrocode} +\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} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\typesetContinuation} +% Continuation boxes +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% +%\subsection{Final incantations} +%\label{sec:final} +% +% +% +% \begin{macrocode} +% +% \end{macrocode} +%\Finale +%\clearpage +% +%\PrintChanges +%\clearpage +%\PrintIndex +% +\endinput diff --git a/Master/texmf-dist/source/latex/commedit/commedit.ins b/Master/texmf-dist/source/latex/commedit/commedit.ins new file mode 100644 index 00000000000..840ba7d6d28 --- /dev/null +++ b/Master/texmf-dist/source/latex/commedit/commedit.ins @@ -0,0 +1,28 @@ +% +% Doctrip file for commedit +% This file is in public domain +% +\def\batchfile{commedit.ins} +\input docstrip +\keepsilent +\showprogress + + +\askforoverwritefalse + +\generate{% + \file{commedit.sty}{\from{commedit.dtx}{style}}} + +\obeyspaces +\Msg{*****************************************************}% +\Msg{* Congratulations! You successfully generated the *}% +\Msg{* commedit package. *}% +\Msg{* *}% +\Msg{* Please move the file commedit.sty to where *}% +\Msg{* LaTeX files are kept in your system. The manual *}% +\Msg{* for the package is in the file commedit.pdf. *}% +\Msg{* *}% +\Msg{* The package is released under LPPL *}% +\Msg{* *}% +\Msg{* Happy TeXing! *}% +\Msg{*****************************************************}% \ No newline at end of file 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