Colleagues made me realize that this setup is too complex for collaborative work. There, simplicity is king and a simple \toappendix
macro is simple enough to make multiple versions possible.
While working on a paper we usually need different versions. We can manage versions using primitives like the following.
\newif\iflongversion
\longversiontrue
% \longversionfalse
\iflongversion
Text shown only in the long version.
\else
Not-long version
\fi
Today I made a setup that allows for a more nuanced control.
The classic text is showed always.
By toggling we may display texts that are exclusive only to short or long version.
Also, we may toggle appendix which is useful conference proceeding submissions.
(Note that the \toappendix
takes the enclosed text and moves it to the appendix.)
My goal was to make writing easier, by toggling draft we get parts of the appendix displayed in the place where they were defined. Toggling color colors linenumbers at affected paragraphs so that one can see which parts of the text fall exclusively into some version.
%==== VERSIONS: macros for various paper variants; requires \usepackage{etoolbox} ==================
\def\appendixProofText{}
\newtoggle{short}\newtoggle{long}\newtoggle{appendix}\newtoggle{color}\newtoggle{draft}
%---- typically we need many versions; named toggles should have \toggletrue, others \togglefalse --
% * conference submission version - short & appendix
% * conference final version - short
% * journal full version - long (& appendix)
\toggletrue{short}
\togglefalse{long}
\togglefalse{appendix}
% during writing you may find the following useful
\togglefalse{color} % requires \linenumbers; colors numbrs depending on whether their lines fall into only one version
\togglefalse{draft} % displays text deferred to appendix where they are defined -- this is useful for seeing short proof sketch and long proof next to each other
%---- use the following commands to mark parts of the text -----------------------------------------
% \shortversion{} - show only in short version -- texts shown only in the short version
% \longversion{} - show only in long version -- texts to be entirely omitted from short version
% \longversionproof{} - move to app only in short version -- long proofs deferred to appendix for reviews
% \appversion{} - show here only if appendix is active -- notes that point to the appendix
% \toappendix{} - shown in appendix if it is active -- text between
% note that conference & journal requirements usually want these kind of commands removed
%---------------------------------------------------------------------------------------------------
\iftoggle{color}{
\def\markingcolor{black}
\renewcommand\linenumberfont{\normalfont\tiny\sffamily\color{\markingcolor}$\blacksquare\,$}
}{}
\newcommand{\longcolor}[1]{{\iftoggle{color}{\def\markingcolor{blue!60!black}}{}#1}}
\newcommand{\shortcolor}[1]{{\iftoggle{color}{\def\markingcolor{red!70!black}#1}{#1}}}
\newcommand{\appcolor}[1]{{\iftoggle{color}{\def\markingcolor{green!60!black}}{}#1}}
\newcommand{\toappendix}[1]{
\iftoggle{draft}{\appcolor{#1}}{
\iftoggle{appendix}{
\gappto{\appendixProofText}{\appcolor{#1}}
}{}
}
}
\newcommand{\shortversion}[1]{\iftoggle{short}{\shortcolor{#1}}{}}
\newcommand{\longversion}[1]{\iftoggle{long}{\longcolor{#1}}{}}
\newcommand{\longversionproof}[1]{\iftoggle{short}{\toappendix{#1}}{}}
\newcommand{\appversion}[1]{\iftoggle{appendix}{\appcolor{#1}}{}}
%==== END OF VERSIONS ==============================================================================
Setup appendix as follows.
\appversion{
\newpage
\appendix
\section*{Appendix}
\appendixProofText
}
I wrote this code and I put into public domain
, use at your own risk ;)