Skip to content

Instantly share code, notes, and snippets.

@andrewc12
Forked from asalt/latex_hide_figure.tex
Created December 24, 2020 08:12
Show Gist options
  • Select an option

  • Save andrewc12/2183cc9fff1332e8c9f7495b873dc7b2 to your computer and use it in GitHub Desktop.

Select an option

Save andrewc12/2183cc9fff1332e8c9f7495b873dc7b2 to your computer and use it in GitHub Desktop.
How to hide whole sections in a latex document.
%http://tex.stackexchange.com/questions/77920/comment-package-excludecomment-gives-error
\documentclass[12pt]{article}
\usepackage{todonotes} % \missingfigure
\usepackage{comment} % to exclude whole sections when I want to
\newif\ifshow % toggle true or false based on if want to hide section
%\showtrue % show the sections
\showfalse % hide the sections
\ifshow
\includecomment{wrap}
\else
\excludecomment{wrap} % anything wrapped in a {wrap} environment will be excluded
\fi
\begin{document}
Text text text text text text text text
\begin{wrap}
\begin{figure}
\centering
\missingfigure[figwidth=8cm]{my_figure}
\caption{This is a pretty figure.}
\label{fig:pretty}
\end{figure}
\end{wrap}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment