0

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?

MWE:

\documentclass[a4paper,         
        12pt,                   
        bibliography=totoc,     
        index=totoc,            
        parskip=false
        ]{scrreprt}

\usepackage[utf8]{inputenc}     
\usepackage[T1]{fontenc}
\usepackage[style=authoryear]{biblatex}
\addbibresource{Literatur_Citavi.bib} 

\usepackage{scalerel}           % scale math even smaller

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

$\varphi_{\scaleto{sig}{3pt}}$

\nocite{Kister.2019, Blankertz.2019}
\printbibliography

\end{document}              
  • 1
    why do you want to set the tocdepth in the toc??? (\protect\setcounter probably works, but it seems a very strange construct) – David Carlisle Sep 7 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. – David Carlisle Sep 7 at 8:30
2

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 Sep 7 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.