1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
% This template uses the scontents package, which is only available on relatively recent TeX distributions. In case it is not available on your system, use the legacy_template.tex
\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}
% for storing in memory verbatim content to be reused later
\usepackage{scontents}
% Blank formula checking
\usepackage{ifthen}
\newlength{\pheight}
% Color support
\usepackage{xcolor}
\definecolor{xpp_font_color}{HTML}{%%XPP_TEXT_COLOR%%}
% User input
\begin{scontents}[store-env=preview]
\(
\displaystyle
%%XPP_TOOL_INPUT%%
\)
\end{scontents}
\begin{document}
\setTextWidthReference
% Check if the formula is empty
\settoheight{\pheight}{\getstored[1]{preview}}%
\ifthenelse{\pheight=0}{\GenericError{}{xournalpp:blankformula}{}{}}
% Render the user input
\textcolor{xpp_font_color}{\getstored[1]{preview}}
\end{document}
|