# [Tex/LaTex] Variables for hiding or showing text in Latex

conditionals

I would like to have some variables for showing or hiding text in Latex.

For example, I would like to have two versions of a document. A short version and a long version by changing a variable at the top of the latex document.

For example:

I want to set a variable long – true

and in the text I would like to use if long == true show text (long version) else if false do not show the text (short version).

Any examples?

\documentclass{article}
\usepackage{lipsum}
\newif\iflong

\begin{document}

\longtrue
\iflong \lipsum[1] \else short version \fi

\longfalse
\iflong \lipsum[1] \else short version \fi
\end{document}


With ifthen

\documentclass{article}
\usepackage{ifthen}
\newboolean{long}

\begin{document}

\setboolean{long}{false}
\ifthenelse{\boolean{long}}{long version}{short version}

\setboolean{long}{true}
\ifthenelse{\boolean{long}}{long version}{short version}
\end{document}