3

Consider the following MWE:

%!TEX TS-program = xelatex
\documentclass[ngerman]{article}
\usepackage{babel,libertine}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@Article{Alfoeldy2003,
  author       = {Géza Alföldy},
  title        = {Nuevos monumentos epigraficos del foro de Segobriga},
  journaltitle = {ZPE},
  pages        = {217--234},
  year         = {2003},
}
@Article{Baumgart1935,
  author              = {Baumgart, Fritz},
  title               = {Platz und Stadt},
  journaltitle        = {ZKuGesch},
  pages               = {17--35},
  year                = {1935},
}
@Article{Allison2001,
  author       = {Allison, Penelope M.},
  title        = {Using the Material and Written Sources},
  journaltitle = {AJA},
  pages        = {181--208},
  year         = {2001},
}
@Article{Andreae1957,
  author       = {Andreae, Bernard},
  title        = {Archäologische Funde und Grabungen},
  journaltitle = {AA},
  pages        = {110--358},
  year         = {1957},
}
@Review{Frost2001,
  author       = {Frank Frost},
  pages        = {442--443},
  journaltitle = {ClR},
  year         = {2001},
}
@Article{Krause1976,
  author       = {Krause, Clemens},
  title        = {Zur baulichen Gestalt des republikanischen Comitiums},
  journaltitle = {RM},
  pages        = {31--69},
  year         = {1976},
}
@Book{Graefe1979,
  author     = {Graefe, Rainer},
  title      = {\emph{Vela erunt}},
  year       = {1979},
}
\end{filecontents*}

\begin{filecontents*}{index_style.ist}
headings_flag 1
heading_prefix "{\\large\\sffamily\\bfseries "
heading_suffix "}\\nopagebreak\n"
item_0 "\n \\item \\sffamily "
delim_0 " \\dotfill "
delim_1 " \\dotfill "
delim_2 " \\dotfill "
\end{filecontents*}

\usepackage[ 
  backend=biber,
  indexing=cite,
  style=archaeologie,
    initials,%<<-- trouble maker
]{biblatex}
\addbibresource{\jobname.bib}

\usepackage{imakeidx}
\makeindex[
        intoc,
        title= Index Autoren Sekundärliteratur,
        columns=2,
        options={-s index_style.ist},
        ]
\begin{document}
\cite{Allison2001,Baumgart1935,Alfoeldy2003,Andreae1957,Frost2001,Krause1976,Graefe1979}
\clearpage
\cite{Baumgart1935,Alfoeldy2003,Frost2001,Krause1976,Graefe1979}
\textcite{Andreae1957}
\clearpage
\cite{Allison2001,Alfoeldy2003,Andreae1957,Krause1976,Graefe1979}
\clearpage
\citeauthor{Krause1976}
\citeauthor{Frost2001}
\printindex
\printbibliography
\end{document}

Result is this: index and bibliography

The index got mixed up a bit, since some author's names are recognized as ›Symbols‹ since the biblatex archaeologie-option initials activates the possibility to get the author’s initials automatically as described by @ienissei in https://tex.stackexchange.com/a/295486/98739.

@moewe found out that it is because also the family names are considered:

\indexentry{{Fr}ost, {\relax {}Fr}ank|hyperpage}{1}
\indexentry{{Kr}ause, {\relax {}Cl}emens|hyperpage}{1}
\indexentry{{Gr}aefe, Rainer|hyperpage}{1}

Is there a solution that only the first names will be considered? Or how can I omit the {} in the family name?

lukascbossert
  • 3,015
  • 1
  • 16
  • 37
  • Assuming that “Frank Frost” should be abbreviated as “Fr. Frost” (which I doubt), it's really disconcerting that the same is applied to family names. – egreg Sep 23 '16 at 14:25
  • There are several options here. The regex used in that piece of code works with the standard \makeindex. There may be a conflict with imakeidx. Another option would be to improve the regex (which, as I said, I am copying from elsewhere, as I am no expert in that field) and make it more selective, i.e. able to modify first names only. For this, we need to take into account the fact that a bibtex name has four components (von part, last name, first name, suffix) and can be written with or without a comma (and there may be several names, too). – ienissei Sep 23 '16 at 16:57
  • @ienissei I tried, but I get \indexentry{{Fr}ost, {\relax {}Fr}ank}{1} anyway, so the problem is in how the index entry is written; it doesn't depend on imakeidx. It is not surprising, as in the .bbl file we find family={Fr}ost. This is decidedly a bug. – egreg Sep 23 '16 at 17:55
  • so a / or the best solution so far is, go to the .bbl and delete the wrong {} and compile again. – lukascbossert Sep 23 '16 at 23:06

1 Answers1

1

A tentative solution, assuming you are using the <von> <last>, <suffix>, <first> name format:

\DeclareStyleSourcemap{%
  \maps[datatype=bibtex]{%
    \map{%
      \step[fieldsource=author,%
        match={\regexp{([^,]\s)(Chr|Ch|Th|Ph|[B-DF-HJ-NP-TV-XZ](l|r))}},%
        replace={\regexp{$1\{$2\}}}]% Protect last names (last, first)
      \step[fieldsource=author,%
        match={\regexp{([^\{])(Chr|Ch|Th|Ph|[B-DF-HJ-NP-TV-XZ](l|r))([^\}])}},%
        replace={\regexp{$1\{\\relax\{\}$2\}$4}}]% Insert \relax after abbreviating
}}}%

It hopefully works if you add it to the preamble (haven't tested it with imakeidx. At least it improves the code in the .bbx which now reads:

... {Krause}{K\bibinitperiod}{{\relax{}Cl}emens}{{\relax{}Cl}\bibinitperiod} ...

But, I have no idea how to make this work with the <first> <last> name format, which isn't very popular anyway (I guess).

ienissei
  • 6,223
  • thanks. it works, but not for Frost, Frank --> \indexentry{{\relax {}Fr}rst, Frank}{1} somehow the o gets eaten and the code is not applied at Fr. – lukascbossert Sep 23 '16 at 17:35
  • 1
    FATAL - Caught signal: SEGV Likely your .bib has a very bad entry which causes libbtparse to crash: Inappropriate ioctl for device – lukascbossert Sep 23 '16 at 17:48
  • Sorry about the crash. Could you try the latest version? – ienissei Sep 23 '16 at 18:20
  • @LukasCB Please note that I mentioned in my solution provided you are using the last, first name format… which is not the case in the Frost entry… that's why it doesn't work. – ienissei Sep 23 '16 at 18:50
  • you are right, it works when field author is in last, first-order, I can work with that. But, as soon there is a second author, whose last name starts with e.g. Chr|Ch|Th|Ph| it is the same problem as before. So, it works for one author but not for more – lukascbossert Sep 23 '16 at 23:02
  • 2
    Will look into it, but it may be faster to ask a regex expert (in one of the other stack exchange communities). The problem is how to select the letters we want, only in first names, including when there are several authors. – ienissei Sep 24 '16 at 09:22