Skip to content

Instantly share code, notes, and snippets.

@godbyk
Created August 18, 2011 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save godbyk/1153016 to your computer and use it in GitHub Desktop.
Save godbyk/1153016 to your computer and use it in GitHub Desktop.
How to optionally print text in LaTeX and TeX
\usepackage{ifthen}
\newboolean{includetext}
\newcommand{\mytext}{%
\ifthenelse{\boolean{includetext}}{%
YOUR TEXT GOES HERE
}{}%
}
\setboolean{includetext}{false}
\mytext% prints nothing
\setboolean{includetext}{true}
\mytext% prints text
%% Plain TeX version %%
\newif\ifincludetext
\def\mytext{%
\ifincludetext
YOUR TEXT GOES HERE
\fi
}
\includetextfalse
\mytext% prints nothing
\includetexttrue
\mytext% prints text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment