如何对所有带有大写字母的 biblatex (style=alpha) 参考文献使用小型大写字母?

如何对所有带有大写字母的 biblatex (style=alpha) 参考文献使用小型大写字母?

是否可以对所有由大写字母组成的 biblatex (style=alpha) 参考文献使用小型大写字母?

以下 MWE 应该阐明这一目标:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{hammond,
    author       = {Hammond, Christopher},
    title        = {The basics of crystallography and diffraction},
    date         = 1997,
    publisher    = {International Union of Crystallography and Oxford 
                    University Press},
    location     = {Oxford},
    langid       = {english},
    langidopts   = {variant=british},
    sorttitle    = {Basics of crystallography and diffraction},
    indextitle   = {Basics of crystallography and diffraction, The},
    shorttitle   = {Crystallography and diffraction},
    annotation   = {A \texttt{book} entry. Note the \texttt{sorttitle} and
                    \texttt{indextitle} fields as well as the format of the
                    \texttt{publisher} field},
}

@article{sarfraz,
    author       = {M. Sarfraz and M. F. A. Razzak},
    title        = {Technical section: {An} algorithm for automatic 
                    capturing of the font outlines},
    year         = 2002,
    volume       = 26,
    number       = 5,
    pages        = {795-804},
    issn         = {0097-8493},
    journal      = {Computers and Graphics},
    annotation   = {An \texttt{article} entry with an \texttt{issn} field},
}

@book{companion,
    author       = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
    title        = {The {LaTeX} Companion},
    date         = 1994,
    edition      = 1,
    publisher    = {Addison-Wesley},
    location     = {Reading, Mass.},
    pagetotal    = 528,
    langid       = {english},
    langidopts   = {variant=american},
    sorttitle    = {LaTeX Companion},
    indextitle   = {LaTeX Companion, The},
    shorttitle   = {LaTeX Companion},
    annotation   = {A book with three authors. Note the formatting of the 
        author list. By default, only the first name is reversed in the
        bibliography},
}

@article{murray,
    author       = {Hostetler, Michael J. and Wingate, Julia E. and Zhong,
    Chuan-Jian and Harris, Jay E. and Vachet, Richard W. and
    Clark, Michael R.  and Londono, J. David and Green, Stephen
    J. and Stokes, Jennifer J.  and Wignall, George D. and Glish,
    Gary L. and Porter, Marc D.  and Evans, Neal D. and Murray,
    Royce W.},
    title        = {Alkanethiolate gold cluster molecules with core
                    diameters from 1.5 to 5.2~{nm}},
    journaltitle = {Langmuir},
    date         = 1998,
    subtitle     = {Core and monolayer properties as a function of core 
                    size},
    volume       = 14,
    number       = 1,
    pages        = {17-30},
    langid       = {english},
    langidopts   = {variant=american},
    indextitle   = {Alkanethiolate gold cluster molecules},
    shorttitle   = {Alkanethiolate gold cluster molecules},
    annotation   = {An \texttt{article} entry with \arabic{author} authors. 
                    By default, long author and editor lists are 
                    automatically truncated. This is configurable},
}
\end{filecontents}

\usepackage[english]{babel}
\usepackage[style=alphabetic,sorting=none,backend=biber]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}

Single Author \cite{hammond} ($\leftarrow$ leave untouched)

Two Authors \cite{sarfraz} ($\leftarrow$ use small caps)

Three Authors \cite{companion} ($\leftarrow$ use small caps)

Many Authors \cite{murray} ($\leftarrow$ leave untouched)

\bigskip

Preferred output (at least within the text and optionally also within the bibliography list):
[Ham97], \textsc{[Sr02], [Gms94]}, [Hos+98]

\printbibliography

\end{document}

答案1

测试大写字母并不容易,但是如果正如您的示例暗示您想要针对两位和三位作者进行更改,您可以尝试这样做。

我没有测试如果有变音符号等会发生什么,以及是否\MakeSentenceCase可以处理它们。另外,我不认为这是一种好的风格,我觉得它很混乱。

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{hammond,
    author       = {Hammond, Christopher},
    title        = {The basics of crystallography and diffraction},
    date         = 1997,
    publisher    = {International Union of Crystallography and Oxford
                    University Press},
    location     = {Oxford},
    langid       = {english},
    langidopts   = {variant=british},
    sorttitle    = {Basics of crystallography and diffraction},
    indextitle   = {Basics of crystallography and diffraction, The},
    shorttitle   = {Crystallography and diffraction},
    annotation   = {A \texttt{book} entry. Note the \texttt{sorttitle} and
                    \texttt{indextitle} fields as well as the format of the
                    \texttt{publisher} field},
}

@article{sarfraz,
    author       = {M. Sarfraz and M. F. A. Razzak},
    title        = {Technical section: {An} algorithm for automatic
                    capturing of the font outlines},
    year         = 2002,
    volume       = 26,
    number       = 5,
    pages        = {795-804},
    issn         = {0097-8493},
    journal      = {Computers and Graphics},
    annotation   = {An \texttt{article} entry with an \texttt{issn} field},
}

@book{companion,
    author       = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
    title        = {The {LaTeX} Companion},
    date         = 1994,
    edition      = 1,
    publisher    = {Addison-Wesley},
    location     = {Reading, Mass.},
    pagetotal    = 528,
    langid       = {english},
    langidopts   = {variant=american},
    sorttitle    = {LaTeX Companion},
    indextitle   = {LaTeX Companion, The},
    shorttitle   = {LaTeX Companion},
    annotation   = {A book with three authors. Note the formatting of the
        author list. By default, only the first name is reversed in the
        bibliography},
}

@article{murray,
    author       = {Hostetler, Michael J. and Wingate, Julia E. and Zhong,
    Chuan-Jian and Harris, Jay E. and Vachet, Richard W. and
    Clark, Michael R.  and Londono, J. David and Green, Stephen
    J. and Stokes, Jennifer J.  and Wignall, George D. and Glish,
    Gary L. and Porter, Marc D.  and Evans, Neal D. and Murray,
    Royce W.},
    title        = {Alkanethiolate gold cluster molecules with core
                    diameters from 1.5 to 5.2~{nm}},
    journaltitle = {Langmuir},
    date         = 1998,
    subtitle     = {Core and monolayer properties as a function of core
                    size},
    volume       = 14,
    number       = 1,
    pages        = {17-30},
    langid       = {english},
    langidopts   = {variant=american},
    indextitle   = {Alkanethiolate gold cluster molecules},
    shorttitle   = {Alkanethiolate gold cluster molecules},
    annotation   = {An \texttt{article} entry with \arabic{author} authors.
                    By default, long author and editor lists are
                    automatically truncated. This is configurable},
}
\end{filecontents}

\usepackage[english]{babel}
\usepackage[style=alphabetic,sorting=none,backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{xcolor}
\DeclareFieldFormat{labelalpha}{%
  \ifboolexpr{
    test {\ifnumcomp{\value{\thefield{labelnamesource}}}{=}{2}}
    or
    test {\ifnumcomp{\value{\thefield{labelnamesource}}}{=}{3}}
  }
    {\textsc{\MakeSentenceCase{#1}}}
    {#1}%
}

\begin{document}

Single Author \cite{hammond} ($\leftarrow$ leave untouched)

Two Authors \cite{sarfraz} ($\leftarrow$ use small caps)

Three Authors \cite{companion} ($\leftarrow$ use small caps)

Many Authors \cite{murray} ($\leftarrow$ leave untouched)

\bigskip

Preferred output (at least within the text and optionally also within the bibliography list):
[Ham97], \textsc{[Sr02], [Gms94]}, [Hos+98]

\printbibliography

\end{document}

在此处输入图片描述

相关内容