I'm trying to perform a division and sometimes it works and other times I get and unexpected value.
\documentclass[fleqn]{article}
\usepackage{amsmath}
\usepackage{enumerate}
\usepackage{cancel}
\begin{document}
\newcommand\coeff{5}
\newcommand\addend{13}
\newcommand\result{45}
\newcommand\exaddend{\the\numexpr\addend*\coeff}
\newcommand\resultrest{\the\numexpr\result-\exaddend}
\begin{align*}
\coeff x+\exaddend&=\result \\
-\exaddend&=-\exaddend\\
\coeff x&=\resultrest\\
\frac{\cancel{\coeff}x}{\cancel{\coeff}}&=\frac{\resultrest}{\coeff}\\
x&=\boxed{\the\numexpr\resultrest/\coeff\relax}
\end{align*}\vspace{1em}
\end{document}
It works if I use fixed values:
It seems the last line \the\numexpr\resultrest/\coeff\relax seems to produce the issue. Please help!
$symbol, before\begin{aligned}and after\end{aligned}. – hesham Mar 20 '20 at 01:01\begin{enumerate} \item \begin{flushleft} $\begin{aligned}. Perhaps\begin{align}or\begin{align*}if you need no equations numbering are enough. – hesham Mar 20 '20 at 01:05fleqnoption in your class, e.g.,\documentclass[fleqn]{article}. – hesham Mar 20 '20 at 01:15fppackage. – hesham Mar 20 '20 at 01:24