0

I am attempting to create three indexes for a document (subject, author and title) but the author and subject indexes are being loaded into the incorrect sections. I have tried changing \DeclareIndexNameFormat{default} to DeclareIndexFieldFormat{default} and modifying {default} to other strings like indexname but to no avail. Loading splitindex with \usepackage[xindy]{imakeidx} causes TexWorks to crash too so not sure if that is relevant or needed in this case.

%! MWE Example
% arara: lualatex
% arara: biber
% arara: lualatex
% arara: xindy: {modules: [texindy], codepage: utf8, language: english}
% arara: lualatex: {shell: yes}
% arara: lualatex
\documentclass[oneside]{memoir}
\usepackage[backend=biber,      
        hyperref=true,          
        indexing=true,                  
        natbib=true,        
        ]{biblatex}
\usepackage[xindy]{imakeidx}
\usepackage{hyperref}

\begin{filecontents}{\jobname.bib}
@article{Che20,
author = {Chen, Keqiang and Wang, Cong and Peng, Zhuoyin and Qi, Kun and Guo, Zhinan and Zhang, Yupeng and Zhang, Han},
title = {{The chemistry of colloidal semiconductor nanocrystals: From metal-chalcogenides to emerging perovskite}},
year = {2020}
}
@article{Hak20,
author = {Hakkoymaz, Orhun and Mazi, Hidayet},
title = {{An immobilized invertase enzyme for the selective determination of sucrose in fruit juices}},
year = {2020}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\makeindex[intoc=true,
            program=xindy,
            title={Subject Index}]       
\makeindex[intoc=true,
             title={Author Index},
             program=xindy,
             name=names]
                    
{\DeclareIndexNameFormat{default}{%
   \usebibmacro{index:name}{\index[names]}
     {\namepartfamily}
     {\namepartgiven}
     {\namepartprefix}
     {\namepartsuffix}}}
     
\makeindex[intoc=true,          
             title={Title Index},
             program=xindy,
             name=titles]   
             
\DeclareIndexFieldFormat{indextitle}{%
  \usebibmacro{index:title}{\index[titles]}{#1}}%

\begin{document}
\cite{Che20, Hak20}
\printindex
\printindex[titles]
\printindex[names]
\end{document}  

The subject index (the default index with no name= attached) is loading the authors:

Subject index with author names

Whereas the author index is loading nothing even though I have called them in the correct order at the end of my MWE:

Blank author index

I want to use xindy as I like its formatting but it is causing me grief and I do not know if I am even calling it with arara correctly either, any help would be appreciated.

2

There is an excess pair of curly braces around the \DeclareIndexNameFormat{default}. This pair of braces keeps the definition local, which means that it is immediately discarded. So the name indexing does not use your new names index.

Remove the curly braces around \DeclareIndexNameFormat{default}.

%! MWE Example
% arara: lualatex
% arara: biber
% arara: lualatex
% arara: xindy: {modules: [texindy], codepage: utf8, language: english}
% arara: lualatex: {shell: yes}
% arara: lualatex
\documentclass[oneside]{memoir}
\usepackage[backend=biber,
        indexing=true,
        natbib=true,
        ]{biblatex}
\usepackage[xindy]{imakeidx}
\usepackage{hyperref}


\makeindex[intoc=true,
           program=xindy,
           title={Subject Index}]
\makeindex[intoc=true,
           title={Author Index},
           program=xindy,
           name=names]

\DeclareIndexNameFormat{default}{%
  \usebibmacro{index:name}{\index[names]}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}}

\makeindex[intoc=true,
             title={Title Index},
             program=xindy,
             name=titles]

\DeclareIndexFieldFormat{indextitle}{%
  \usebibmacro{index:title}{\index[titles]}{#1}}%

\addbibresource{biblatex-examples.bib}
\begin{document}
\cite{sigfridsson, worman,geer}
\printindex
\printindex[titles]
\printindex[names]
\end{document}

Correct author index

2
  • I compiled the file with latexmk, which runs all required tools automatically. For the required arara invocations tex.stackexchange.com/a/584633/35864 might be useful, but I'm probably the wrong person to ask about indexing with arara.
    – moewe
    Jul 11 at 8:13
  • it compiled correctly with arara, thank you for explaining that the extra braces kept it local, now I know to check for that in the future if issues occur. Jul 11 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.