Cambie "et al" en la bibliografía en caso de que contenga un autor específico allí.

Cambie "et al" en la bibliografía en caso de que contenga un autor específico allí.

Estoy intentando cambiar el et~al. que aparece en la bibliografía en el caso de que dentro de los autores extra (et~al) haya un autor que estoy intentando poner en negrita en la bibliografía usando la respuesta de @LawrenceCrosbyaquí

Mi código es:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{MyBibliography.bib}
  @article{cite1,
    author={Konstantinos Leledakis},
    title={An Article},
    year={2019},
    journal={Some Journal}
  }
  @article{cite2,
    author={Another Author and Konstantinos Leledakis},
    title={A Book},
    year={2017},
    journal={A publisher}
  }
  @book{cite3,
    author={Another SomeAuthor and One AnotherAuthor and SomeOther UnKnownAuthor and Konstantinos Leledakis},
    title={A Book},
    year={1988},
    publisher={Someone}
    }
  @book{cite4,
    author={Another Author and An UnknownAuthor and SomeOther UnKnownAuthor},
    title={A Book},
    year={2015},
    publisher={A publisher}
  }
\end{filecontents}

\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear-comp,maxnames=2, minnames=2]{biblatex}
\usepackage{etoolbox}


\DefineBibliographyStrings{english}{andothers={\ifthenelse{\boolean{bold}}{et~al(including Leledakis, K.)}{et~al}\adddot}}


\newboolean{bold}
\newcommand{\makeauthorbold}[1]{%
  \setboolean{bold}{false}
  \DeclareNameFormat{author}{%
    \ifthenelse{\value{listcount}=1}
    {%
      {\expandafter\ifstrequal\expandafter{\namepartfamily}{#1}{\setboolean{bold}{true}\mkbibbold{\namepartfamily\addcomma\addspace \namepartgiveni}}{\namepartfamily\addcomma\addspace \namepartgiveni}}
      %
    }{\ifnumless{\value{listcount}}{\value{liststop}}
        {\expandafter\ifstrequal\expandafter{\namepartfamily}{#1}{\setboolean{bold}{true}\mkbibbold{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni}}{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni}}
        {\expandafter\ifstrequal\expandafter{\namepartfamily}{#1}{\setboolean{bold}{true}\mkbibbold{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni\addcomma\isdot}}{\addcomma\addspace \namepartfamily\addcomma\addspace \namepartgiveni\addcomma\isdot}}%
      }
    \ifthenelse{\value{listcount}<\value{liststop}}
    {\addcomma\space}
  }
}

%\makeauthorbold{Leledakis}


\DefineBibliographyStrings{english}{andothers={et~al}} % To translate "et al."

\ExecuteBibliographyOptions{firstinits=true, uniquename=init}

\addbibresource{MyBibliography.bib}
\renewcommand*{\nameyeardelim}{\addcomma\addspace} % Should add the comma, but somehow doesn't work

\begin{document}
\nocite{*}

\printbibliography
\end{document}

Esto tiene dos problemas:

  1. Si comento (me refiero a habilitar) el comando comentado %\makeauthorbold{Leledakis}y lo habilito. El resultado de:

ingrese la descripción de la imagen aquí

(que contiene algunos et~al).se convierte en:

ingrese la descripción de la imagen aquí

Donde el nombre ya está resaltado pero el et~al. Falta alguna parte.

PD: También probé el código sin mis cambios, pero todavía falta el et. Alabama. parte.

Respuesta1

Se \DeclareNameFormat{author}trata de una modificación del formato del nombre original que deja algunas cosas que desear.

  1. No puede lidiar con partes "von" y "Jr." partes.
  2. No puede tratar con "et al." porque le falta una llamada al estándar \usebibmacro{name:andothers}.
  3. En una biblatexversión moderna, incluso producirá un error debido a un error de sintaxis. (Al último \ifthenelsele falta unFALSOrama. Ver tambiénhttps://github.com/plk/biblatex/issues/874.)

Le sugiero que utilice una de las versiones más sólidas para poner su nombre en negrita sugerida enPoner en negrita un autor específico usando biblatex. Hasta donde puedo ver, ninguna de las soluciones pone en negrita "et al." si "contiene" el nombre relevante listo para usar, pero podemos agregarlo.

Como base estoy usandomi respuestaque utiliza hashes, pero permite una interfaz conveniente para recuperarlos. Lo complicado es comprobar si "et al." También contiene un nombre para resaltar. Hacemos esto recorriendo todos los nombres restantes en un archivo \indexnamesque de otro modo no imprime nada.

\documentclass{article}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear-comp,
            maxnames=2, minnames=2,
            giveninits=true, uniquename=init]{biblatex}

\makeatletter
% setup for auxiliary bib file
\def\hlblx@bibfile@name{\jobname -boldnames.bib}
\newwrite\hlblx@bibfile
\immediate\openout\hlblx@bibfile=\hlblx@bibfile@name

\newcounter{hlblx@name}
\setcounter{hlblx@name}{0}

% write names to auxiliary bib file and push hash to bold list
\newcommand*{\hlblx@writenametobib}[1]{%
  \stepcounter{hlblx@name}%
  \edef\hlblx@tmp@nocite{%
    \noexpand\AfterPreamble{%
      \noexpand\setbox0\noexpand\vbox{%
        \noexpand\hlblx@getmethehash{hlblx@name@\the\value{hlblx@name}}}}%
  }%
  \hlblx@tmp@nocite
  \immediate\write\hlblx@bibfile{%
    @misc{hlblx@name@\the\value{hlblx@name}, author = {\unexpanded{#1}}, %
          options = {dataonly=true},}%
  }%
}

\AtEndDocument{%
  \closeout\hlblx@bibfile}

\addbibresource{\hlblx@bibfile@name}

% extract hashes from bib file
\newcommand*{\hlbxl@boldhashes}{}
\DeclareNameFormat{hlblx@hashextract}{%
  \xifinlist{\thefield{hash}}{\hlbxl@boldhashes}
    {}
    {\listxadd{\hlbxl@boldhashes}{\thefield{fullhash}}}}

\DeclareCiteCommand{\hlblx@getmethehash}
  {}
  {\printnames[hlblx@hashextract][1-999]{author}}
  {}
  {}

% add and reset list of bold names
\newcommand*{\addboldnames}{\forcsvlist\hlblx@writenametobib}
\newcommand*{\resetboldnames}{\def\hlbxl@boldhashes{}}

\newcommand*{\mkboldifhashinlist}[1]{%
  \xifinlist{\thefield{hash}}{\hlbxl@boldhashes}
    {\mkbibbold{#1}}
    {#1}}

\newtoggle{boldnameincluded}
\newbibmacro*{name:flagbold}{%
  \def\do##1{\iffieldequalstr{hash}{##1}{\global\toggletrue{boldnameincluded}\listbreak}{}}%
  \dolistloop{\hlbxl@boldhashes}%
}

\DeclareNameWrapperFormat{boldifhashinlist}{%
  \renewcommand*{\mkbibcompletename}{\mkboldifhashinlist}%
  #1}

\DeclareNameWrapperAlias{sortname}{default}
\DeclareNameWrapperAlias{default}{boldifhashinlist}

\DeclareIndexNameFormat{flagbold}{%
  \usebibmacro{name:flagbold}}

\newcounter{boldflagcount}
\newcommand*{\mkbibboldandothers}[2]{%
  \iftoggle{boldnameincluded}
    {\mkbibbold{#2#1}}
    {#2}}

\renewbibmacro*{name:andothers}{%
  \ifboolexpr{
    test {\ifnumequal{\value{listcount}}{\value{liststop}}}
    and
    test \ifmorenames
  }
    {\ifnumgreater{\value{liststop}}{1}
       {\finalandcomma}
       {}%
     \global\togglefalse{boldnameincluded}%
     \ifnumgreater{\value{listtotal}}{\value{listcount}}
       {\defcounter{boldflagcount}{\value{listcount}+1}%
        \expandafter\def\expandafter\hlblx@currname\expandafter{\currentname}%
        \indexnames[flagbold][\the\value{boldflagcount}-\the\value{listtotal}]{\hlblx@currname}}%
       {}%
     \printdelim{andothersdelim}%
     \bibstring[\mkbibboldandothers{ (incuding K.~Leledakis)}]{andothers}}
    {}}
\makeatother


\addboldnames{Konstantinos Leledakis}


\begin{filecontents}{\jobname.bib}
@article{cite1,
  author  = {Konstantinos Leledakis},
  title   = {An Article},
  year    = {2019},
  journal = {Some Journal},
}
@article{cite2,
  author  = {Another Author and Konstantinos Leledakis},
  title   = {A Book},
  year    = {2017},
  journal = {A publisher},
}
@book{cite3,
  author    = {Another SomeAuthor and One AnotherAuthor
               and SomeOther UnKnownAuthor and Konstantinos Leledakis},
  title     = {A Book},
  year      = {1988},
  publisher = {Someone},
}
@book{cite4,
  author    = {Another Author and An UnknownAuthor
               and SomeOther UnKnownAuthor},
  title     = {A Book},
  year      = {2015},
  publisher = {A publisher},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

Autor, A. y **K. Leledakis** (2017). "Un libro". En: Un editor.//Autor, A., A. Autor desconocido, et al. (2015). Un libro. Un editor.//**Leledakis, K.** (2019). "Un artículo". En: Some Journal.//SomeAuthor, A., O. AnotherAuthor, **et al. (incluido K. Leledakis)** (1988). Un libro. Alguien.

Si está buscando formatear una lista de publicaciones para su CV, puede echarle un vistazo abiblatex-publist.

editadoutilizar una versión más elegante para formatear nombres completos. \DeclareNameWrapperFormaty \mkbibcompletenamesolo están disponibles en biblatexv3.12 (2018-10-30) y v3.13 (2019-08-17), respectivamente. Consulte el historial de ediciones si está utilizando una versión anterior de biblatex.

información relacionada