diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/biblatex/examples/22-indexing-subentry.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/biblatex/examples/22-indexing-subentry.tex | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/biblatex/examples/22-indexing-subentry.tex b/Master/texmf-dist/doc/latex/biblatex/examples/22-indexing-subentry.tex new file mode 100644 index 00000000000..ff4f8fb32ec --- /dev/null +++ b/Master/texmf-dist/doc/latex/biblatex/examples/22-indexing-subentry.tex @@ -0,0 +1,87 @@ +% +% This file demonstrates indexing with the 'imakeidx' package. +% This file is processed as follows: +% +% latex file +% bibtex/biber file +% latex file +% latex file +% +% Note that the file name suffix may be omitted. It's 'latex file' and not +% 'latex file.tex'. Also note that '-t <file>' is optional. +% +\documentclass[a4paper]{article} +\usepackage[T1]{fontenc} +% +% The 'imakeidx' package provides advanced indexing facilities with support for +% multiple indexes. Unlike the 'index' package, 'imakeidx' does not generate +% "self-protecting" index entries. So we need to protect control sequences in +% indexing fields from expansion. For an example see the 'knuth:ct:a' entry in +% biblatex-examples.bib. +% +\usepackage{imakeidx} +\usepackage[american]{babel} +\usepackage{csquotes} +% +% We set the 'indexing' package option and use the 'authortitle' +% style in this example. +% +\usepackage[indexing=cite,style=authortitle,babel=hyphen,backend=biber]{biblatex} +\addbibresource{biblatex-examples.bib} +% +% We want two indexes: an index of names with title subentries, an index of +% titles organized by year. They are defined by way of \makeindex, see the +% documentation of the 'imakeidx' package for details. +% +\makeindex[name=name-title,title={Name and Title Index}] +\makeindex[name=year-title,title={Year and Title Index}] +% +% A 'name:title' indexing bibmacro can be found in biblatex.def. It takes the same +% arguments as the 'index:name' bibmacro. Note that the title fields are accessed +% inside the name indexing directive. So we have to test for missing titles. +% +\DeclareIndexNameFormat{name:title}{% + \iffieldundef{title} + {\usebibmacro{index:name}{\index[name-title]}{#1}{#3}{#5}{#7}} + {\usebibmacro{index:name:title}{\index[name-title]}{#1}{#3}{#5}{#7}}} +% +% Auxiliary indexing macros in biblatex.def can be used to define additional +% indexing directives with subentries. The following directive creates entries +% for the year-title index. +% +\DeclareIndexFieldFormat{with:year}{% + \iffieldundef{year} + {\usebibmacro{index:entry}{\index[year-title]}{% + \mkbibindexentry{0}{Not dated}% + \subentryoperator% + \mkbibindexfield{\thefield{indexsorttitle}}{\emph{#1}}}} + {\usebibmacro{index:entry}{\index[year-title]}{% + \thefield{year}\subentryoperator% + \mkbibindexfield{\thefield{indexsorttitle}}{\emph{#1}}}}} +% +% We redefine the 'citeindex' bibmacro to use the new indexing directives. +% +\renewbibmacro*{citeindex}{% + \ifciteindex + {\indexnames[name:title]{labelname}% + \indexfield[with:year]{indextitle}} + {}} + +\begin{document} + +\section*{Indexing with the \texttt{imakeidx} package} + +% We cite a few items. These citations will be added to the indexes. +\cite{knuth:ct,knuth:ct:a,knuth:ct:c,knuth:ct:d} +\cite{aristotle:anima,aristotle:poetics,aristotle:physics,aristotle:rhetoric} + +\clearpage + +% We print the printbibliography... +\printbibliography +% ...and the indexes +\raggedright +\printindex[name-title] % the name-title index +\printindex[year-title] % the year-title index + +\end{document} |