How, in the context of a Tex macro, do I do arithmetic on integers and also capture the string representation of the value of an expression so that it can be displayed? Addition and subtraction would do for now, though I might need multiplication and division later. The expressions used in the MWE are simple, but it would be useful to know how to do more sophisticated stuff involving declaration and assignment of variables, and using the values of variables.
Here's a MWE (well, it compiles and produces something, just not what I want). My aim is to get the expressions -#1 and #1+#2 evaluated and decimal representations of their values displayed.
I have deliberately left the code littered with various attempts at getting what I want, to give an idea of what I have tried without success. By searching tex.SE I found references to the packages calc, etex and xlop, so I looked at their documentation, but I don't see anything there that is useful to my purpose.
I'm using pdfTex.
\documentclass[a4paper]{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
%\usepackage{calc}
% Found these out from https://tex.stackexchange.com/questions/284977/use-floating-point-with-calc
%\newcounter{dac}
%\newcounter{bad}
\newcommand\trian[4]{
\tkzDefPoint(0,0){A}
\tkzDefPoint(1,0){B}
\tkzDefPointBy[rotation=center A angle #2](B) \tkzGetPoint{C1}
\tkzDefPointBy[rotation=center A angle #1](C1) \tkzGetPoint{D1}
\tkzDefPointBy[rotation=center B angle -#3](A) \tkzGetPoint{D2}
\tkzDefPointBy[rotation=center B angle -#4](D2) \tkzGetPoint{C2}
\tkzInterLL(A,C1)(B,C2) \tkzGetPoint{C}
\tkzInterLL(A,D1)(B,D2) \tkzGetPoint{D}
\tkzDrawSegments(A,B A,C A,D B,C B,D C,D)
% \setcounter{dac}{ -#1 }
% \setcounter{bad}{ #1+#2 }
% \def\dac{ -#1 }
% \tkzLabelAngle[pos=6/\value{dac}](D,A,C){\value{dac}}
% \tkzLabelAngle[pos=6/{dac}](D,A,C){dac}
% \tkzLabelAngle[pos=6/{\dac}](D,A,C){\dac}
% \tkzLabelAngle[pos=-6/#1](D,A,C){\value{-#1}}
\tkzLabelAngle[pos=-6/#1](D,A,C){- #1}
\tkzLabelAngle[pos=6/(#1+#2)](B,A,D){#1+#2}
\tkzLabelAngle[pos=6/#3](D,B,A){#3}
\tkzLabelAngle[pos=6/#4](C,B,D){#4}
}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}[scale=5.0]
\trian{-40}{70}{50}{20}
\end{tikzpicture}
\end{figure}
\end{document}
apnum
macros from Petr Olzak.