0

Assume I have prepared a CV, which has a section for my contact. For my webpage, I would like to have only my email in the contact section, for my job applications, I want to have my cell phone number as well. If my CV includes so many of these "customizations" for different sections, is there a way to automate this process and quickly print out a version of the CV that I want? Two methods that I can think of, but I want to avoid, are: 1) to have two separate files, or 2) to go through the sections and comment out the parts I do not want to be printed out.

Salivan
  • 303

1 Answers1

1

You can define conditionals in your preamble that you can turn on or off. One way of achieving this is using TeX's internal \ifs:

\newif\ifwebpage% Defines \ifwebpage conditional
% \webpagetrue % "Turn on" webpage conditional
% \webpagefalse % "Turn off" webpage conditional (default)

% <general content>

\ifwebpage
  % <webpage-only content>
\fi

% <general content>

\ifwebpage
  % <webpage-only content>
\else
  % <non-webpage content>
\fi

% <general content>

etoolbox is a package that provides similar functionality using "boolean flags." For example, the above could be rewritten using etoolbox functionality like so:

\usepackage{etoolbox}
\newbool{webpage}% Defines webpage conditional
% \booltrue{webpage} % "Turn on" webpage conditional
% \boolfalse{webpage} % "Turn off" webpage conditional (default)

% <general content>

\ifbool{webpage}{%
  % <webpage-only content>
}{}%

% <general content>

\ifbool{webpage}{%
  % <webpage-only content>
}{%
  % <non-webpage content>
}%

% <general content>

Since the \if...\fi usage should be in the same group, handling conditionals inside tabulars (say) is a little more tricky. However, the assumption is that one can create separate tabulars for each conditional outcome.

Werner
  • 603,163