%% Copyright (C) 2013 by Matthieu Guillaumin %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either %% version 1.2 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.2 or later is part of all distributions of %% LaTeX version 1999/12/01 or later. \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{minorrevision} [ 2013/11/15 v1.1 minorrevision package ] % Package requirements \RequirePackage{xkeyval} \RequirePackage{lineno} \RequirePackage{xr} \DeclareOptionX*{\PassOptionsToClass{\CurrentOption}{lineno,xr}} % pass options to other packages \ProcessOptionsX %%% Package commands %%% % Define .mrv extension for auxiliary files, creating/opening the output file \def\MRV@prefix{ MRV} \def\MRV@ext{.mrv} \def\MRV@outputfile{\jobname\MRV@ext} \typeout{minorrevision: creating \MRV@outputfile} \newwrite\outputmrv \immediate\openout\outputmrv=\MRV@outputfile % Macro for writing macros in the .mrv file \newcommand{\MRV@Write}[3]{% \protected@write\outputmrv{}{\string\expandafter\string\def\string\csname\MRV@prefix/\jobname/#1@#2\string\endcsname{#3}}% } %%% User commands %%% % Define \mrvdocument: adds external document for xr, reads the .mrv file \newcommand{\mrvdocument}[1]{ \def\MRV@lastrefdoc{#1} \def\MRV@lastrefmrv{#1\MRV@ext} \typeout{minorrevision: reference ``\MRV@lastrefdoc'' declared, loading \MRV@lastrefmrv} \externaldocument[\MRV@lastrefdoc-]{\MRV@lastrefdoc} \input \MRV@lastrefmrv } \newcommand{\mrvref}[2]{\ref{#1-mrv:#2}} \newcommand{\mrvold}[2]{\csname\MRV@prefix/#1/old@#2\endcsname} \newcommand{\mrvnew}[2]{\csname\MRV@prefix/#1/new@#2\endcsname} \newcommand{\revref}[1]{\mrvref{\MRV@lastrefdoc}{#1}} \newcommand{\revold}[1]{\mrvold{\MRV@lastrefdoc}{#1}} \newcommand{\revnew}[1]{\mrvnew{\MRV@lastrefdoc}{#1}} \newcommand{\revisionrm}[2]{\linelabel{mrv:#1}\MRV@Write{old}{#1}{#2}} \newcommand{\revisionadd}[2]{\linelabel{mrv:#1}#2\MRV@Write{new}{#1}{#2}} \newcommand{\revision}[3]{\linelabel{mrv:#1}#2\MRV@Write{new}{#1}{#2}\MRV@Write{old}{#1}{#3}} %% End of user commands %% \endinput %% %% End of file `minorrevision.sty'.