# Customize title of listofschemes

While trying to customize the title that is printed by the command \listofschemes of the chemstyle package, I have encountered an unexpected behaviour.

To quote from the chemstyle manual:

To match the \listoffigures and \listoftables macros provided by the LaTeX kernel, chemscheme provides a \listofschemes command. This works in the same way as the kernel commands, with the default text stored in the macro \listschemename.

In order to overwrite the default title of the list of figures, I usually use the following command in the preamble of my documents:

\addto\captionsngerman{\renewcommand\listfigurename{Verzeichnis der Abbildungen}}


While this command works as expected, the analogous command to change the title of the list of schemes, has no effect when using ngerman as the language specification. (As shown in the following MWE). If one changes ngerman to english the expected output is enerated.

Is there any possibility to overcome this?

\documentclass[ngerman]{article}
\usepackage{graphicx}
\usepackage{babel}
\usepackage{chemstyle}

\begin{document}

\listofschemes
\listoffigures

\begin{scheme}
\includegraphics[scale=0.25]{example-image}
\end{scheme}

\begin{figure}
\includegraphics[scale=0.25]{example-image}
\end{figure}

\end{document}


The chemscheme package, which is responsible for the \listofschemes command adds its own translation for \listschemename at begin document, so your \addto command appears too early and is overridden.

However, it's not sufficient to delay it with \AtBeginDocument, because chemscheme also performs \selectlanguage{\languagename}.

Solution: execute also \csname captions\languagename\endcsname.

\documentclass[ngerman]{article}
\usepackage{graphicx}
\usepackage{babel}
\usepackage{chemstyle}

\AtBeginDocument{%
\csname captions\languagename\endcsname
}

\begin{document}

\listofschemes
\listoffigures

\begin{scheme}
\includegraphics[scale=0.25]{example-image}
\caption{What's up, doc?}
\end{scheme}

\begin{figure}
\includegraphics[scale=0.25]{example-image}
\caption{What's up, doc?}
\end{figure}

\end{document}


The first \addto instruction could be outside \AtBeginDocument, but it's more consistent to keep all of them together.