[Tex/LaTex] Setting a flag to make text visible in LaTeX

commentsconditionals

I am in the process of CV writing and some pieces of information are necessary to include in some applications, whilst in others they are unnecessary. For example, when applying for scientifically-oriented jobs the modules taken during my degree might be of importance and so should be included, but for other sectors they are irrelevant.

Is there a way of setting a flag at the top of a LaTeX document and using this make text wrapped in a block hide/unhide on document creation?

Best Answer

You can define your own switch with the \newif command like this:

\documentclass[a4paper,12pt]{article}

\newif\ifimportant

\importanttrue % or \importantfalse
\begin{document}

 some stuff which will always be shown

\ifimportant
 % only shown if \importanttrue is set
 this is some important text
\fi
\end{document}

With this setting, the important stuff will be displayed. When you want to hide this part, you set \importantfalse instead of \importanttrue

Related Question