To make the structure of documents (here: my PhD-thesis) comprehensible straight from the ToC, I would like to insert some key words or key phrases in each element of the ToC. I saw this device in a teaching book and I thought it would be a helpful little improvement for longer documents.
My first description of the desired layout lacked of precision, I hope this one is more clear.
Requirements for user-friendlybility:
I am looking for a solution that handles key words or key phrases which belong to one part, section etc. in the following way:
a) puts key words/phrases in rows
b) divides them through hyphens
c) one line under the actual part, section etc.
d) key words/phrases without page number
e) depending on the number of key words/phrases it can exceed one line
It should look like this:
Contents
1 section ………………………..1
key word 1 – key phrase 2 – key word 3
1.1 subsection ………………………….5
key word 1 – key phrase 2 – key word 3 –
key word 4 – key phrase 5 – key word 6
Requirement for writer-friendlybility: To make it easier for the writer of the document one command is hoped-for that adapts to a given section, part etc. without any specification within the command in order to prevent him from adjusting the command every time when he is copying it from one sections to a part, subsection, etc.
In the .tex-file it should look like this:
\begin{document}
\section{section}
bla bla \command{keyword1} few lines or pages of bla bla \command{keyword2} ....
\subsection{subsection}
bla bla \command{keyword1} few lines or pages of bla bla \command{key phrase2} ....
\end{document}
Does anyone have an idea how to do it?
PS: To convert the keywords in the toc into hyperref-keywords take a look here: Hyperref-ize the keywords in toc. It works with egregs solution.
Best Answer
I'll leave to the OP the task of redefining
\formatkwsection
and\formatkwsubsection
to suit his needs.