APA 風格引用、括號的年份、腳引、同上

APA 風格引用、括號的年份、腳引、同上

我想

  1. 我的引文風格是註腳Author (Year)
  2. 使整個內容Author (Year)成為參考書目的超鏈接
  3. 以便重複引用Ibid

到目前為止我幾乎能做到這一切。

下面的程式碼編譯後給出正確的超連結和正確的同上,但引用是Author Year(無括號)。如果我將每個更改autocite為,footcite我會得到正確的超連結和正確的引用,但錯誤的 ibidem: Author (ibid.)

如果我做了第一個autocitea footcite,我得到預期的結果這意味著我必須追蹤autocitefootcite,這違背了自動同上的目的。

\documentclass{article}
\usepackage{varioref}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,style=authoryear-ibid,ibidtracker=constrict, autocite=footnote]{biblatex}

\DeclareFieldFormat{citehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{#1}}

\DeclareFieldFormat{textcitehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{%
    #1%
    \ifbool{cbx:parens}
      {\bibcloseparen\global\boolfalse{cbx:parens}}
      {}}}

\savebibmacro{cite}
\savebibmacro{textcite}

\renewbibmacro*{cite}{%
  \printtext[citehyperref]{%
    \restorebibmacro{cite}%
    \usebibmacro{cite}}}

\renewbibmacro*{textcite}{%
  \ifboolexpr{
    ( not test {\iffieldundef{prenote}} and
      test {\ifnumequal{\value{citecount}}{1}} )
    or
    ( not test {\iffieldundef{postnote}} and
      test {\ifnumequal{\value{citecount}}{\value{citetotal}}} )
  }
    {\DeclareFieldAlias{textcitehyperref}{noformat}}
    {}%
  \printtext[textcitehyperref]{%
    \restorebibmacro{textcite}%
    \usebibmacro{textcite}}}

% The following lines give the correct footcite Author (Year) but make the ibid erroneous
% Author (ibid)
\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\boolfalse{cbx:parens}}
  {\usebibmacro{citeindex}%
   \iffirstcitekey
     {\setcounter{textcitetotal}{1}}
     {\stepcounter{textcitetotal}%
      \textcitedelim}%
   \usebibmacro{textcite}}
  {\ifbool{cbx:parens}
     {\bibcloseparen\global\boolfalse{cbx:parens}}
     {}}
  {\usebibmacro{textcite:postnote}}


\begin{filecontents}{\jobname.bib}

@book{Chomsky1986,
    Address = {Cambridge Mass.},
    Author = {Noam Chomsky},
    Publisher = {{MIT} Press},
    Title = {Barriers},
    Year = {1986}}

@book{Chomsky1981,
    Address = {Dordrecht},
    Author = {Noam Chomsky},
    Publisher = {Foris Publications},
    Title = {Lectures on Government and Binding},
    Year = {1981}}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\section{}
% switching between \autocite and \footcite solves some problems but 
% exposes others
\autocite{Chomsky1981} and \autocite{Chomsky1981}
\printbibliography
\end{document}

答案1

我們可以重新定義普通cite巨集以將年份括在括號中,為了避免其他引用指令出現問題,我們為變更後的巨集選擇一個新名稱cite:paren:labelyear+extrayear

\renewbibmacro*{cite}{\printtext[citehyperref]{%
  \global\boolfalse{cbx:loccit}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
          {\usebibmacro{cite:label}%
           \setunit{\addspace}}
          {\printnames{labelname}%
           \setunit{\nameyeardelim}}%
        \usebibmacro{cite:paren:labelyear+extrayear}}}
    {\usebibmacro{cite:shorthand}}}}

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

無需更改\footcite命令

微量元素

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber,style=authoryear-ibid,ibidtracker=constrict, autocite=footnote]{biblatex}
\usepackage{hyperref}

\DeclareFieldFormat{citehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{#1}}

\renewbibmacro*{cite}{\printtext[citehyperref]{%
  \global\boolfalse{cbx:loccit}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
          {\usebibmacro{cite:label}%
           \setunit{\addspace}}
          {\printnames{labelname}%
           \setunit{\nameyeardelim}}%
        \usebibmacro{cite:paren:labelyear+extrayear}}}
    {\usebibmacro{cite:shorthand}}}}

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

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson} ipsum\autocite{sigfridsson}. Dolor\autocite{knuth:ct:a,knuth:ct:b}.
\end{document}

範例文檔的註腳

相關內容