Is there a package or flag to pdflatex or xelatex such that if I have a document structured like
\begin{document}
\maketitle
\section{S1}
General stuff 1
\subsection{details}
kewrweklrweewrwerwe
\section{S2}
General stuff 2
\subsection{d2}
Lorem ipsum
\sub开发者_运维知识库subsection{d3}
Even more details
\end{document}
How can I quickly generate a pdf that has just section1 general stuff 1 and section 2 general stuff 2, but no subsections?
Thanks!
Here is an extremely hackish attempt that is very fragile. Use only for testing purposes.
\documentclass{article}
\newbox\trashbox
\let\normalsection\section
\let\normalsubsection\subsection
\let\normalenddocument\enddocument
\protected\def\subsection{%
\protected\def\section{%
\egroup
\let\section\normalsection
\normalsection
}%
\protected\def\enddocument{%
\egroup
\let\enddocument\normalenddocument
\normalenddocument
}%
\setbox\trashbox=\vbox\bgroup
\normalsubsection
}
\title{abc}
\begin{document}
\maketitle
\section{S1}
General stuff 1
\subsection{details}
kewrweklrweewrwerwe
\section{S2}
General stuff 2
\subsection{d2}
Lorem ipsum
\subsubsection{d3}
Even more details
\end{document}
精彩评论