Created
January 24, 2019 18:56
-
-
Save fKunstner/1e23ee60514d2e81529220abba99112d to your computer and use it in GitHub Desktop.
Dynamic page length in Latex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \documentclass[11pt]{article} | |
| \input{oneSectionPerPage} | |
| \usepackage{hyperref} | |
| \usepackage{lipsum} | |
| \title{Example of dynamic page length} | |
| \author{} | |
| \date{} | |
| \begin{document} | |
| \maketitle | |
| \section{Yes, it's silly} | |
| It is obviously not very useful for typesetting printed material. | |
| However, I found this layout useful for taking short, related notes | |
| (e.g., theorems and definitions) when working on bigger projects, | |
| especially when there is no overall structure. | |
| \noindent | |
| Adapted from \href{https://tex.stackexchange.com/a/280209/174397}{https://tex.stackexchange.com/a/280209/174397} | |
| \section{Each section has its own page} | |
| \lipsum | |
| \end{document} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % Style | |
| \usepackage{geometry} | |
| \def\maxpageheight{100cm} | |
| \geometry{a4paper, paperheight=\maxpageheight} | |
| \geometry{bottom=3cm, top=2cm, left=2cm, right=8cm} | |
| \pagenumbering{gobble} | |
| % Redefine pdf height | |
| \makeatletter | |
| \let\old@makecol\@makecol | |
| \def\bottomAdditionalMargin{2in} | |
| \def\@makecol{ | |
| \old@makecol | |
| \setbox\@outputbox\vbox{\unvbox\@outputbox} | |
| \pdfpageheight=\dimexpr\ht\@outputbox+\dp\@outputbox+\bottomAdditionalMargin\relax | |
| } | |
| \makeatother | |
| % clearpage before each section | |
| \newcommand*{\originalSection}{} | |
| \let\originalSection\section | |
| \renewcommand*{\section}{\clearpage\originalSection} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment