Custom MaGGI Macro in Latex

When using a calculator in my school, we have to note it in a specific way. It‘s called the MaGGI-concept, which is made up of four pieces: Mathematical idea, Graphic calculator input, Graphic calculator output, and Interpretation. What‘s special about it, is the intentation. Both Gs have to be offset by „one tab“.

I tried to build something like this with the enumerate package, but I couldn’t get it to work. How can I make a custom macro for this?

For example:

\begin{maggi}
\ma LOREM
\g IPSUM
\g DOLOR
\i SIT
\end{maggi}


You could use \@hangfrom, you couldn't use a \par token (or two consecutive new lines) inside this environment this way.

Also you might want to change the definition of \maggicmd (or don't use it at all) if you want to.

\documentclass[]{article}

\usepackage{amsmath}

\makeatletter
\newlength\maggi@indent
\setlength\maggi@indent{1cm}
\newcommand*\MAggi{\PackageError{maggi}{Don't use me outside of the maggi environment}{}}
\newcommand*\maGgi{\PackageError{maggi}{Don't use me outside of the maggi environment}{}}
\newcommand*\magGi{\PackageError{maggi}{Don't use me outside of the maggi environment}{}}
\newcommand*\maggI{\PackageError{maggi}{Don't use me outside of the maggi environment}{}}
\newenvironment{maggi}
{%
\def\MAggi{\par\bigskip\@hangfrom{\makebox[\maggi@indent][l]{Ma:}}}%
\def\maGgi{\par\medskip\@hangfrom{\kern\maggi@indent\makebox[\maggi@indent][l]{G:}}}%
\let\magGi\maGgi
\def\maggI{\par\medskip\@hangfrom{\makebox[\maggi@indent][l]{I:}}}%
}
{%
\par\bigskip
% the following will supress paragraph indentation if you don't put an empty
% line after \end{maggi}
\@endpetrue
}
\makeatother
\newcommand\maggicmd[1]{\operatorname{\mathsf{\MakeUppercase{#1}}}}

\usepackage{duckuments}

\begin{document}
\blindduck[-]
\begin{maggi}
\MAggi I want to find the intersection between $f$ and $g$
\maGgi $Y_1 = x^2$\\
$Y_2 = 4$\\
$\maggicmd{intersect}(Y_1, Y_2, \text{Guess next to }-2)$\\
$\maggicmd{intersect}(Y_1, Y_2, \text{Guess next to }2)$
\magGi $(-2|4)$\\
$(2|4)$
\maggI The graphs of $f$ and $g$ have two intersections. One in $(-2|4)$ and
one in $(2|4)$.
\end{maggi}
\blindduck[-]
\end{document}


• I became an environment! Sep 26, 2021 at 13:01
• Works like a charm! Thank you very much! Sep 26, 2021 at 19:53