1

I am trying to use the package calculator to return current year plus one. I have tried the following but it does not seem to work. Any suggestions?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{calculator}

\begin{document}

\COPY{\the\year{}}{\numberYYYY}
\numberYYYY

\ADD{\numberYYYY}{1}{\yearPlus} \yearPlus

\end{document}

Instead of 2022 it returns =12021 and an error message "Illegal unit of measure (pt inserted)". Thanks

2
  • You shouldn't redefine \=, that's a macro used by LaTeX.
    – Skillmon
    Commented Mar 6, 2021 at 15:34
  • you dont need {} after \the\year{}.
    – touhami
    Commented Mar 6, 2021 at 15:41

1 Answer 1

4

No idea on how to do this in calculator, but you can do the following to let a macro to the result of your calculation:

\newcommand*\myresult{} % check whether the macro is available
\edef\myresult{\the\numexpr\year+1\relax}
1
  • Thanks! Actually the only thing I need is the {\number\numexpr\year+1\relax} it works like a charm.
    – TCS
    Commented Mar 6, 2021 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .