\documentclass[tightpage, border=10pt]{standalone} \usepackage{varwidth} ... preamble \begin{document} \begin{varwidth}{\linewidth} ... contents \end{varwidth} \end{document}
CTRL + SHIFT + S