对于一本书的出版,我需要创建一个索引,列出文中出现的所有人物,以及他们的一些传记信息。它的格式应该是这样的
Personenregister
KAMMEL, Richard, Lic. Dr. 310f., 347, 363, 420
born 20.12.1882 Munich, Germany, died 1.12.1957 Berlin, was a great actor and so on
KUMMEL, Michael, Lic. Dr. 310f., 347, 363, 420
born 21.12.1882 Berlin, Germany, died 2.12.1957 Munich, was a great writer and so on
其中 310f.、347、363、420 是文本中人物出现的页数。由于我正在为这本书创建多个索引,因此我使用了包多态性,这又需要多列。我目前正在使用 makeindex,也许可以用 texindy 来做点什么。这是一个 MWE
\documentclass{book}
\usepackage[bookmarks]{hyperref}
\usepackage{lipsum}
\usepackage{multicol}
\usepackage{multind}
\newcommand{\p}[1]{#1\index{personen}{#1}}
\makeindex{personen}
\begin{document}
\p{Kammel, Richard, Lic. Dr.}
\p{Kummel, Michael, Lic. Dr.}
\newpage
\newpage
\p{Kammel, Richard, Lic. Dr.}
\p{Kummel, Michael, Lic. Dr.}
\newpage
\printindex{personen}{Personenregister}
\end{document}
如果我可以在索引命令中以某种方式指定传记信息,那就太理想了,比如
\p{Kammel, Richard, Lic. Dr.}{born 20.12.1882 Munich, Germany, died 1.12.1957 Berlin, was a great actor and so on}
但如果这不可能,其他任何解决方案都可以。非常感谢您的帮助,这对我来说有点太复杂了。
答案1
工作解决方案:
\documentclass{book}
\usepackage[bookmarks]{hyperref}
\hypersetup{hidelinks}
\usepackage{lipsum}
\usepackage[nopostdot,toc]{glossaries}
\glsaddkey*% star version needed as default value needs expanding
{nn}% key
{\glsentrytext{\glslabel}nn}% default value
{\glsentrynn}% command analogous to \glsentrytext
{\Glsentrynn}% command analogous to \Glsentrytext
{\glsnn}% command analogous to \glstext
{\Glsnn}% command analogous to \Glstext
{\GLSnn}% command analogous to \GLStext
\glsaddkey*% star version needed as default value needs expanding
{fn}% key
{\glsentrytext{\glslabel}fn}% default value
{\glsentryfn}% command analogous to \glsentrytext
{\Glsentryfn}% command analogous to \Glsentrytext
{\glsfn}% command analogous to \glstext
{\Glsfn}% command analogous to \Glstext
{\GLSfn}% command analogous to \GLStext
\makeglossaries
\loadglsentries{person-glossary}
\newglossarystyle{urls}
{% based on list style
\setglossarystyle{list}%
\renewcommand{\glossentry}[2]{%
\item[\glsentryitem{##1}%
\glstarget{##1}{\glossentryname{##1}}]
\glspostdescription \qquad\qquad##2%
\\
\glossentrydesc{##1}}
}
\newcommand*{\entryurl}[1]{%
\glsdoifexists{#1}%
{%
\glsletentryfield{\thisurl}{#1}{useri}%
\expandafter\url\expandafter{\thisurl}%
}%
}
\begin{document}
\chapter{Sample}
\forglsentries{\thislabel}{\gls{\thislabel}. }
The URL associated with the entry \gls{abromeit}
is \entryurl{abromeit}.
\newpage
\newpage
\gls{abromeit}
\newpage
\newpage
\gls{abromeit}
\newpage
\newpage
\glsnn{abromeit}
\printglossary[style=urls,nopostdot=true,nogroupskip]
\end{document}
使用 person-glossary.tex:
\newglossaryentry{abromeit} {
name = {Abromeit, Hans - Jürgen}, nn = {Abromeit},
fn = {Hans - Jürgen Abromeit}, description = {
geb. 13.10.1954 Gevelsberg(Westfalen),
seit 2001 Bischof der PEK,
seit Pfingsten 2012 Bischof im Sprengel Mecklenburg und Pommern.
}
}