使用 ClassicThesis 和 BibLaTeX 在参考书目中为名称加下划线

使用 ClassicThesis 和 BibLaTeX 在参考书目中为名称加下划线

我需要使用 ClassicThesis 和 BibLaTeX 在参考书目中为所有人名添加下划线。我更愿意只更改 tex 文件(而不是 bib 或 bst)。到目前为止,我尝试过方法均未成功。这些方法的代码以注释形式报告于下面的 MWE 中。

采用第一种方法时我没有发现下划线:

第一次尝试

采用第二种方法,作者列表被删除:

第二次尝试

我当前的设置:

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2017.8.23)
Package: biblatex 2016/03/03 v3.3 programmable bibliographies (PK/JW/AB)
Package: classicthesis 2015/09/06 v4.2 Typographic style for a classic-looking 

梅威瑟:

\documentclass{scrbook}

\usepackage{classicthesis}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{one,
    author = {Smith, Robert and Garcia, Maria and Johnson, James},
    title = {{Title One}},
    journal = {Journal One},
    year = {2017}
}
@InProceedings{two,
    author = {Garcia, Maria and Smith, Robert and Johnson, James},
    title  = {{Title Two}},
    booktitle = {Conference Two},
    year = {2016}
}
\end{filecontents}

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

\usepackage[normalem]{ulem} %for \uline{}

\newcommand{\myLastName}{Smith}

%% solution by Andrzej, https://tex.stackexchange.com/a/31202
% \renewbibmacro*{name:first-last}[4]{%
%   \usebibmacro{name:delim}{#2#3#1}%
%   \usebibmacro{name:hook}{#2#3#1}%
%   \ifthenelse{\equal{#1}{\myLastName}}% matches last name against YourLastName
%     {
%       \uline{% wrapped with \uline
%       \ifblank{#2}{}{\mkbibnamefirst{#2}\isdot\bibnamedelimd}%
%       \ifblank{#3}{}{%
%         \mkbibnameprefix{#3}\isdot%
%         \ifpunctmark{'}%
%           {}%
%           {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
%       \mkbibnamelast{#1}\isdot%
%       \ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}}}%
%     {% original
%       \ifblank{#2}{}{\mkbibnamefirst{#2}\isdot\bibnamedelimd}%
%       \ifblank{#3}{}{%
%         \mkbibnameprefix{#3}\isdot%
%         \ifpunctmark{'}%
%           {}%
%           {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
%       \mkbibnamelast{#1}\isdot%
%       \ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}}}

%% solution by dardisco, https://tex.stackexchange.com/a/394458
% \DeclareNameFormat{given-family}{
%   \ifgiveninits
%   {\ifthenelse{\equal{\namepartfamily}{\myLastName}}
%     {\uline{\namepartfamily\addspace\namepartgiveni\namepartsuffix}}
%     {\namepartfamily\addspace\namepartgiveni\namepartsuffix}
%     \ifthenelse{\value{listcount} < \value{liststop}}
%     {\addcomma}
%     {\ifthenelse{\ifmorenames}{~et \,al \adddot}}
%     {}
%   }
% }

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

有什么建议吗?

答案1

建立在Audrey 的回答:使用 biblatex 将特定作者设为粗体我们可以得出以下结论。

\documentclass{article}
\usepackage[backend=biber,maxbibnames=99,defernumbers=true,sorting=ydnt,giveninits=true]{biblatex}

\begin{filecontents}{\jobname.bib}
@InProceedings{identifier1,
  Title                    = {Some Awesome Title},
  Author                   = {Some Author and Another Author},
  Booktitle                = {Some Book about the Future},
  Year                     = {2042},
  Pages                    = {1--42}
}

@InProceedings{identifier2,
  Title                    = {Some So-So Title},
  Author                   = {First Author and Second Author},
  Booktitle                = {An okay Booktitle},
  Year                     = {2000},
  Pages                    = {1--100}
}

  @Book{test1,
  author          = {Goossens, Michel and Mittelbach, Frank
    and Samarin, Alexander},
  title           = {The LaTeX Companion},
  publisher       = {Addison-Wesley},
  location        = {Reading, Mass.},
  year            = {1994},

}

@Book{test2,
  author          = {Mittelbach, F. and Goossens, Michel
    and Samarin, Alexander},
  title           = {The LaTeX Companion},
  publisher       = {Addison-Wesley},
  location        = {Reading, Mass.},
  year            = {1994},

}

@Book{test3,
  author          = {Mittelbach, Frank and Samarin, Alexander
    and Goossens, Michel},
  title           = {The LaTeX Companion},
  publisher       = {Addison-Wesley},
  location        = {Reading, Mass.},
  year            = {1994},
} 
\end{filecontents}
\addbibresource{\jobname.bib}

\def\makenamesetup{%
  \def\bibnamedelima{~}%
  \def\bibnamedelimb{ }%
  \def\bibnamedelimc{ }%
  \def\bibnamedelimd{ }%
  \def\bibnamedelimi{ }%
  \def\bibinitperiod{.}%
  \def\bibinitdelim{~}%
  \def\bibinithyphendelim{.-}}    
\newcommand*{\makename}[2]{\begingroup\makenamesetup\xdef#1{#2}\endgroup}

\newcommand*{\boldname}[3]{%
  \def\lastname{#1}%
  \def\firstname{#2}%
  \def\firstinit{#3}}
\boldname{}{}{}

\boldname{Author}{Some}{S.}

\usepackage[normalem]{ulem}

\makeatletter
\newcommand{\namehighighter}[1]{%
  \ifboolexpr{(test {\ifdefequal{\firstname}{\namepartgiven}}
               or test {\ifdefequal{\firstinit}{\namepartgiven}})
              and test {\ifdefequal{\lastname}{\namepartfamily}}}
    {\uline{#1}}
    {#1}}

\renewbibmacro*{name:given-family}[4]{%
  \usebibmacro{name:delim}{#2#3#1}%
  \usebibmacro{name:hook}{#2#3#1}%
  \namehighighter{%
  \ifdefvoid{#2}{}{\mkbibnamegiven{#2}\isdot\bibnamedelimd}%
  \ifdefvoid{#3}{}{%
    \mkbibnameprefix{#3}\isdot
    \ifprefchar
      {}
      {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}%
  \mkbibnamefamily{#1}\isdot
  \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}}
\makeatother

\begin{document}

\nocite{*}
\printbibliography

\boldname{Goossens}{Michel}{M.}
\printbibliography

\boldname{Mittelbach}{Frank}{F.}
\printbibliography

\end{document}

在此处输入图片描述

请注意,我们并没有修补name:given-family,而是重新定义了它。这是因为我们需要与使用\bfseries开关加粗文本时略有不同的分组设置。

相关内容