Biblatex:(1)更改末尾句点的颜色(2)为什么日期排序不起作用?

Biblatex:(1)更改末尾句点的颜色(2)为什么日期排序不起作用?

下列的这个问题前几天,我终于想出了一个 MWE,它可以满足我的 95% 的需求,但我仍然有 2 个小问题:

(1) - 我想更改每个杂项条目末尾自动插入的最后一个句号的颜色。我看到最后一部分用红色打印,但句号仍然显示为黑色(文本颜色)。

(2) - 由于某些原因,日期排序似乎不起作用,我不知道我是否做错了什么……“研究中心”的演讲是在 2014 年 9 月 25 日,因此应该列在 2014 年 9 月 12 日“又一所大学”的演讲之上。

数字

有什么线索吗?

这是 MWE:

\documentclass{article}

\usepackage{amssymb} \usepackage{lipsum}

%%%%%%%%%%
% Colors %
%%%%%%%%%%
\usepackage{xcolor}
\colorlet{textcolor}{black}

%%%%%%%%%
% Fonts %
%%%%%%%%%
\usepackage[quiet]{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{Arial}

\usepackage{fontawesome}
\newfontfamily{\FA}{FontAwesome}

%%%%%%%%%%%%
% Geometry %
%%%%%%%%%%%%
\setlength{\parindent}{0pt}% No paragraph indentation
\setlength{\parskip}{.5\baselineskip plus 0.1\baselineskip minus 0.1\baselineskip}
\usepackage[margin=2cm]{geometry}

%%%%%%%%%%%%%%%%
% Bibliography %
%%%%%%%%%%%%%%%%
\begin{filecontents}{\jobname.bib}
    @article{Doe2011,
        author = {Doe, John},
        journal = {Nucleic Acids Research},
        pages = {1--3},
        title = {{Title of paper}},
        volume = {39},
        year = {2011}
    }
    @article{Smith2013,
        author = {Smith, Josh},
        journal = {Nature},
        pages = {1--6},
        title = {{Overly complicated title}},
        volume = {85},
        year = {2013}
    }
    @article{Adams2016,
        author = {Adams, Brian},
        journal = {Science},
        pages = {10--15},
        title = {{Another absurd title}},
        volume = {2},
        year = {2016}
    }
    @phdthesis{Surname2012,
        author = {Surname, Name},
        location = {Some University},
        title = {{Some suitable thesis name}},
        type = {PhD Thesis},
        url = {http://thesis},
        year = {2012}
    }
    @misc{Willis2013,
        location = {Some Uni},
        note = {Work In Progress report},
        author = {Willis, William},
        title = {{This is the same title always}},
        type = {TALK},
        month = {07},
        year = {2013}
    }
    @misc{Willis2014,
        location = {Another Uni},
        note = {Poster Symposium},
        author = {Willis, William},
        title = {{This is the same title always}},
        type = {POSTER},
        month = {03},
        year = {2014}
    }
    @misc{Willis2014b,
        location = {Yet Another Uni},
        author = {Willis, William},
        title = {{This is the same title always}},
        type = {TALK},
        day = {12}, %I include the day in entries in the same month and year
        month = {09},
        year = {2014}
    }
    @misc{Willis2014c,
        location = {Research Center},
        author = {Willis, William},
        title = {{This is the same title always}},
        type = {TALK},
        day = {25}, %I include the day in entries in the same month and year
        month = {09},
        year = {2014}
    }
    @misc{Willis2016,
        location = {Another Research Center},
        author = {Willis, William},
        title = {{New title}},
        type = {TALK},
        month = {09},
        year = {2016}
    }
\end{filecontents}




\usepackage[style=verbose, defernumbers=true, sorting=ymdnt, backend=biber, dateabbrev=true, maxbibnames=7, minbibnames=7]{biblatex}%

\addbibresource{\jobname.bib}

\DeclareNameAlias{author}{first-last}

%%SORTING

\DeclareSortingScheme{ymdnt}{
    \sort{
        \field{presort}
    }
    \sort[final]{
        \field{sortkey}
    }
    \sort[direction=descending]{
        \field[strside=left,strwidth=4]{sortyear}
        \field[strside=left,strwidth=4]{year}
        \literal{9999}
    }
    \sort[direction=descending]{
        \field[padside=left,padwidth=2,padchar=0]{month}
        \literal{00}
    }
    \sort[direction=descending]{
        \field[padside=left,padwidth=2,padchar=0]{day}
        \literal{00}
    }
    \sort{
        \name{sortname}
        \name{author}
        \name{editor}
        \name{translator}
        \field{sorttitle}
        \field{title}
    }
    \sort{
        \field{sorttitle}
        \field{title}
    }
}

%%ARTICLE

\DeclareFieldFormat[article]{title}{#1\par}

\DeclareBibliographyDriver{article}{%
    \printfield{title}%
    \par\vspace{0.1\baselineskip}%
    \newblock%
    \printnames{author}%
    \par\vspace{0.1\baselineskip}%
    \newblock%
    {%
        \small \addfontfeature{Color=lightgray} \itshape%
        \usebibmacro{journal+issuetitle}%
        \setunit{\space}%
        \printfield{pages}%
        \newunit%
        \printfield{url}%
    }
    \par\vspace{0.1\baselineskip}%
}

%%THESIS

\DeclareFieldFormat[thesis]{title}{#1\par}

\DeclareBibliographyDriver{thesis}{%
    \printfield{title}%
    \par\vspace{0.1\baselineskip}%
    \newblock%
    \printnames{author}%
    \par\vspace{0.1\baselineskip}%
    \newblock%
    {%
        \small \addfontfeature{Color=lightgray} \itshape%
        \printfield{type}%
        \setunit{\addperiod\space}%
        \usebibmacro{institution+location+date}%
        \setunit{\addperiod\space}%
        \printfield{pages}%
        \newunit%
        \printfield{url}%
    }
    \par\vspace{0.1\baselineskip}
}

%%MISCELLANEA

\DeclareFieldFormat[misc]{title}{#1\\}

\newbibmacro*{bib:svtitle}{%
    \savefield{title}{\lasttitle}}

\newbibmacro*{bib:svauthor}{%
    \savename{author}{\lastauthor}}

\newbibmacro*{verifytitle}{%
    \iffieldequals{title}{\lasttitle}{\hspace{\bibhang}}{%
        \printfield{title}%
        \undef\lastauthor}%
    \usebibmacro{bib:svtitle}%
}

\renewbibmacro*{finentry}{\adddot\finentry}

\newbibmacro*{verifyauthor}{%
    \ifnameequals{author}{\lastauthor}
    {}
    {\printnames{author}\\}%
    \usebibmacro{bib:svauthor}}

\newbibmacro*{newtitle}{%
    \usebibmacro{verifytitle}}

\newbibmacro*{newauthor}{%
    \usebibmacro{verifyauthor}}

\DeclareBibliographyDriver{misc}{%
    \usebibmacro{newtitle}%
    \usebibmacro{newauthor}%
    {%
        \scriptsize \textcolor{red}{\faCaretRight}%
    }
    {%
        \footnotesize \addfontfeature{Color=red} \itshape%
        \hspace{5px}%
        \printfield{type} (\printfield{month} \printfield{year})%
        \setunit{\addperiod\space}%
        \printfield{note}%
        \setunit*{\addcomma\space}%
        \printlist{location}%
    }
    \usebibmacro{finentry}%
}

\newcommand{\printbibsection}[1]{
    \begin{refsection}
        \nocite{*}
        \printbibliography[type={#1}, heading=none]
    \end{refsection}
}





\begin{document}

    \lipsum[1]

    \medskip

    \section{Articles}
    \printbibsection{article}

    \section{Thesis}
    \printbibsection{thesis}

    \section{Miscellanea}
    \printbibsection{misc}

\end{document} 

答案1

该点是黑色的,因为\usebibmacro{finenty}(打印最后一个点)位于改变颜色的组之外。

没有日期字段,请在您的 bib 中使用 date={2014-09-25}。您还可以使用 设置年份date={2014},使用 设置月份date={2014-09}

相关内容