I have a large LaTeX file and want to hide most of its contents in the PDF, but preserve the original numbering of theorems, etc. Something similar to display:none in CSS.
The comment environment doesn't help, because it does not process the content at all. It can only be used to hide text outside the theorems.
\hphantom or \vphantom do not wrap environments like \begin{theorem}.
To be more precise, suppose I have the following:
% I want to hide from here ...
\section{Section 1}
\subsection{Subsection 1.1}
\begin{theorem}
First
\end{theorem}
% ... to here
\begin{theorem}
Second
\end{theorem}
I want to see only the second theorem with the original numbering in PDF: Theorem 1.1.2.
My question is very similar to this one, but the author of that question works with Sage and the accepted answer, as far as I understand, is Sage-specific.
If there is no generic way to achieve this effect, I'd be happy if there are ways to hide the following objects:
- Section/subsection titles
- Theorems/lemmas, etc.
- Figures
I also thought about "redirecting" the output to another file (not the PDF), but I couldn't find a solution.
The final alternative would be to "hardcode" the numbers of theorems, but I want to avoid that.





\includeonlywhich is designed to do exactly this. – David Carlisle Apr 20 '17 at 18:53\begin{hidestuff}...\end{hidestuff}(where you define what should be hidden insidehidestuffbut still counted)? – Werner Apr 20 '17 at 18:59