需要参考引用格式方面的帮助

需要参考引用格式方面的帮助

我正在使用 Biblatex。对于一篇论文,我需要脚注引用如下所示:

作者(年份:页码)

例如

²约翰逊(2010:29)

我已经实现了代码这个问题,见下文,这给了我

²约翰逊,2010:29。

我现在唯一需要做的就是删除作者后面的逗号,添加括号并删除末尾的点。不幸的是,即使打印并阅读了 263 页的 Biblatex 文档,我仍然不知道链接的代码是做什么的。如果有人能帮我解决这个问题,我会很高兴。

\documentclass{report}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\usepackage[colorlinks]{hyperref}

\renewcommand*{\nameyeardelim}{\nametitledelim}
\renewcommand*{\postnotedelim}{\addcolon}
\DeclareFieldFormat{postnote}{#1}

\newrobustcmd*{\citehook}{%
  \AtNextCite{%
    \renewcommand*{\postnotedelim}{\addspace}%
    \renewbibmacro*{cite:labelyear+extrayear}{%
      \iffieldundef{label}
        {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
        {}}}}

\newrobustcmd*{\autocitetitle}{\citehook\autocite}
\newrobustcmd*{\autocitetitles}{\citehook\autocites}

\addbibresource{biblatex-examples.bib}
\begin{document}
\null\vfill
Filler text \autocite[See][10--15]{aristotle:poetics}.
Filler text \autocitetitle[See][7.6.2]{aristotle:poetics}.
Filler text \autocite{aristotle:poetics,aristotle:rhetoric,kant:kpv,cms}.
Filler text \autocites[10--15]{aristotle:poetics}[25]{aristotle:rhetoric}.
Filler text \autocitetitle{aristotle:poetics,aristotle:rhetoric,kant:kpv,cms}.
Filler text \autocitetitles[7.6.2]{aristotle:poetics}{aristotle:rhetoric}.
\printbibliography
\end{document}

答案1

由于给出的输出\textcite几乎就是您想要的,我认为最好让它更\footcite接近一点\textcite,尝试以下定义

\makeatletter
\newbibmacro*{footcite}{%
  \ifnameundef{labelname}
    {\iffieldundef{shorthand}
       {\usebibmacro{cite:label}%
        \setunit{%
          \global\booltrue{cbx:parens}%
          \addspace\bibopenparen}%
        \usebibmacro{cite:labelyear+extrayear}}
       {\usebibmacro{cite:shorthand}}}
    {\printnames{labelname}%
     \setunit{%
       \global\booltrue{cbx:parens}%
       \addspace\bibopenparen}%
     \usebibmacro{citeyear}}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\boolfalse{cbx:parens}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \iffirstcitekey
     {\setcounter{textcitetotal}{1}}
     {\stepcounter{textcitetotal}%
      \textcitedelim}%
   \usebibmacro{footcite}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}}
  {\usebibmacro{textcite:postnote}}

\DeclareMultiCiteCommand{\footcites}[\mkbibfootnote]{\footcite}{}
\makeatother

authoryear.cbx这只是对 的定义的稍微修改后的版本textcite

总共

平均能量损失

\documentclass[american]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\usepackage[colorlinks]{hyperref}

\renewcommand*{\nameyeardelim}{\addcomma\space}
\renewcommand*{\postnotedelim}{\addcolon}
\DeclareFieldFormat{postnote}{#1}

\makeatletter
\newbibmacro*{footcite}{%
  \ifnameundef{labelname}
    {\iffieldundef{shorthand}
       {\usebibmacro{cite:label}%
        \setunit{%
          \global\booltrue{cbx:parens}%
          \addspace\bibopenparen}%
        \usebibmacro{cite:labelyear+extrayear}}
       {\usebibmacro{cite:shorthand}}}
    {\printnames{labelname}%
     \setunit{%
       \global\booltrue{cbx:parens}%
       \addspace\bibopenparen}%
     \usebibmacro{citeyear}}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\boolfalse{cbx:parens}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \iffirstcitekey
     {\setcounter{textcitetotal}{1}}
     {\stepcounter{textcitetotal}%
      \textcitedelim}%
   \usebibmacro{footcite}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}}
  {\usebibmacro{textcite:postnote}}

\DeclareMultiCiteCommand{\footcites}[\mkbibfootnote]{\footcite}{}
\makeatother

\addbibresource{biblatex-examples.bib}
\begin{document}
Filler text \footcite[See][10--15]{aristotle:poetics}.
Filler text \footcite{aristotle:poetics,aristotle:rhetoric,kant:kpv,cms}.
Filler text \footcites[10--15]{aristotle:poetics}[25]{aristotle:rhetoric}.
\printbibliography
\end{document}

MWE 的脚注部分

相关内容