Good evening, everybody. After having read lots of your formidable Q&A's (thank you for the insights) I am struggling hard with this problem and would like to pose a question:
What I intend to do is derive from the content of a part (which functions as a book title in a collection of handbooks) only a special substring (which can be derived by cropping after a " - " and (apart from outputting it) make an entry to the index.
This works "by hand" using the following MWE (problematic part commented out):
\documentclass[a4paper,11pt,parskip=full]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{xstring}
\usepackage{nameref}
\usepackage{imakeidx}
\usepackage{hyperref}
\makeindex
\newtoks\VATemp{}
\makeatletter
\newcommand{\getnamereftext}[1]{%
\@ifundefined{r@#1}{}{%
\unexpanded\expandafter\expandafter\expandafter{%
\expandafter\expandafter\expandafter\@thirdoffive\csname r@#1\endcsname
}%
}%
}
\makeatother
\newcommand{\VA}[1]{
\StrBehind{\getnamereftext{VA #1-Start}}{ - }[\VATemp]
\index{VA #1 - \VATemp}%
}
\begin{document}
\part{Verfahrensanweisung 145-1.8 - Just a Test}% ä to test for Umlaut
\label{VA 145-1.8-Start}
\VA{145-1.8}
\printindex
\end{document}
EDIT: When I use an "ä" in the title of a part, I don't get any index entry (or so it seems). To be exact, main.idx contains the following:
\indexentry{VA 145-1.8 - Just \unhbox \voidb@x \bgroup \U@D 1ex{\setbox \z@ \hbox {\char 127}\dimen@ -.45ex\advance \dimen@ \ht \z@ \fontdimen 5\font \dimen@ }\accent 127\fontdimen 5\font \U@D a\egroup Test|hyperpage}{1}
which means, that the Umlaut is expanded very strangely (and leads to an error concerning UTF-8 in Overleaf).
Does anybody know a way around this? Will I have to look at the extraction of thepartname by nameref or rather at the indexing process...? Or did I miss any Options in inputenc / imakeidx or any other package?