引用:Biblatex / biber 方括号

引用:Biblatex / biber 方括号

我有一个问题至今无法解决。当我将该\textcite命令与页码结合使用时,年份被括在方括号中。我该如何删除它们?

\documentclass[
    a4paper,
    bibliography=totoc,
    toc=listof,
    chapterentrydots=on,
    captions=tableheading,
    headings=small,
]{scrbook}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[headsepline]{scrlayer-scrpage}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage[
    format=hang,
    skip=2.5pt,
    justification=RaggedRight,
    singlelinecheck=false,
    labelfont=bf,
]{caption}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{fp}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{etoolbox}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage[babel]{csquotes}
\usepackage[
    backend=biber,
    citetracker=true,
    autolang=other,
    style=authoryear,
    maxcitenames=2,
    maxbibnames=99,
    uniquename=false,
    uniquelist=true,
    isbn=false,
    doi=false
]{biblatex}
\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% --- Backslash Authors --- % \newcommand*{\citerevsdnamedelim}{}
\newcommand*{\citemultinamedelim}{\slash}
\newcommand*{\citefinalnamedelim}{\slash}
\AtBeginDocument{%
    \let\revsdnamedelim\citerevsdnamedelim
    \let\multinamedelim\citemultinamedelim%
    \let\finalnamedelim\citefinalnamedelim%
}

% --- Semikolon --- %
\renewcommand*{\multilistdelim}{\addsemicolon\space}
\renewcommand*{\finallistdelim}{\addsemicolon\space}


% --- () footnotes % --- () year footnotes
\DeclareFieldFormat{bibhyperrefparens}{\bibhyperref{\mkbibparens{#1}}}

% --- () year text \renewbibmacro*{cite:labelyear+extrayear}{% \iffieldundef{labelyear} {}% {\printtext[bibhyperrefparens]{%
\printfield[]{labelyear}% \printfield[]{extrayear}% }% }% }

% --- authors footnotes / small caps text --- %
\renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}

\AtBeginBibliography{%
\renewcommand*{\mkbibnamefamily}[1]{\textrm{#1}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibliography{Master}
\usepackage{filecontents}
\begin{filecontents*}{Master.bib}

@article{Beasley.2008,
    author = {Beasley, Mark and Pagach, Don and  Warr, Richard},
    year = {2008},
    title = {Information conveyed in hiring announcements of senior
             executives overseeing enterprise-wide risk management processes},
    pages = {311--332},
    pagination = {page},
    volume = {23},
    journaltitle = {Journal of Accounting, Auditing {\&} Finance},
    abstract = {},
    note = {}
}
\end{filecontents*}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\noindent Here I use the \textit{cite} command:
\cite[][311]{Beasley.2008} \\ Here the \textit{footcite} command: See
footnote\footcite[][311]{Beasley.2008} \\ And finally the
\textit{textcite} command:
\textcolor{red}{\textcite[][311]{Beasley.2008}}  \\ \noindent But it
should look like that: \textcolor{green}{\textsc{Beasley} et al.
(2008, p. 311)}

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

在此处输入图片描述

答案1

cite由于和textcitebibmacros都使用,因此cite:labelyear+extrayear您不应在那里插入括号。

一个简单的解决方案是定义一个带括号的新宏,并在cite

\DeclareFieldFormat{bibhyperrefparens}{\bibhyperref{\mkbibparens{#1}}}

\newbibmacro*{cite:parens:labelyear+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[bibhyperrefparens]{%
       \printfield{labelyear}%
       \printfield{extrayear}}}}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}}
       {\printnames{labelname}%
        \setunit{\printdelim{nameyeardelim}}}%
     \usebibmacro{cite:parens:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}}

总共

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[babel]{csquotes}
\usepackage[
    backend=biber,
    citetracker=true,
    autolang=other,
    style=authoryear,
    maxcitenames=2,
    maxbibnames=99,
    uniquename=false,
    uniquelist=true,
    isbn=false,
    doi=false
]{biblatex}
\usepackage{xcolor}
\usepackage{hyperref}

\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}

\renewcommand*{\revsdnamedelim}{}
\renewcommand*{\multinamedelim}{\slash}
\renewcommand*{\finalnamedelim}{\multinamedelim}

\renewcommand*{\multilistdelim}{\addsemicolon\space}
\renewcommand*{\finallistdelim}{\multilistdelim}

\DeclareFieldFormat{bibhyperrefparens}{\bibhyperref{\mkbibparens{#1}}}

\newbibmacro*{cite:parens:labelyear+extrayear}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[bibhyperrefparens]{%
       \printfield{labelyear}%
       \printfield{extrayear}}}}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}}
       {\printnames{labelname}%
        \setunit{\printdelim{nameyeardelim}}}%
     \usebibmacro{cite:parens:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}}


\renewcommand*{\mkbibnamefamily}[1]{\textsc{#1}}
\AtBeginBibliography{%
  \renewcommand*{\mkbibnamefamily}[1]{#1}}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}

@article{Beasley.2008,
    author = {Beasley, Mark and Pagach, Don and  Warr, Richard},
    year = {2008},
    title = {Information conveyed in hiring announcements of senior
             executives overseeing enterprise-wide risk management processes},
    pages = {311--332},
    pagination = {page},
    volume = {23},
    journaltitle = {Journal of Accounting, Auditing {\&} Finance},
    abstract = {},
    note = {}
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}

\noindent Here I use the \textit{cite} command:
\cite[][311]{Beasley.2008} \\ Here the \textit{footcite} command: See
footnote\footcite[][311]{Beasley.2008} \\ And finally the
\textit{textcite} command:
\textcolor{red}{\textcite[][311]{Beasley.2008}}  \\ \noindent But it
should look like that: \textcolor{green}{\textsc{Beasley} et al.
(2008, p. 311)}

\printbibliography
\end{document}

请注意我是如何简化你的代码的,特别是\citemultinamedelim位。

示例输出

相关内容