\documentclass{article} \usepackage[a4paper, margin=1in]{geometry} \usepackage{hideproofs} \usepackage{lmodern} \usepackage{xcolor} \usepackage[final, % Include links even if document is in 'draft' mode. hidelinks, % Prevent boxes from being drawn around links in some viewers. breaklinks=true, % Allow line breaks in the middle of links colorlinks=true, linkcolor=black, % TOC, links to labeled equations and environments filecolor=magenta, urlcolor=black!30!blue, % URLS including links in references citecolor=black!30!blue, % In-line citations ]{hyperref} \usepackage{listings} \lstdefinestyle{mystyle}{ backgroundcolor=\color{gray!10}, % light gray background commentstyle=\color{green!50!black}\itshape, keywordstyle=\color{blue!70!black}\bfseries, numberstyle=\tiny\color{gray}, stringstyle=\color{orange!80!black}, basicstyle=\ttfamily\small, % breakatwhitespace=false, % breaklines=true, % captionpos=b, keepspaces=true, numbers=left, numbersep=5pt, showspaces=false, % showstringspaces=false, % showtabs=false, frame=single, rulecolor=\color{black}, tabsize=2, xleftmargin=10pt, xrightmargin=5pt, aboveskip=10pt, belowskip=0pt } \lstset{style=mystyle} \setlength{\parindent}{0pt} % No indentation \setlength{\parskip}{1em} % Add vertical space between paragraphs \title{Hide Proofs \LaTeX{} Package \\ \large Define a \texttt{proof*} environment to hides proofs based on document mode} \author{Paul Wintz} \date{June 14, 2025} \begin{document} \maketitle \begin{abstract} The \texttt{hideproofs} package provides a convenient way to conditionally hide or display proof contents in LaTeX documents based on the document mode (\texttt{draft}, \texttt{final}, or neither). It defines a starred proof environment \verb|proof*| that behaves like the standard \verb|proof| environment from \texttt{amsthm}, but optionally hides its body and replaces it with a customizable message. The motivation for this package is to reduce the clutter in large files by omitting long proofs, allowing authors to focus their attention on results or proofs that are currently works in-progress. Issues and feature requests can be submitted on GitHub at \href{https://github.com/pwintz/hideproofs}{github.com/pwintz/hideproofs}. \end{abstract} %=================================== %=================================== \section{Requirements} \label{sec:Requirements} This package requires \LaTeX3 support (\texttt{expl3}, \texttt{l3keys2e}). % \section{Installation} % % Eventually, \texttt{hideproofs} may be bundled with \LaTeX{} installations. % Until then, you must install it manually. % The % % TODO: Update this. % Put \texttt{hideproofs.sty} in your project's directory or somewhere in your \TeX\ path. %=================================== %=================================== \section{Usage} \label{sec:Usage} To use the \texttt{hideproofs} package, load it in your document preamble: \begin{lstlisting}[language=TeX] \usepackage{hideproofs} \end{lstlisting} Then, replace any \texttt{proof} environments you want to hide with a \texttt{proof*} environment: \begin{lstlisting}[language=TeX] \begin{proof*} This is the proof that will be hidden based on the mode. \end{proof*} \end{lstlisting} By default, proofs are hidden in \texttt{draft} and default (non-\texttt{draft}, non-\texttt{final}) document modes, and shown only in \texttt{final} mode. To compile your document \texttt{draft} mode, pass \texttt{draft} as a class option: \begin{lstlisting}[language=TeX] \documentclass[draft]{article} \end{lstlisting} Similarly for \texttt{final}: \begin{lstlisting}[language=TeX] \documentclass[draft]{article} \end{lstlisting} The default mode has neither \texttt{draft} nor \texttt{final} in the class options: \begin{lstlisting}[language=TeX] \documentclass{article} \end{lstlisting} \section{Package Options} Several package options allow you to customize the hiding behavior and the appearance of the message that replaces hidden proofs. \subsection*{Hiding options} The following options control when proofs are hidden or shown, based on the document class options: \begin{description} \item[\texttt{hideInDraft}] Hide proofs in \texttt{draft} mode. Default: \texttt{true}. \item[\texttt{hideInDefault}] Hide proofs in the default mode (neither \texttt{draft} nor \texttt{final}). Default: \texttt{true}. % \item[\texttt{showInFinal}] Show proofs in \texttt{final} mode. \item[\texttt{hideInFinal}] Hide proofs in \texttt{final} mode. Default: \texttt{false}. % (Negation of \texttt{showInFinal}. Default behavior) . \item[\texttt{show}] Show all proofs, regardless of mode-specific settings. \item[\texttt{hide}] Hide all proofs in \texttt{proof*} environments, regardless of mode-specific settings. \end{description} % The follow options are also available, but they match the default behavior: % \begin{description} % \item[\texttt{showInDraft}] Show proofs in \texttt{draft} mode. (Negation of \texttt{hideInDraft}. Default behavior) % \item[\texttt{showInDefault}] Show proofs in the default mode. (Negation of \texttt{hideInDraft}. Default behavior) % \end{description} \subsection*{Message options} The following options modify how the \begin{description} \item[\texttt{message=\emph{string}}] Sets the message shown when proofs are hidden. \\ Default: \verb|Proof hidden.| \item[\texttt{color=\emph{name}}] Sets the color of the message if the \texttt{color} package is loaded. This option has no effect if the `color` package is not loaded. \\ Default: \verb|blue|. \end{description} \subsection{Optional Environment Argument} The \verb|proof*| environment supports an optional title, just like \verb|proof| to change the rendered text from ``Proof.'': \begin{lstlisting}[language=TeX] \begin{proof*}[Sketch of proof] This sketch will be hidden in draft mode. \end{proof*} \end{lstlisting} \subsection*{Example} Consider the following example: \begin{lstlisting}[language=TeX] \documentclass{article} \usepackage{hideproofs} \usepackage{color} \begin{document} \begin{proof} This is a non-starred proof environment. \end{proof} \begin{proof*} This is a starred proof environment. \end{proof*} \begin{proof*}[Proof sketch] This is a starred proof environment with an optional argument. \end{proof*} \end{document} \end{lstlisting} % \makeatletter % \hideproofs@setDefaults{}% % \hideproofs@newSetup{ % hideInFinal=true, % message={Proof omitted.}, % color=red % }% % \makeatother The output is \\[10pt] \fbox{% \begin{minipage}{0.8\linewidth} \begin{proof} This is a non-starred proof environment. \end{proof} \begin{proof*} This is a starred proof environment. \end{proof*} \begin{proof*}[Proof sketch] This is a starred proof environment with an optional argument. \end{proof*} \end{minipage} } \\[10pt] (If the \texttt{color} package is not loaded, then the message text is black.) \makeatletter \hideproofs@newSetup{show} \makeatother Changing the document class options to \begin{lstlisting}[language=TeX] \documentclass[final]{article} \end{lstlisting} produces \\[10pt] \fbox{% \begin{minipage}{0.8\linewidth} \begin{proof} This is a non-starred proof environment. \end{proof} \begin{proof*} This is a starred proof environment. \end{proof*} \begin{proof*}[Proof sketch] This is a starred proof environment with an optional argument. \end{proof*} \end{minipage} } % \subsection*{Example: Custom Message} \makeatletter \hideproofs@setDefaults{} \hideproofs@newSetup{ message={Proof omitted.}, color=red } \makeatother The appearance of the ``proof hidden" text can be changed by setting the \texttt{message} and \texttt{color} options: \begin{lstlisting}[language=TeX] \usepackage[ message={Proof omitted.}, color=red ]{hideproofs} \end{lstlisting} Note that the \texttt{message} string must be wrapped in brackets if it contains spaces. The result is \\[10pt] \fbox{% \begin{minipage}{0.8\linewidth} \begin{proof} This is a non-starred proof environment. \end{proof} \begin{proof*} This is a starred proof environment. \end{proof*} \begin{proof*}[Proof sketch] This is a starred proof environment with an optional argument. \end{proof*} \end{minipage} } % \subsection*{Example: Changing when proofs are hidden} % \begin{lstlisting}[language=TeX] % \usepackage[ % hideInFinal=true, % message={Proof omitted.}, % color=gray % ]{hideproofs} % \begin{lstlisting}[language=TeX] % \usepackage[ % hideInFinal=true, % message={Proof omitted.}, % color=gray % ]{hideproofs} % \end{lstlisting} % The ouput % % \makeatletter % \hideproofs@newSetup{ % hideInFinal=true, % message={Proof omitted.}, % color=red % } % \makeatother % \begin{proof*} % This is a proof % \end{proof*} \section{License} This package is released under the \LaTeX\ Project Public License, which is distributed from CTAN archives in the directory macros/latex/base/lppl.txt. \section{Author} Paul Wintz (\href{https://paulwintz.com/}{paulwintz.com}) \\ PhD Student, UC Santa Cruz, Department of Applied Mathematics \\ \\ \end{document}