到 使用 biblatex 创建人员登记册似乎比我想象的要复杂得多。
我怎样才能创建一个半自动的人员登记册\ref
?
我有 20 个人需要在一份文档中提及。在 LaTeX 中实现分组和排序比较复杂,但我可以非常轻松地手动完成,而且 LaTeX 可以为我管理链接和反向链接。
目前我使用的解决方案类似如何将所有被引著作的作者纳入人物索引中?。它可以工作但是它不能处理手动分组和排序。
包含超链接和反向链接的最终文档应如下所示
The sample was prepared by \person[Mr.]{Miller}.
Register of Persons =================== Prof. Dr. M. Miller, University of M (p. 4, 12) Dr. A. Foobar, University of M (p. 5) B. Foo, University of Z (p. 1)
答案1
您可以使用以下包实现此glossaries
目的:
\documentclass{report}
\usepackage{datatool-base}% provides \DTLinitials
\usepackage[colorlinks]{hyperref}
\usepackage{glossaries}
% Syntax: \newperson{label}{title}{forenames}{surname}{affiliation}
\newcommand*{\newperson}[5]{%
\newglossaryentry{#1}%
{%
name={#2\space\DTLinitials{#3}\space#4},
sort={#5},% sort on affiliation
description={#5},% affiliation
text={#2\ #4},% title \space surname
user1={#2},% title
user2={#3},% forenames
user3={#4}% surname
}%
}
\let\Ptitle\glsuseri
\let\Pforenames\glsuserii
\let\Psurname\glsuseriii
\newglossarystyle{person}%
{%
\glossarystyle{list}%
\glsnogroupskiptrue
\renewcommand*{\glossaryentryfield}[5]{%
\item[]\glsentryitem{##1}\glstarget{##1}{##2},
##3 (p.~##5)}%
}%
\makeglossaries
\newperson{miller}{Prof.\ Dr.}{Marmaduke}{Miller}{University of M}
\newperson{foobar}{Dr.}{Aardvark}{Foobar}{University of M}
\newperson{foo}{Mr}{Bar}{Foo}{University of Z}
\begin{document}
The screwdriver was turned by \gls{miller}.
The hammer was whacked by \gls{foobar}.
\Gls{foo}['s] thumb throbbed.
\printglossary[title={Register of Persons},style=person]
\end{document}
答案2
唉,nameauth
不会进行正向引用。它将尊重索引条目链接回相关页面。
以下是通常能完成的 MWE nameauth
。您获得的重点是名称的自动格式化。该软件包(主要)用于印刷品。不过,还是感谢这篇文章。它给了我一个在某个时候扩展功能的想法。
\documentclass[11pt]{article}
\usepackage{nameauth}
\usepackage{makeidx}
\usepackage[colorlinks]{hyperref}
\title{nameauth test}
\author{}
\date{}
\frenchspacing
\begin{nameauth}
\<Miller & Prof. Dr. M. & Miller & >
\<Foobar & Dr. A. & Foobar & >
\<Foo & B. & Foo & >
\end{nameauth}
\TagName[Prof. Dr. M.]{Miller}{, University of M}
\TagName[Dr. A.]{Foobar}{, University of M}
\TagName[B.]{Foo}{, University of Z}
\makeindex
\begin{document}
\maketitle
\section{Section 1}
The screwdriver was turned by \LMiller.
Do you call him \SMiller[Martin] or just \Miller?
I liked \LMiller[Mr.]'s lectures.
Not so much those of \LFoobar.
I thought \LFoobar[Mr.] was a little disjointed in his presentation.
I hear the new up-and-comer is \LFoo.
Do you know \Foo{} like I know \Foo?
\clearpage
\section{Section 2}
The screwdriver was turned by \LMiller.
Do you call him \SMiller[Martin] or just \Miller?
I liked \LMiller[Mr.]'s lectures.
Not so much those of \LFoobar.
I thought \LFoobar[Mr.] was a little disjointed in his presentation.
I hear the new up-and-comer is \LFoo.
Do you know \Foo{} like I know \Foo?
\clearpage
\printindex
\end{document}