使用 biblatex 的 Printindex 在最后一章末尾打印完整的参考书目

使用 biblatex 的 Printindex 在最后一章末尾打印完整的参考书目

我习惯biblatex在论文的每一章中打印参考书目。我决定在文档末尾添加“参考书目索引”,我可以按照此处写的一些建议来做。但是我有两个问题:

  • 最后一章参考书目使用时打印论文的完整参考书目\printindex[...]
  • 此处遵循的说明给出了按作者编制的索引,可以按标题编制吗?

在这里我写了一个MWE:

\documentclass[10pt]{book}

\usepackage[latin1]{inputenc}
\usepackage[spanish,es-nosectiondot,es-tabla]{babel}

%---------------
% Used packages at the document

\usepackage {eurosym}
\usepackage{calc}
\usepackage{mathtools}  
\usepackage{csquotes}
\usepackage{hyperref} 
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{wrapfig} 
\usepackage[font=scriptsize,labelfont=bf]{caption}
\usepackage[font=scriptsize,labelfont=bf]{subcaption}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}
\usepackage[spanish]{minitoc}

%-------------------------------------



\usepackage{filecontents}
\begin{filecontents*}{jobname.bib}
@article{Article1,
    title={Current Article 1},
    author={Someone, One and Sometwo, Two},
    journal={XXXXXXX},
    year=2015,
    volume=5,
    number=15,
    pages={15--20},
}
@article{Article2,
    title={Current Article 2},
    author={Anyone, One and Anytwo, Two},
    journal={XXXXXXX},
    year=2015,
    volume=5,
    number=15,
    pages={15--20},
}
\end{filecontents*}


%-------------------------------------
%Bibliography

\usepackage[ language=spanish,
         backend=biber,
         style=numeric-comp,
         subentry,
         indexing=cite,
         maxnames=6,
         sorting=none,
         refsection=chapter]{biblatex}

\addbibresource{jobname.bib} %addbibresource  
% -------------------------------------------------------
% Code from cacamailg to implement the index

\usepackage{imakeidx}
\makeindex[name=authors,title=Índice Bibliográfico,columns=1]
\makeindex[name=years,title=Years Index,columns=1]

\makeatletter
% For the "years" index, we redefine the ordinary bibmacro
% which indexes titles, so that it indexes into the years
% index instead
\renewbibmacro*{index:title}[2]{%
  \iffieldundef{year}
     {\usebibmacro{index:years}%
      {\index}%
      {\undated}%
      {\thefield{indexsorttitle}}%
      {\thefield{entrykey}}}
    {\usebibmacro{index:years}%
      {\index}%
      {\thefield{year}}%
      {\thefield{indexsorttitle}}%
      {\thefield{entrykey}}}}

\newbibmacro*{index:years}[4]{%
    \begingroup
     \protected@edef\theindexentry{%
      \unexpanded{#1}\yearsindex{#2!#3\actualoperator\unexpanded{\citefield}{#4}{indextitle}}}%
     \theindexentry
     \endgroup}

% For authors we just redefine the field format (so that it
% includes title and year information
\DeclareIndexNameFormat{default}{%
  \iffieldundef{year}
    {\usebibmacro{index:name}%
      {\index}%
      {#1}%
      {#3}%
      {#5}%
      {#7}%
      {\thefield{indexsorttitle}}%
      {\thefield{entrykey}}%
      {}}
   {\usebibmacro{index:name}%
      {\index}%
      {#1}%
      {#3}%
      {#5}%
      {#7}%
      {\thefield{indexsorttitle}}%
      {\thefield{entrykey}}%
      { (\thefield{year})}}}
% ... and modify the relevant bibmacro to add the extra information
\renewbibmacro*{index:name}[8]{%
  \begingroup
  \ifuseprefix
    {\protected@edef\theindexentry{%
       \unexpanded{#1}\authorsindex{%
         \ifblank{#4}{}{#4 }%
         \@firstofone #2% remove spurious braces
         \ifblank{#5}{}{ #5}%
         \ifblank{#3}{}{, #3}%
         \actualoperator
         \ifblank{#4}{}{\MakeCapital{#4} }%
         #2%
         \ifblank{#5}{}{ #5}%
         \ifblank{#3}{}{, #3}!#6
            \actualoperator\unexpanded{\citefield}{indextitle}#8}}}%
    {\protected@edef\theindexentry{%
       \unexpanded{#1}\authorsindex{%
         \@firstofone #2% remove spurious braces
         \ifblank{#5}{}{ #5}%
         \ifblank{#3#4}{}{,}%
         \ifblank{#3}{}{ #3}%
         \ifblank{#4}{}{ #4}!#6\actualoperator
            \unexpanded{\citefield}{#7}{indextitle}#8}}}%
  \theindexentry
  \endgroup}
\makeatother
\newcommand{\yearsindex}{[years]}
\newcommand{\authorsindex}{[authors]}

%-------------------------------

\begin{document}



\chapter{Chapert 1}
\minitoc %indice capítulo


cite{Article1}

\printbibliography[heading=subbibintoc, title={Bibliografía}]%, section=5]% 


\chapter{Chapert 2}
\minitoc %indice capítulo


cite{Article2}

\printbibliography[heading=subbibintoc, title={Bibliografía}]%, section=5]% 





\cleardoublepage
\phantomsection
\addstarredchapter{Índice Bibliográfico}


\printindex[authors]
%\printindex[years]


\end{document}

相关内容