I use a LaTeX template for Xournal++
% This template avoids the scontents package, which is only available on relatively recent TeX distributions
\documentclass[varwidth=true, crop, border=5pt]{standalone}
% 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}
% Check if the formula is empty
\settoheight{\pheight}{\preview}
\ifthenelse{\pheight=0}{\GenericError{}{xournalpp:blankformula}{}{}}
\newcommandx{\graph}[3][1=,2=]{
\begin{tikzpicture}[scale=.5]
\begin{axis}[xlabel=$x$,ylabel=$y$, axis lines=center,samples=100, #2]
\addplot[#1]{ #3 };
\end{axis}
\end{tikzpicture}
}
% Render the user input
\textcolor{xpp_font_color}{\preview}
\end{document}
An output of above command is:
But I want to edit above command $\graph$ such that the output graph could look like in this picture and support multiple functions on the same chart and domain of x,y just be zero or postive values:
How can we edit above command in order for the output to look like the above picture, while adding support for any number of functions? Thank you for your help.
\graph
command?