Я пишу свою магистерскую диссертацию и цитирую в стиле 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}.}}
Если вы не хотите ставить точку в конце сноски, просто опустите после .
нее {#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}