When I embed a glossary entry as part of the argument for the index (example here: \index[m]{\gls{ccc}}
), the index groups the entry under 'symbols', rather than the begin letter of the glossary entry (in the case of the following MWE the 'c'). How do I prevent this?
My reason for creating this kind of index-entry is that the hyperref package then makes the index entry in the PDF clickable, which then takes me directly to the glossary. However, the unintended side effect is that the glossary then also references the page number of the index. How do I avoid this?
This is the MWE - note, there's a index_style.ist
file below that is needed too.
\documentclass[10pt, paper=156mm:235mm, BCOR=12mm, headings=optiontotocandhead, headings=openany]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage[dutch,british,UKenglish]{babel}
\KOMAoptions{headings=small}
\DeclareTOCStyleEntry[
linefill={},
]{tocline}{chapter}
\makeatletter
\newcommand \Dotfill {\leavevmode \leaders \hb@xt@ 0.75em{\hss .\hss }\hfill \kern \z@}
\makeatother
\newcommand{\toclineinsert}[3][14mm]{%
\Dotfill #2\makebox[#1][l]{#3\Dotfill}%
}
\usepackage[splitindex]{imakeidx}%Indexing package
\makeindex[intoc,options= -s index_style.ist,name=m,title=\mbox{Index},columns=2]
\usepackage[T1]{fontenc}
\usepackage{Alegreya,AlegreyaSans}
\renewcommand*\oldstylenums[1]{{\AlegreyaOsF #1}}
%hyphenation
\pretolerance=4000
\tolerance=2000
\emergencystretch=8pt
\usepackage[hidelinks, bookmarksopen=false]{hyperref}
\usepackage[toc]{glossaries}
\makeglossaries
\newglossaryentry{aaa}
{
name=ate all apples,
description={I did. I ate all apples and I liked it. But now my tummy hurts and I regret my decision}
}
\newglossaryentry{bbb}
{
name=bought both boxes,
description={Yes, that's true. Why just buy the one if you can afford both? That's what I thought. However, now my wallet's empty, and so are my boxes}
}
\newglossaryentry{ccc}
{
name=caught Cathy's cold,
description={Could have been worse though. It was really just a cold. Cathy and I are going to be OK}
}
\begin{document}
\frontmatter
\tableofcontents
\addchap[tocentry={\emph{Preface}}, head={\textsc{preface}}]
{Preface}
I \gls{ccc} last Wednesday. \lipsum
\mainmatter
\addchap[tocentry={Exaltation \toclineinsert{\normalfont{17 December}}{} },head={}]{Exaltation}
I \gls{aaa} and I \gls{bbb}\index[m]{\gls{ccc}}.
\backmatter
\printglossary
\printindex[m]
\end{document}
working together with the index_style.ist
file:
headings_flag 1
heading_prefix "\n\\raggedright\\large\\sffamily\\normalfont%
\\noindent\\textbf{"heading_suffix "}\\par\\nopagebreak\n"
item_0 "\n \\item \\small "
delim_0 " \\Dotfill "
delim_1 " \\Dotfill "
delim_2 " \\Dotfill "
\index[m]{cought Cathy's cold@\gls{ccc}}
will give the correct placement of the index entry. I don't the glossary package well enough to find out how to generate that text automatically though.ist
file in your MWE, you can use\begin{filecontents*}{index_style.ist}
ist
file in my MWE using your tip and update my question after.