# Automatically generate fitted pdfs

I'm writing some kind of a notebook using LaTex. I'd like to have basically one page for each note, the page being fitted to the text of the note. For the moment I'm using a very long page by default, generate the pdfs using pdflatex, and then crop them using pdfcrop, and finally merge them using gs. Everything runs fine, but the links inside the cropped pdfs are broken.

Can I generate fitted pdf directly from pdflatex? Otherwise, can I crop the pdfs and preserve the links? Thanks!

Next code was taken from this answer and slightly modified adding multi=task, border=2mm options.

It uses standalone class as cropping tool and tcolorbox to produce notes (task in this case).

\documentclass[multi=task,border=2mm]{standalone}

\usepackage[theorems]{tcolorbox}% version 2.51 (2013/09/16)
\usepackage{lipsum}

\begin{document}

\lipsum[3]

• @Martin Please read page 9 from standalone documentation. You need to fix some environment to be cropped. But it can be something like \newenvironment{note}{}{}. If you could post some example with your notes ... – Ignasi Jan 29 '15 at 11:29