1

A colleague is writing a proposal collaboratively, in which the same proposal will be jointly submitted to two different funding agencies in different countries. There is a 70% overlap in content, but precise formatting in even the common portions is different (fonts, columns, etc) and there is a conditional inclusion of certain sections.

So, this cannot be done simply by using conditional \input and \include commands, as the markup inside the files needs to be treated differently. Also, just writing two independent documents is not the right solution, since the overlap is significant and you will always run into consistency issues. beamer has a package called beameraudience that allows you to fine tune the output based on change of a single switch. Can this package (or something more appropriate for article class documents) be used for the above application?

They are not looking to create two different PDF documents in a single compilation (though that would be ideal, though inadvisable, as \write18 is potentially dangerous) but can things be conditionally included/formatted based on the value of a switch?

Ingmar
  • 6,690
  • 5
  • 26
  • 47
user2751530
  • 1,102

1 Answers1

3

My philosophy is the KISS principle "keep it simple, s***", and under this view, the best is two documents for two layouts with a common comment with the list of all possible inputs:

% \input{foo}
% \input{bar}
% \input{whatever}

That can be selectively activated or deactivated just removing or adding one %.

Said that, there is no problem messing all in a single file with conditionals. In this MWE you only have to choose between line 8 or 9 to obtain two very different documents in format and content:

\documentclass{article}
\usepackage{lipsum}

\newif\ifpropA \newif\ifpropB

% choose: % \propAtrue\propBfalse % for proposal A
\propAfalse\propBtrue % for proposal B

\ifpropA \parskip0pt \parindent2em \twocolumn \usepackage[scaled]{helvet} \renewcommand\familydefault{\sfdefault} \fi

\ifpropB \parskip1em \parindent0pt \onecolumn \usepackage{dejavu} \usepackage{xcolor}\color{blue}

\fi

\begin{document}

\section*{A common title} This is a common part. \ifpropA This is the proposal \fbox{A}. \lipsum[1-10] \fi \ifpropB This is the proposal \fbox{B}. \lipsum[11-20] \fi

\end{document}

mwe

Ingmar
  • 6,690
  • 5
  • 26
  • 47
Fran
  • 80,769