Creating Documents for Multiple Audiences (with the multiaudience package)

Boris Veytsman has recently published a new package to create output documents for multiple audiences in one single file.

The document creation process is divided into two steps: a) create the document and b) create the batch/bash file to automate the document creation.

Find below a sample document (save as ‚multdocument.tex‘) you can use as a starting point. As one can see, three audiences are defined here: „board“, „business“ and „tech“. The „shownto“ environment has one parameter, the comma-separated list of audiences, the content of the section shall be shown to. If the first item is a „-“ instead, the negates the meaning (so {-,board} means „show to every audience except the board). There are also commands for audience-specific footnotes or sections, check the manual for more information.

\begin{shownto}{board}
Some text for the board, for example an executive summary.
\end{shownto}

Remark 2015-08-17: With „tagging“ there is another package, that supports the creation of multiple editions in a single file.

\documentclass[12pt,english]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
 
\usepackage{multiaudience}
 
\SetNewAudience{tech}
\SetNewAudience{business}
\SetNewAudience{board}
 
\begin{document}
 
This text is shown to everybody as it is outside any `multiaudience' environment
 
\begin{shownto}{board}
Some text for the board, for example an executive summary.
\end{shownto}
 
\begin{shownto}{tech,business}
Text for the tech department and the business users, for example a list of business requirements.
\end{shownto}
 
\begin{shownto}{-, board}
Text for every audience except the board.
\end{shownto}
 
Some text.\Footnote{board}{Some footnote just for the board}
 
 
\begin{Section}{board}[Short title]{Long Title of this Section}
 
Text in the section just for the board.
 
\end{Section}
 
 
\end{document}

After we have defined the document with the audiences we want to automate the PDF-creation process in which we tell LaTeX for which audience we want to create the document.

Since LaTeX can take definitions via LaTeX-commandline call, it’s quite easy to create a batch file with one line for each audience:

pdflatex -jobname file-board "\def\CurrentAudience{board}\input{multdocument}"
pdflatex -jobname file-tech "\def\CurrentAudience{tech}\input{multdocument}"
pdflatex -jobname file-business "\def\CurrentAudience{business}\input{multdocument}"

„-jobname“ defines the name of the PDF-file, the „\def{…}“ command sets the current audience. What you get when you run this batch is three different output files with just the information that shall be visible for each audience.

file-board

file-business

file-tech

Uwe

Uwe Ziegenhagen mag LaTeX und Python, auch gern in Kombination. Hat Dir dieser Beitrag geholfen und möchtest Du Dich dafür bedanken? Dann unterstütze doch vielleicht die Dingfabrik Köln e.V. mit einem kleinen Beitrag. Details zur Bezahlung findest Du unter Spenden für die Dingfabrik.

More Posts - Website