% This template avoids the scontents package, which is only available on relatively recent TeX distributions \documentclass[varwidth=0.999\maxdimen, crop, border=5pt]{standalone} % The upper limit value of 'varwidth' can be referenced by \hsize. \newcommand*{\setTextWidthReference}{% \setlength{\textwidth}{345.0pt}% Same value when you use 'varwidth=true'. \setlength{\linewidth}{\textwidth}% \setlength{\columnwidth}{\textwidth}% } % Packages \usepackage{amsmath} \usepackage{amssymb} % Blank formula checking \usepackage{ifthen} \newlength{\pheight} % Color support \usepackage{xcolor} \definecolor{xpp_font_color}{HTML}{%%XPP_TEXT_COLOR%%} % User input \def\preview{\( \displaystyle %%XPP_TOOL_INPUT%% \)% } \begin{document} \setTextWidthReference % Check if the formula is empty \settoheight{\pheight}{\preview} \ifthenelse{\pheight=0}{\GenericError{}{xournalpp:blankformula}{}{}} % Render the user input \textcolor{xpp_font_color}{\preview} \end{document}