I want to substract and multiply with an optional parameter and a constant with cm as unit. Like this:
\documentclass{article}
\usepackage{changepage, xintexpr}
\newcommand{\test}[2][1]{
\begin{adjustwidth}{(#1 -1)*0.8cm}{} %(#1 -1)*0.8cm
%\begin{adjustwidth}{0.8}{}
#2
\end{adjustwidth}
\begin{adjustwidth}{0.8cm}{}
Something else I need \#1 to be 1 at default
\end{adjustwidth}
}
\begin{document}
\noindent line1
\test{Sampletext}
\end{document}
However (#1 -1) * 0.8cm isn't working.
I've already achieved 0.8cm * #1 by using #1\dimexpr 0.8cm\relax
But I'm unable to get both operations working.
How can I do this?
PS.: Already looked at How to add, subtract, multiply, and divide in plain TeX? but couldn't figure it out...
