Biblatex:authoryear-comp 的簡寫或別名

Biblatex:authoryear-comp 的簡寫或別名

如何在引文風格中使用簡寫或別名authoryear-comp?具體來說,我想要

第一篇文字引用:

Bravo 和 Charlie(2002 年,以下簡稱論文 I)

Bravo & Charlie (2002,以下簡稱論文 I) 與 Charlie & Delta (2004)

Bravo & Charlie (2002,以下簡稱論文 I,2003) 與 Charlie & Delta (2004)

Bravo & Charlie (2001、2002,以下簡稱論文 I) 與 Charlie & Delta (2004)

Alpha & Bravo (2000) 與 Bravo & Charlie (2002,以下簡稱論文 I)

第一個括號內的引用:

(Bravo & Charlie 2002,以下簡稱論文 I)

(Bravo & Charlie 2002,以下簡稱論文 I;Charlie & Delta 2004)

(Bravo & Charlie 2002,以下簡稱 Paper I,2003;Charlie & Delta 2004)

(Bravo & Charlie 2001、2002,以下簡稱論文 I;Charlie & Delta 2004)

(Alpha & Bravo 2000;Bravo & Charlie 2002,以下簡稱論文 I)

後續文字引用:

論文一

論文 I 與查理與德爾塔 (2004)

論文 I、Bravo 和 Charlie (2003) 以及 Charlie 和 Delta (2004)

Bravo 與 Charlie (2001)、Paper I 與 Charlie & Delta (2004)

Alpha & Bravo (2000) 與論文 I

隨後括號內的引用:

(論文一)

(論文 I;Charlie & Delta 2004)

(論文 I;Bravo & Charlie 2003;Charlie & Delta 2004)

(Bravo 和 Charlie 2001;論文 I;Charlie 和 Delta 2004)

(Alpha & Bravo 2000;論文 I)

此風格是基於《天文物理學雜誌》(ApJ)。我不知道有關簡寫或別名情況下的標點符號和排序的具體說明,因此上面的範例可能略有不正確。

authoryear-comp從with取得 ApJ 樣式很容易

\renewcommand*\finalnamedelim
  {\ifbibliography{\finalandcomma}{}\addspace\&\space}
\renewcommand*\nameyeardelim{\addspace}
\DefineBibliographyStrings{english}{citedas={hereafter}}

但透過駭客手段authoryear-comp讓速記或別名發揮作用超出了我的能力範圍。

編輯1:根據 @moewe 的評論,這是一個測試範例。當然,速記還沒有如預期發揮作用。 (奇怪的是:0不能當輸入鍵。)

\documentclass{article}
\usepackage[style=authoryear-comp, backend=biber]{biblatex}
\begin{filecontents}{\jobname.bib}
@article{1,
  author    = "Alpha, A. and Bravo, B.",
  year      = "2000"
}
@article{2,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2001"
}
@article{3,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2002",
  shorthand = "Paper I"
}
@article{4,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2003"
}
@article{5,
  author    = "Charlie, C. and Delta, D.",
  year      = "2004"
}
\end{filecontents}
\addbibresource{\jobname}
\renewcommand*\finalnamedelim
  {\ifbibliography{\finalandcomma}{}\addspace\&\space}
\renewcommand*\nameyeardelim{\addspace}
\DefineBibliographyStrings{english}{citedas={hereafter}}
\begin{document}
\parindent0em\relax
\textcite{3}\citereset\par
\textcite{3, 5}\citereset\par
\textcite{3, 4, 5}\citereset\par
\textcite{2, 3, 5}\citereset\par
\textcite{1, 3}\citereset\vskip\bigskipamount
\parencite{3}\citereset\par
\parencite{3, 5}\citereset\par
\parencite{3, 4, 5}\citereset\par
\parencite{2, 3, 5}\citereset\par
\parencite{1, 3}\vskip\bigskipamount
\textcite{3}\par
\textcite{3, 5}\par
\textcite{3, 4, 5}\par
\textcite{2, 3, 5}\par
\textcite{1, 3}\vskip\bigskipamount
\parencite{3}\par
\parencite{3, 5}\par
\parencite{3, 4, 5}\par
\parencite{2, 3, 5}\par
\parencite{1, 3}
\end{document}

編輯2:這是一個擴展測試,隨後是預期結果。

\documentclass{article}
\usepackage[letterpaper, left=1in, right=1in]{geometry}
\usepackage[style=authoryear-comp, citetracker, backend=biber]{biblatex}
\begin{filecontents}{\jobname.bib}
@article{1,
  author    = "Alpha, A. and Bravo, B.",
  year      = "2001"
}
@article{2,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2002"
}
@article{3,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2003"
}
@article{4,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2004",
  shorthand = "Paper I"
}
@article{5,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2005"
}
@article{6,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2006"
}
@article{7,
  author    = "Charlie, C. and Delta, D.",
  year      = "2007"
}
\end{filecontents}
\addbibresource{\jobname}
\renewcommand*\finalnamedelim
  {\ifbibliography{\finalandcomma}{}\addspace\&\space}
\renewcommand*\nameyeardelim{\addspace}
\DefineBibliographyStrings{english}{citedas={hereafter}}
\begin{document}
\pagestyle{empty}\parindent0em\relax
\textcite{4}\citereset\par
\textcite{1, 4}\citereset\par
\textcite{4, 7}\citereset\par
\textcite{1, 2, 4}\citereset\par
\textcite{1, 4, 5}\citereset\par
\textcite{2, 4, 7}\citereset\par
\textcite{4, 5, 7}\citereset\par
\textcite{1, 2, 3, 4}\citereset\par
\textcite{1, 3, 4, 5}\citereset\par
\textcite{1, 4, 5, 6}\citereset\par
\textcite{2, 3, 4, 7}\citereset\par
\textcite{3, 4, 5, 7}\citereset\par
\textcite{4, 5, 6, 7}\citereset\par
\textcite{1, 2, 3, 4, 7}\citereset\par
\textcite{1, 3, 4, 5, 7}\citereset\par
\textcite{1, 4, 5, 6, 7}\citereset\newpage
\parencite{4}\citereset\par
\parencite{1, 4}\citereset\par
\parencite{4, 7}\citereset\par
\parencite{1, 2, 4}\citereset\par
\parencite{1, 4, 5}\citereset\par
\parencite{2, 4, 7}\citereset\par
\parencite{4, 5, 7}\citereset\par
\parencite{1, 2, 3, 4}\citereset\par
\parencite{1, 3, 4, 5}\citereset\par
\parencite{1, 4, 5, 6}\citereset\par
\parencite{2, 3, 4, 7}\citereset\par
\parencite{3, 4, 5, 7}\citereset\par
\parencite{4, 5, 6, 7}\citereset\par
\parencite{1, 2, 3, 4, 7}\citereset\par
\parencite{1, 3, 4, 5, 7}\citereset\par
\parencite{1, 4, 5, 6, 7}\newpage
\textcite{4}\par
\textcite{1, 4}\par
\textcite{4, 7}\par
\textcite{1, 2, 4}\par
\textcite{1, 4, 5}\par
\textcite{2, 4, 7}\par
\textcite{4, 5, 7}\par
\textcite{1, 2, 3, 4}\par
\textcite{1, 3, 4, 5}\par
\textcite{1, 4, 5, 6}\par
\textcite{2, 3, 4, 7}\par
\textcite{3, 4, 5, 7}\par
\textcite{4, 5, 6, 7}\par
\textcite{1, 2, 3, 4, 7}\par
\textcite{1, 3, 4, 5, 7}\par
\textcite{1, 4, 5, 6, 7}\newpage
\parencite{4}\par
\parencite{1, 4}\par
\parencite{4, 7}\par
\parencite{1, 2, 4}\par
\parencite{1, 4, 5}\par
\parencite{2, 4, 7}\par
\parencite{4, 5, 7}\par
\parencite{1, 2, 3, 4}\par
\parencite{1, 3, 4, 5}\par
\parencite{1, 4, 5, 6}\par
\parencite{2, 3, 4, 7}\par
\parencite{3, 4, 5, 7}\par
\parencite{4, 5, 6, 7}\par
\parencite{1, 2, 3, 4, 7}\par
\parencite{1, 3, 4, 5, 7}\par
\parencite{1, 4, 5, 6, 7}
\end{document}
Bravo & Charlie (2004, hereafter Paper I)
Alpha & Bravo (2001) and Bravo & Charlie (2004, hereafter Paper I)
Bravo & Charlie (2004, hereafter Paper I) and Charlie & Delta (2007)
Alpha & Bravo (2001) and Bravo & Charlie (2002, 2004, hereafter Paper I)
Alpha & Bravo (2001) and Bravo & Charlie (2004, hereafter Paper I, 2005)
Bravo & Charlie (2002, 2004, hereafter Paper I) and Charlie & Delta (2007)
Bravo & Charlie (2004, hereafter Paper I, 2005) and Charlie & Delta (2007)
Alpha & Bravo (2001) and Bravo & Charlie (2002, 2003, 2004, hereafter Paper I)
Alpha & Bravo (2001) and Bravo & Charlie (2003, 2004, hereafter Paper I, 2005)
Alpha & Bravo (2001) and Bravo & Charlie (2004, hereafter Paper I, 2005, 2006)
Bravo & Charlie (2002, 2003, 2004, hereafter Paper I) and Charlie & Delta (2007)
Bravo & Charlie (2003, 2004, hereafter Paper I, 2005) and Charlie & Delta (2007)
Bravo & Charlie (2004, hereafter Paper I, 2005, 2006) and Charlie & Delta (2007)
Alpha & Bravo (2001), Bravo & Charlie (2002, 2003, 2004, hereafter Paper I), and Charlie & Delta (2007)
Alpha & Bravo (2001), Bravo & Charlie (2003, 2004, hereafter Paper I, 2005), and Charlie & Delta (2007)
Alpha & Bravo (2001), Bravo & Charlie (2004, hereafter Paper I, 2005, 2006), and Charlie & Delta (2007)

(Bravo & Charlie 2004, hereafter Paper I)
(Alpha & Bravo 2001; Bravo & Charlie 2004, hereafter Paper I)
(Bravo & Charlie 2004, hereafter Paper I; Charlie & Delta 2007)
(Alpha & Bravo 2001; Bravo & Charlie 2002, 2004, hereafter Paper I)
(Alpha & Bravo 2001; Bravo & Charlie 2004, hereafter Paper I, 2005)
(Bravo & Charlie 2002, 2004, hereafter Paper I; Charlie & Delta 2007)
(Bravo & Charlie 2004, hereafter Paper I, 2005; Charlie & Delta 2007)
(Alpha & Bravo 2001; Bravo & Charlie 2002, 2003, 2004, hereafter Paper I)
(Alpha & Bravo 2001; Bravo & Charlie 2003, 2004, hereafter Paper I, 2005)
(Alpha & Bravo 2001; Bravo & Charlie 2004, hereafter Paper I, 2005, 2006)
(Bravo & Charlie 2002, 2003, 2004, hereafter Paper I; Charlie & Delta 2007)
(Bravo & Charlie 2003, 2004, hereafter Paper I, 2005; Charlie & Delta 2007)
(Bravo & Charlie 2004, hereafter Paper I, 2005, 2006; Charlie & Delta 2007)
(Alpha & Bravo 2001; Bravo & Charlie 2002, 2003, 2004, hereafter Paper I; Charlie & Delta 2007)
(Alpha & Bravo 2001; Bravo & Charlie 2003, 2004, hereafter Paper I, 2005; Charlie & Delta 2007)
(Alpha & Bravo 2001; Bravo & Charlie 2004, hereafter Paper I, 2005, 2006; Charlie & Delta 2007)

Paper I
Alpha & Bravo (2001) and Paper I
Paper I and Charlie & Delta (2007)
Alpha & Bravo (2001), Bravo & Charlie (2002), and Paper I
Alpha & Bravo (2001), Paper I, and Bravo & Charlie (2005)
Bravo & Charlie (2002), Paper I, and Charlie & Delta (2007)
Paper I, Bravo & Charlie (2005), and Charlie & Delta (2007)
Alpha & Bravo (2001), Bravo & Charlie (2002, 2003), and Paper I
Alpha & Bravo (2001), Bravo & Charlie (2003), Paper I, and Bravo & Charlie (2005)
Alpha & Bravo (2001), Paper I, and Bravo & Charlie (2005, 2006)
Bravo & Charlie (2002, 2003), Paper I, and Charlie & Delta (2007)
Bravo & Charlie (2003), Paper I, Bravo & Charlie (2005), and Charlie & Delta (2007)
Paper I, Bravo & Charlie (2005, 2006), and Charlie & Delta (2007)
Alpha & Bravo (2001), Bravo & Charlie (2002, 2003), Paper I, and Charlie & Delta (2007)
Alpha & Bravo (2001), Bravo & Charlie (2003), Paper I, Bravo & Charlie (2005), and Charlie & Delta (2007)
Alpha & Bravo (2001), Paper I, Bravo & Charlie (2005, 2006), and Charlie & Delta (2007)

(Paper I)
(Alpha & Bravo 2001; Paper I)
(Paper I; Charlie & Delta 2007)
(Alpha & Bravo 2001; Bravo & Charlie 2002; Paper I)
(Alpha & Bravo 2001; Paper I; Bravo & Charlie 2005)
(Bravo & Charlie 2002; Paper I; Charlie & Delta 2007)
(Paper I; Bravo & Charlie 2005; Charlie & Delta 2007)
(Alpha & Bravo 2001; Bravo & Charlie 2002, 2003; Paper I)
(Alpha & Bravo 2001; Bravo & Charlie 2003; Paper I; Bravo & Charlie 2005)
(Alpha & Bravo 2001; Paper I; Bravo & Charlie 2005, 2006)
(Bravo & Charlie 2002, 2003; Paper I; Charlie & Delta 2007)
(Bravo & Charlie 2003; Paper I; Bravo & Charlie 2005; Charlie & Delta 2007)
(Paper I; Bravo & Charlie 2005, 2006; Charlie & Delta 2007)
(Alpha & Bravo 2001; Bravo & Charlie 2002, 2003; Paper I; Charlie & Delta 2007)
(Alpha & Bravo 2001; Bravo & Charlie 2003; Paper I; Bravo & Charlie 2005; Charlie & Delta 2007)
(Alpha & Bravo 2001; Paper I; Bravo & Charlie 2005, 2006; Charlie & Delta 2007)

答案1

不幸的是,-comp樣式通常很難修改(即使是相對微小的更改,最終也會產生許多行程式碼)。

cite然而,bibmacro所需的修改非常簡單。將測試替換\iffieldundef{shorthand}\ifboolexpr{test {\iffieldundef{shorthand}} or not test {\ifciteseen}}並添加\usebibmacro{shorthandintro}到非速記塊的末尾。

由於您想要稍微不同的\textcite引用,我們必須稍微重組該巨集。邏輯shorthand被提升了幾個嵌套層級。

為了讓textcitecount朋友們正確,我們還必須\textcite稍微修改 cite 指令。

然後我們也會修改shorthandintro巨集以滿足您的願望。

下面MWE中的相關代碼是\makeatletter/之間的位元\makeatother。請注意,您需要啟用該citetracker功能才能正常運作。

\documentclass{article}
\usepackage[style=authoryear-comp, backend=biber, citetracker]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{1,
  author    = "Alpha, A. and Bravo, B.",
  year      = "2000"
}
@article{2,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2001"
}
@article{3,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2002",
  shorthand = "Paper I"
}
@article{4,
  author    = "Bravo, B. and Charlie, C.",
  year      = "2003"
}
@article{5,
  author    = "Charlie, C. and Delta, D.",
  year      = "2004"
}
\end{filecontents}
\addbibresource{\jobname.bib}
\renewcommand*\finalnamedelim
  {\ifbibliography{\finalandcomma}{}\addspace\&\space}
\renewcommand*\nameyeardelim{\addspace}
\DefineBibliographyStrings{english}{citedas={hereafter}}

\makeatletter
\renewbibmacro*{cite}{%
  \ifboolexpr{test {\iffieldundef{shorthand}} or not test {\ifciteseen}}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\printdelim{nonameyeardelim}}%
        \usebibmacro{cite:labelyear+extrayear}%
        \usebibmacro{cite:reinit}}
       {\iffieldequals{namehash}{\cbx@lasthash}
          {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                       \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
             {\setunit{\addcomma}%
              \usebibmacro{cite:extrayear}}
             {\setunit{\compcitedelim}%
              \usebibmacro{cite:labelyear+extrayear}%
              \savefield{labelyear}{\cbx@lastyear}}}
          {\printnames{labelname}%
           \setunit{\printdelim{nameyeardelim}}%
           \usebibmacro{cite:labelyear+extrayear}%
           \savefield{namehash}{\cbx@lasthash}%
           \savefield{labelyear}{\cbx@lastyear}}}%
    \usebibmacro{shorthandintro}}
    {\usebibmacro{cite:shorthand}%
     \usebibmacro{cite:reinit}}%
  \setunit{\multicitedelim}}

\renewbibmacro*{textcite}{%
  \ifboolexpr{test {\iffieldundef{shorthand}} or not test {\ifciteseen}}
    {\iffieldequals{namehash}{\cbx@lasthash}
       {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND
                      \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
            {\setunit{\addcomma}%
             \usebibmacro{cite:extrayear}}
            {\setunit{\compcitedelim}%
             \usebibmacro{cite:labelyear+extrayear}%
             \savefield{labelyear}{\cbx@lastyear}}}
        {\ifnameundef{labelname}
           {\usebibmacro{cite:label}%
            \setunit{%
              \global\booltrue{cbx:parens}%
              \printdelim{nonameyeardelim}\bibopenparen}%
            \ifnumequal{\value{citecount}}{1}
              {\usebibmacro{prenote}}
              {}%
            \usebibmacro{cite:labelyear+extrayear}}
           {\printnames{labelname}%
            \setunit{%
              \global\booltrue{cbx:parens}%
              \printdelim{nameyeardelim}\bibopenparen}%
            \ifnumequal{\value{citecount}}{1}
              {\usebibmacro{prenote}}
              {}%
            \iffieldundef{labelyear}
               {\usebibmacro{cite:label}}
               {\usebibmacro{cite:labelyear+extrayear}}%
             \savefield{labelyear}{\cbx@lastyear}}%
         \stepcounter{textcitecount}}%
     \usebibmacro{shorthandintro}%
     \savefield{namehash}{\cbx@lasthash}}
    {\usebibmacro{cite:shorthand}%
     \stepcounter{textcitecount}%
     \global\undef\cbx@lasthash
     \global\undef\cbx@lastyear}%
    \setunit{%
      \ifbool{cbx:parens}
        {\bibcloseparen\global\boolfalse{cbx:parens}}
        {}%
      \textcitedelim}}

\renewbibmacro*{shorthandintro}{%
  \iffieldundef{shorthandintro}
    {\iffieldundef{shorthand}
       {}
       {\setunit{\addcomma\space}%
        \printtext{%
          \bibstring{citedas}\space
          \printfield{shorthand}}}}
    {\setunit{\addcomma\space}%
     \printtext{\printfield{shorthandintro}}}}

%\iffieldequals{namehash}{\cbx@lasthash}{N}{}\ifciteseen{S}{}\iffieldundef{shorthand}{U}{}
\DeclareCiteCommand{\textcite}[\cbx@textcite@init\cbx@textcite]
  {\gdef\cbx@savedkeys{}%
   \citetrackerfalse%
   \pagetrackerfalse%
   \DeferNextCitekeyHook%
   \usebibmacro{cite:init}}
  {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
     {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}%
      \global\clearfield{multipostnote}}
     {}%
   \xappto\cbx@savedkeys{\thefield{entrykey},}%
   \citetrackertrue
   \ifboolexpr{not test {\iffieldequals{namehash}{\cbx@lasthash}} or (not test {\iffieldundef{shorthand}} and test {\ifciteseen}) }
     {\stepcounter{textcitetotal}%
      \savefield{namehash}{\cbx@lasthash}%
      \ifboolexpr{not test {\iffieldundef{shorthand}} and test {\ifciteseen}}
        {\global\undef\cbx@lasthash}{}}
     {}%
   \citetrackerfalse}
  {}
  {\protected@xappto\cbx@savedcites{%
     [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}}
\makeatother


\begin{document}
\parindent0em\relax
\textcite{3}\citereset\par
\textcite{3, 5}\citereset\par
\textcite{3, 4, 5}\citereset\par
\textcite{2, 3, 5}\citereset\par
\textcite{1, 3}\citereset\vskip\bigskipamount
\parencite{3}\citereset\par
\parencite{3, 5}\citereset\par
\parencite{3, 4, 5}\citereset\par
\parencite{2, 3, 5}\citereset\par
\parencite{1, 3}\vskip\bigskipamount
\textcite{3}\par
\textcite{3, 5}\par
\textcite{3, 4, 5}\par
\textcite{2, 3, 5}\par
\textcite{1, 3}\vskip\bigskipamount
\parencite{3}\par
\parencite{3, 5}\par
\parencite{3, 4, 5}\par
\parencite{2, 3, 5}\par
\parencite{1, 3}
\end{document}

OP 中的四個範例區塊

相關內容