0

Based on the question here, I used the following code

\DeclareCiteCommand{\footfullcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

for generating an index of the authors of my document. Unfortunately, I am studying an author and I cite it many times in the text its name appears a lot of time in the index.

Is there any solution to hide a specific entry in the index automatically? :-)

MWE:

\documentclass[english]{article} 
\listfiles
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{article,
  author = {Nachname, Vorname},
  title = {Titel des Zeitschriftenartikels},
  journal = {Zeitschrift},
  year = {2006},
  volume = {6},
  pages = {19--75}
}
@BOOK{book,
  author = {Buchautor, Hans-Wilhelm},
  title = {Irgendein Buch},
  address = {Buch am Wald},
  year = {2000}
}
\end{filecontents}
\usepackage{babel,csquotes}

\usepackage[
texindy
]{indextools}
\makeindex
\makeindex[columnseprule,intoc=true,title=Index,name=perso]


\usepackage[
  style=authortitle,
    indexing=true
]{biblatex}
\bibliography{\jobname}

\DeclareCiteCommand{\footfullcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareIndexNameFormat{default}{%
\nameparts{#1}%
\usebibmacro{index:name}%
{\index[perso]}%
{\namepartfamily}%
{\namepartgiveni}%
% {}% L1
% {}% L2
{\namepartprefix}% generates spurious space L3
{\namepartsuffix}% generates spurious space L4
}

\begin{document}
\index[perso]{check}
\index[perso]{checkb} 
\index[perso]{check} 
\index[perso]{checkb} 
\index[perso]{checkb}
\footcite{book}\newpage
\footfullcite{book}\newpage
\cite{article}\newpage
\footcite{article}\newpage
\footfullcite{article}
\printbibliography
\printindex[perso]
\end{document}
3
  • Even if it's based on the other question, please post a complete MWE here, too.
    – Skillmon
    Commented Oct 24, 2017 at 20:25
  • 1
    Based on which specifics should a citation be hidden?
    – Skillmon
    Commented Oct 24, 2017 at 20:32
  • @Skillmon Based for instance on the author name? Or any specified key (like check or checkb in my MWE).
    – Guuk
    Commented Oct 24, 2017 at 20:43

2 Answers 2

1

It is not quite clear to me what entries you want to exclude. But you can add rather easily a test to the citeindex macro:

\renewbibmacro*{citeindex}{%
  \ifciteindex
    {\iffieldequalstr{entrykey}{book}{}
      {\indexnames{labelname}%
       \indexfield{indextitle}}}
    {}}
10
  • For instance, I want to remove entry associated Buchautor, H.-W. associated to the bib item book.
    – Guuk
    Commented Oct 24, 2017 at 21:39
  • That's what my test above does. Commented Oct 24, 2017 at 21:40
  • Not totally, in fact, the book Buchautor, H.-W. is also obtained since the bibliography is built and then it add an item in the index.
    – Guuk
    Commented Oct 24, 2017 at 21:43
  • but if you want to exclude several keys this might get tedious.
    – Skillmon
    Commented Oct 24, 2017 at 21:45
  • 1
    @Skillmon: instead of a test for a field string one can also add a test for a category or a keywork. Commented Oct 24, 2017 at 21:50
0

There might be a better alternative to do this, but you could assign a category to a key which shouldn't cause an index. Sadly, this requires a change of all used citation macros. The following applies this change to the definition of \footfullcite you provided. Note that the key still shows up in the index for the page of the bibliography:

\documentclass[english]{article} 
%\listfiles
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{article,
  author = {Nachname, Vorname},
  title = {Titel des Zeitschriftenartikels},
  journal = {Zeitschrift},
  year = {2006},
  volume = {6},
  pages = {19--75},
}
@BOOK{book,
  author = {Buchautor, Hans-Wilhelm},
  title = {Irgendein Buch},
  address = {Buch am Wald},
  year = {2000}
}
\end{filecontents}
\usepackage{babel,csquotes}

\usepackage[
texindy
]{indextools}
\makeindex
\makeindex[columnseprule,intoc=true,title=Index,name=perso]


\usepackage[
  style=authortitle,
    indexing=true
]{biblatex}
\bibliography{\jobname}
\DeclareBibliographyCategory{noindex}% create the new category
\addtocategory{noindex}{book}% add the key `book` to that category


\DeclareCiteCommand{\footfullcite}[\mkbibfootnote]
  {\usebibmacro{prenote}}
  {\ifcategory{noindex}{}{\usebibmacro{citeindex}}% only if not in noindex
   \usedriver
     {\DeclareNameAlias{sortname}{default}}
     {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareIndexNameFormat{default}{%
\nameparts{#1}%
\usebibmacro{index:name}%
{\index[perso]}%
{\namepartfamily}%
{\namepartgiveni}%
% {}% L1
% {}% L2
{\namepartprefix}% generates spurious space L3
{\namepartsuffix}% generates spurious space L4
}

\begin{document}
\footfullcite{book}\newpage
\footfullcite{book}\newpage
\footfullcite{article}\newpage
\footfullcite{article}\newpage
\footfullcite{article}
\printbibliography
\printindex[perso]
\end{document}

To remove the key entirely from the index, you could insert the \ifcategory check in the \DeclareIndexNameFormat-definition:

\DeclareIndexNameFormat{default}{%
\ifcategory{noindex}{}{
\nameparts{#1}%
\usebibmacro{index:name}%
{\index[perso]}%
{\namepartfamily}%
{\namepartgiveni}%
% {}% L1
% {}% L2
{\namepartprefix}% generates spurious space L3
{\namepartsuffix}% generates spurious space L4
}}

You could do the same based on the bib file and not inside of the tex-file by introducing a keyword if you like that approach more. The contents of the \jobname.bib file become:

\begin{filecontents}{\jobname.bib}
@ARTICLE{article,
  author = {Nachname, Vorname},
  title = {Titel des Zeitschriftenartikels},
  journal = {Zeitschrift},
  year = {2006},
  volume = {6},
  pages = {19--75},
}
@BOOK{book,
  author = {Buchautor, Hans-Wilhelm},
  title = {Irgendein Buch},
  address = {Buch am Wald},
  year = {2000},
  keywords = {noindex}
}
\end{filecontents}

Just change the check \ifcategory to \ifkeyword the rest remains untouched.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .