Debian Codegraph @

texmf-dist/doc/latex/hideproofs/hideproofs-doc.tex

raw
1 \documentclass{article}
2 \usepackage[a4paper, margin=1in]{geometry}
3 \usepackage{hideproofs}
4 \usepackage{lmodern}
5 \usepackage{xcolor}
6 \usepackage[final, % Include links even if document is in 'draft' mode.
7 hidelinks, % Prevent boxes from being drawn around links in some viewers.
8 breaklinks=true, % Allow line breaks in the middle of links
9 colorlinks=true,
10 linkcolor=black, % TOC, links to labeled equations and environments
11 filecolor=magenta,
12 urlcolor=black!30!blue, % URLS including links in references
13 citecolor=black!30!blue, % In-line citations
14 ]{hyperref}
15 \usepackage{listings}
16 \lstdefinestyle{mystyle}{
17 backgroundcolor=\color{gray!10}, % light gray background
18 commentstyle=\color{green!50!black}\itshape,
19 keywordstyle=\color{blue!70!black}\bfseries,
20 numberstyle=\tiny\color{gray},
21 stringstyle=\color{orange!80!black},
22 basicstyle=\ttfamily\small,
23 % breakatwhitespace=false,
24 % breaklines=true,
25 % captionpos=b,
26 keepspaces=true,
27 numbers=left,
28 numbersep=5pt,
29 showspaces=false,
30 % showstringspaces=false,
31 % showtabs=false,
32 frame=single,
33 rulecolor=\color{black},
34 tabsize=2,
35 xleftmargin=10pt,
36 xrightmargin=5pt,
37 aboveskip=10pt,
38 belowskip=0pt
39 }
40 \lstset{style=mystyle}
41
42 \setlength{\parindent}{0pt} % No indentation
43 \setlength{\parskip}{1em} % Add vertical space between paragraphs
44
45 \title{Hide Proofs \LaTeX{} Package \\
46 \large Define a \texttt{proof*} environment to hides proofs based on document mode}
47 \author{Paul Wintz}
48 \date{June 14, 2025}
49
50 \begin{document}
51 \maketitle
52
53 \begin{abstract}
54 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.
55 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.
56 Issues and feature requests can be submitted on GitHub at \href{https://github.com/pwintz/hideproofs}{github.com/pwintz/hideproofs}.
57 \end{abstract}
58
59
60 %===================================
61 %===================================
62 \section{Requirements}
63 \label{sec:Requirements}
64 This package requires \LaTeX3 support (\texttt{expl3}, \texttt{l3keys2e}).
65
66 % \section{Installation}
67 %
68 % Eventually, \texttt{hideproofs} may be bundled with \LaTeX{} installations.
69 % Until then, you must install it manually.
70 % The
71 % % TODO: Update this.
72 % Put \texttt{hideproofs.sty} in your project's directory or somewhere in your \TeX\ path.
73
74 %===================================
75 %===================================
76 \section{Usage}
77 \label{sec:Usage}
78 To use the \texttt{hideproofs} package, load it in your document preamble:
79 \begin{lstlisting}[language=TeX]
80 \usepackage{hideproofs}
81 \end{lstlisting}
82 Then, replace any \texttt{proof} environments you want to hide with a \texttt{proof*} environment:
83 \begin{lstlisting}[language=TeX]
84 \begin{proof*}
85 This is the proof that will be hidden based on the mode.
86 \end{proof*}
87 \end{lstlisting}
88
89 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.
90 To compile your document \texttt{draft} mode, pass \texttt{draft} as a class option:
91 \begin{lstlisting}[language=TeX]
92 \documentclass[draft]{article}
93 \end{lstlisting}
94 Similarly for \texttt{final}:
95 \begin{lstlisting}[language=TeX]
96 \documentclass[draft]{article}
97 \end{lstlisting}
98 The default mode has neither \texttt{draft} nor \texttt{final} in the class options:
99 \begin{lstlisting}[language=TeX]
100 \documentclass{article}
101 \end{lstlisting}
102
103 \section{Package Options}
104
105 Several package options allow you to customize the hiding behavior and the appearance of the message that replaces hidden proofs.
106
107 \subsection*{Hiding options}
108
109 The following options control when proofs are hidden or shown, based on the document class options:
110 \begin{description}
111 \item[\texttt{hideInDraft}] Hide proofs in \texttt{draft} mode. Default: \texttt{true}.
112 \item[\texttt{hideInDefault}] Hide proofs in the default mode (neither \texttt{draft} nor \texttt{final}). Default: \texttt{true}.
113 % \item[\texttt{showInFinal}] Show proofs in \texttt{final} mode.
114 \item[\texttt{hideInFinal}] Hide proofs in \texttt{final} mode. Default: \texttt{false}.
115 % (Negation of \texttt{showInFinal}. Default behavior) .
116 \item[\texttt{show}] Show all proofs, regardless of mode-specific settings.
117 \item[\texttt{hide}] Hide all proofs in \texttt{proof*} environments, regardless of mode-specific settings.
118 \end{description}
119
120 % The follow options are also available, but they match the default behavior:
121 % \begin{description}
122 % \item[\texttt{showInDraft}] Show proofs in \texttt{draft} mode. (Negation of \texttt{hideInDraft}. Default behavior)
123 % \item[\texttt{showInDefault}] Show proofs in the default mode. (Negation of \texttt{hideInDraft}. Default behavior)
124 % \end{description}
125
126 \subsection*{Message options}
127
128 The following options modify how the
129 \begin{description}
130 \item[\texttt{message=\emph{string}}] Sets the message shown when proofs are hidden. \\
131 Default: \verb|Proof hidden.|
132 \item[\texttt{color=\emph{name}}] Sets the color of the message if the \texttt{color} package is loaded.
133 This option has no effect if the `color` package is not loaded. \\
134 Default: \verb|blue|.
135 \end{description}
136
137 \subsection{Optional Environment Argument}
138
139 The \verb|proof*| environment supports an optional title, just like \verb|proof| to change the rendered text from ``Proof.'':
140 \begin{lstlisting}[language=TeX]
141 \begin{proof*}[Sketch of proof]
142 This sketch will be hidden in draft mode.
143 \end{proof*}
144 \end{lstlisting}
145
146 \subsection*{Example}
147
148 Consider the following example:
149
150 \begin{lstlisting}[language=TeX]
151 \documentclass{article}
152 \usepackage{hideproofs}
153 \usepackage{color}
154
155 \begin{document}
156
157 \begin{proof}
158 This is a non-starred proof environment.
159 \end{proof}
160
161 \begin{proof*}
162 This is a starred proof environment.
163 \end{proof*}
164
165 \begin{proof*}[Proof sketch]
166 This is a starred proof environment with an optional argument.
167 \end{proof*}
168
169 \end{document}
170 \end{lstlisting}
171 % \makeatletter
172 % \hideproofs@setDefaults{}%
173 % \hideproofs@newSetup{
174 % hideInFinal=true,
175 % message={Proof omitted.},
176 % color=red
177 % }%
178 % \makeatother
179 The output is \\[10pt]
180 \fbox{%
181 \begin{minipage}{0.8\linewidth}
182 \begin{proof}
183 This is a non-starred proof environment.
184 \end{proof}
185 \begin{proof*}
186 This is a starred proof environment.
187 \end{proof*}
188 \begin{proof*}[Proof sketch]
189 This is a starred proof environment with an optional argument.
190 \end{proof*}
191 \end{minipage}
192 } \\[10pt]
193 (If the \texttt{color} package is not loaded, then the message text is black.)
194
195 \makeatletter
196 \hideproofs@newSetup{show}
197 \makeatother
198 Changing the document class options to
199 \begin{lstlisting}[language=TeX]
200 \documentclass[final]{article}
201 \end{lstlisting}
202 produces \\[10pt]
203 \fbox{%
204 \begin{minipage}{0.8\linewidth}
205 \begin{proof}
206 This is a non-starred proof environment.
207 \end{proof}
208 \begin{proof*}
209 This is a starred proof environment.
210 \end{proof*}
211 \begin{proof*}[Proof sketch]
212 This is a starred proof environment with an optional argument.
213 \end{proof*}
214 \end{minipage}
215 }
216
217 % \subsection*{Example: Custom Message}
218 \makeatletter
219 \hideproofs@setDefaults{}
220 \hideproofs@newSetup{
221 message={Proof omitted.},
222 color=red
223 }
224 \makeatother
225 The appearance of the ``proof hidden" text can be changed by setting the \texttt{message} and \texttt{color} options:
226 \begin{lstlisting}[language=TeX]
227 \usepackage[
228 message={Proof omitted.},
229 color=red
230 ]{hideproofs}
231 \end{lstlisting}
232 Note that the \texttt{message} string must be wrapped in brackets if it contains spaces.
233 The result is \\[10pt]
234 \fbox{%
235 \begin{minipage}{0.8\linewidth}
236 \begin{proof}
237 This is a non-starred proof environment.
238 \end{proof}
239 \begin{proof*}
240 This is a starred proof environment.
241 \end{proof*}
242 \begin{proof*}[Proof sketch]
243 This is a starred proof environment with an optional argument.
244 \end{proof*}
245 \end{minipage}
246 }
247
248 % \subsection*{Example: Changing when proofs are hidden}
249
250
251 % \begin{lstlisting}[language=TeX]
252 % \usepackage[
253 % hideInFinal=true,
254 % message={Proof omitted.},
255 % color=gray
256 % ]{hideproofs}
257 % \begin{lstlisting}[language=TeX]
258 % \usepackage[
259 % hideInFinal=true,
260 % message={Proof omitted.},
261 % color=gray
262 % ]{hideproofs}
263 % \end{lstlisting}
264
265 % The ouput
266 %
267 % \makeatletter
268 % \hideproofs@newSetup{
269 % hideInFinal=true,
270 % message={Proof omitted.},
271 % color=red
272 % }
273 % \makeatother
274 % \begin{proof*}
275 % This is a proof
276 % \end{proof*}
277
278
279 \section{License}
280
281 This package is released under the \LaTeX\ Project Public License, which is distributed from CTAN archives in the directory macros/latex/base/lppl.txt.
282
283 \section{Author}
284
285 Paul Wintz (\href{https://paulwintz.com/}{paulwintz.com}) \\
286 PhD Student, UC Santa Cruz, Department of Applied Mathematics \\
287 \\
288
289
290 \end{document}