以 APA 格式引用,年份放在括號中

以 APA 格式引用,年份放在括號中

我正在寫我的碩士論文並以 APA 風格進行引用。下面是現在它的樣子:

引文

雖然總的來說看起來不錯,但我想更改年份並將其放在括號中。此外,刪除作者後面的逗號,但保留年份後面的逗號,這樣最終版本看起來像這樣:

魯夫等人。 (1953),第。 16

因為我複製了程式碼以使其接近最終版本,所以我不知道如何進一步更改它以使其達到所需的形式。

我在序言中的程式碼如下所示:

\documentclass[12pt]{report}
\usepackage{natbib}

\makeatletter
\newcommand*{\ibid}{Ibid.}
  \let\@predcite\@empty
  \let\@currcite\@empty
\def\citef{\kernel@ifnextchar[\citef@{\citef@[]}}
\def\citef@[#1]{\kernel@ifnextchar[{\citef@@[{#1}]}{\citef@@[][{#1}]}}
\def\citef@@[#1][#2]#3{%
  \def\@currcite{#3}%
  \unskip
    \ifx\@currcite\@predcite
      \footnote{#1 \ifx\tempa\@empty\unskip\fi%
      \ibid\ifx\tempb\@empty\else\NAT@cmt #2\fi}%
    \else%
      \footnote{\citealp[#1][#2]{#3}}%
    \fi
  \gdef\@predcite{#3}%
}
\makeatother

\bibliographystyle{apalike}

此外,我在文中這樣引用(這是針對上圖所示的範例):

\citef[p. 16]{ruoff53}

預先非常感謝您的建議。非常感謝您的幫忙!

編輯:

在伯納德的提示之後,我現在有了以下程式碼:

你能給我進一步的提示嗎?我將文字正文更改為以下內容,但它似乎一團糟...

\documentclass[12pt]{report}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{biblio.bib}
\usepackage{rotating}

\makeatletter
\newcommand*{\ibid}{Ibid.}
  \let\@predcite\@empty
  \let\@currcite\@empty
\def\citef{\kernel@ifnextchar[\citef@{\citef@[]}}
\def\citef@[#1]{\kernel@ifnextchar[{\citef@@[{#1}]}{\citef@@[][{#1}]}}
\def\citef@@[#1][#2]#3{%
  \def\@currcite{#3}%
  \unskip
    \ifx\@currcite\@predcite
      \footnote{#1 \ifx\tempa\@empty\unskip\fi%
      \ibid\ifx\tempb\@empty\else\NAT@cmt #2\fi}%
    \else%
      \footnote{\citealp[#1][#2]{#3}}%
    \fi
  \gdef\@predcite{#3}%
}
\makeatother

\begin{document}


\chapter{Introduction}
\input{ma_chapters/introduction}
.
.
.
.

\bibliographystyle{apalike}
\bibliography{biblio}

答案1

apalike假設您對參考書目風格、natbib引文管理套件和 BibTeX 一般都滿意,您可以建立一個新的巨集來實現您想要的引文標註格式。

\newcommand\mycite[2][]{\citeauthor{#2}\ (\citeyear{#2})\ifx#1\undefined\else, #1\fi}

如果未指定第一個可選參數,則在\citeyear{#2};之後不列印任何內容。實際上,如果沒有提供可選參數,則\mycite行為類似\citet

在此輸入影像描述

\documentclass[12pt]{report}
\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
@article{ruoff,
  author = "A. Ruoff and B. Woof and C. Zoot",
  title  = "Thoughts",
  journal= "Circularity Today",
  year   = 1953,
}
\end{filecontents}
\usepackage{natbib}
\bibliographystyle{apalike}
\newcommand\mycite[2][]{%
  \citeauthor{#2}\ (\citeyear{#2})\ifx#1\undefined\else, #1\fi}
\begin{document}
\mycite[p.~16]{ruoff}  % with optional argument

\mycite{ruoff}  % without optional argument -- no comma is printed

\citet{ruoff}   % compare with output of "\citet"
\bibliography{biblio}
\end{document}

附錄:要將這些引文標註放在腳註中,您可以使用宏,例如\myfootcite,定義如下:

\newcommand\myfootcite[2][]{\footnote{\mycite[#1]{#2}.}}

如果您不想在腳註材料末尾添加句號(「句號」),只需省略 after.即可{#2}


第二個附錄,以滿足OP對列印出「同上」的引用巨集的請求。如果最新條目與前面的引用命令中的條目相同:

與先前的解決方案相比,只需新增一個測試,判斷目前引文的密鑰是否與上一個引文中使用的密鑰相同。以下程式碼提供了兩個使用者巨集:\tcite,用於文字內引用,\fcite,用於腳註內引用。

在此輸入影像描述

\documentclass[12pt]{report}
\usepackage[textheight=2in]{geometry} %% just for this example
\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
@article{ruoff,
  author = "A. Ruoff and B. Woof and C. Zoot",
  title  = "Thoughts",
  journal= "Circularity Today",
  year   = 1953,
}
@article{abc,
  author = "Anna Andersen and Bertha Branson and Carla Carlsson",
  title  = "Further Thoughts",
  journal= "Circularity Today",   
  year   = 2053,
}
\end{filecontents}

\usepackage{natbib}
\bibliographystyle{apalike}
\def\prevcite{} % initialize \prevcite
%% macro for in-text citation
\newcommand\tcite[2][]{%  
  \def\newcite{#2} 
  \ifx\prevcite\newcite 
    Ibid.%
  \else%
    \gdef\prevcite{#2}% update \prevcite
    \citeauthor{#2}\ (\citeyear{#2})%
  \fi
  \ifx#1\undefined\else, #1\fi}
%% macro for in-footnote citation
\newcommand\fcite[2][]{\footnote{\tcite[#1]{#2}}}
\begin{document}


bla bla\fcite{ruoff}

more bla bla\fcite[p.~75]{ruoff}

still more bla bla\fcite[p.~101]{abc}

further bla bla\fcite{abc}

final bla bla\fcite[p.~999]{abc}
\bibliography{biblio}
\end{document}

答案2

一種用 做事的方式biblatex-apa。您可以使用以下選項模擬 natbib 指令natbib

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}

\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa, backend=biber, natbib]{biblatex}
\DeclareLanguageMapping{american}{american-apa}

\addbibresource{biblio.bib}

\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
@article{ruoff,
  author = "A. Ruoff and B. Woof and C. Zoot",
  title = "Thoughts",
  journal= "Circularity Today",
  year = 1953,
}
\end{filecontents}

\renewcommand*{\nameyeardelim}{\addspace}

%
\usepackage{xpatch}

\makeatletter
\newbibmacro*{cite}{%
 \iffieldequals{namehash}{\cbx@lasthash}
% Multiple cites in one command
 {\setunit{\compcitedelim}%
 \usebibmacro{cite:plabelyear+extrayear}}%
% \bibcloseparen%
% Single cite
 {\ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{entrytype}{patent}}
% No author/editor
 {\usebibmacro{cite:noname}%
 \setunit{\ifbool{cbx:np}%
 {\nameyeardelim}%
 {\global\booltrue{cbx:parens}\addspace\bibopenparen}}%
 \usebibmacro{cite:plabelyear+extrayear}%
 \bibcloseparen%
 \savefield{namehash}{\cbx@lasthash}}
% Normal cite
 {\ifnameundef{shortauthor}
 {\printnames[labelname][-\value{listtotal}]{labelname}}%
 {\cbx@apa@ifnamesaved
 {\printnames{shortauthor}}
 {\printnames[labelname][-\value{listtotal}]{author}\addspace\printnames[sabrackets]{shortauthor}}}%
 \setunit{\ifbool{cbx:np}%
 {\nameyeardelim}%
 {\global\booltrue{cbx:parens}\addspace\bibopenparen}}%
 \usebibmacro{cite:plabelyear+extrayear}%
 \bibcloseparen%
 \savefield{namehash}{\cbx@lasthash}}}%
 \setunit{\multicitedelim}}
\makeatother

\begin{document}

\chapter{Introduction}

\cite[p.~16]{ruoff} % with optional argument

\textcite{ruoff} % without optional argument -- no comma is printed

\citet{ruoff} % compare with output of "\citet"

\printbibliography

\end{document} 

在此輸入影像描述

相關內容