UPDATE 2023-05-20
The new release of dynkin-diagrams
released on 2023-05-18 has fixed the issue, by prefixing every usage of \renewcommand{\do}[1]{...}
by \providecommand{\do}{}
.
ORIGINAL ANSWER
For historical reasons, at the start of a document (that is, after \begin{document}
is processed), \do
has the meaning \noexpand
.
There have been discussions about removing this “hidden feature”, but it was thought that preserving this is important, because it has been so for about 30 years and packages might use it.
And indeed do, as you discovered. If you look in the documentation of etoolbox
, you'll find several examples of
\renewcommand{\do}[1]{...}
and dynkin-diagrams
makes extensive usage of etoolbox
for list processing. It could dispense with it, by choosing expl3
instead of mixing a few of it with etoolbox
and xstrings
.
As a consequence, no class or package should ever issue \let\do\relax
, because, as far as \renewcommand
is concerned, something equivalent to \relax
is seen as undefined. Unfortunately, scrbook
does it.
You can use a workaround. When starting a diagram, the package issues \dynkin@save
and you can hook in it to provide a definition for \do
.
\documentclass{scrbook}
\usepackage{dynkin-diagrams}
\AddToHook{cmd/dynkin@save/before}{\providecommand{\do}{}}
\begin{document}
\chapter{One}
Here is one \dynkin A2
\end{document}
\chapter
, it seemsscrbook
is setting the definition of\do
to\relax
(put\meaning\do
after\chapter
then see what happens when you remove\chapter
). The\dynkin
command does\renewcommand{\do}{...}
which throws an error because it expects\do
to be defined.tocbasic
is not the only package, that has\let\do\relax
and shows an example with the same error without using KOMA-Script. So you should report the issue to thedynkin-diagrams
maintainer (AFAIK to the email address in the sty file).