Issue: My Latex files are pretty big already, but lately I added the scalerel package and since then get the error message

! Undefined control sequence.\calc@initB ->\calc@B\calc@A \addtocontents{toc}{\setcounter{tocdepth}{3}}

However the interesting thing is, once I remove the package I still run into errors, I need to reload my .tex file to make it work again.

I finally figured out that the package in combination with \addtocontents{toc}{\setcounter{tocdepth}{3}} causes the error.

Question: Is there any incompatibility of the package scalerel with certain settings or other packages known? Or is there any altnerative to get my subspricts that small?




\usepackage{scalerel}           % scale math even smaller

\addtocontents{toc}{\setcounter{tocdepth}{3}} % here comes the trouble


\nocite{Kister.2019, Blankertz.2019}

  • 1
    why do you want to set the tocdepth in the toc??? (\protect\setcounter probably works, but it seems a very strange construct) Commented Sep 7, 2019 at 8:24
  • there is no need to use scaling to get small subscripts you can use \DeclareMathSizes to declare the font sizes to use for subscripts at each main font size. Commented Sep 7, 2019 at 8:30

1 Answer 1


This is a "fragile command in a moving argument" error, so the standard \protect command avoids the error

\addtocontents{toc}{\protect\setcounter{tocdepth}{3}} % here comes the trouble

But changing the tocdepth within the table of contents seems a rather odd thing to do?

  • thanks for your answer that actually solved the issue. I did this because I wanted to have my Appendix sections numbered as A.1, A.2,.. and so on, but not listed in the table of contents, so it would only appear as A Appendix
    – Quastiat
    Commented Sep 7, 2019 at 12:35

You must log in to answer this question.

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