私は修士論文を執筆中で、APA スタイルで引用しています。現在の状態は以下のとおりです。
全体的には問題ないように見えますが、年を変更して括弧に入れたいと思います。さらに、著者の後のカンマを削除し、年の後のカンマはそのままにして、最終版は次のようになります。
Ruoff ら(1953年)、p. 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}
事前に、アドバイスをいただき、本当にありがとうございます。ご協力いただければ幸いです。
編集:
Bernard のヒントに従って、次のコードを作成しました。
さらにヒントをいただけますか? テキストの本文を次のように変更しましたが、完全に混乱しているようです...
\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
参考文献スタイル、引用管理パッケージ、および BibTeX 全般に問題がなければnatbib
、必要な引用コールアウト形式を実装する新しいマクロを作成できます。
\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}
。
第二補遺、最新のエントリが前の引用コマンドのものと同じである場合に「Ibid.」を出力する引用マクロに対する OP の要求に対応するため:
以前のソリューションと比較すると、必要なのは、現在の引用のキーが前の引用で使用されたものと同じかどうかのテストを追加することだけです。次のコードは、\tcite
本文内引用用の と、\fcite
脚注内引用用の という 2 つのユーザー マクロを提供します。
\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}