をお願いします。
- 私の引用スタイルは脚注です
Author (Year)
- 全体を
Author (Year)
参考文献へのハイパーリンクにする - 繰り返し引用するために
Ibid
今のところ、ほぼすべてできています。
以下のコードはコンパイルすると正しいハイパーリンクと正しい同書が提供されますが、引用はAuthor Year
(括弧なし) です。それぞれautocite
を に変更すると、footcite
正しいハイパーリンクと正しい引用が得られますが、間違った同書が提供されます: Author (ibid.)
。
autocite
最初のaを作るとfootcite
、意図した結果を得る...しかしautocite
つまり、とを追跡する必要がありfootcite
、自動同上検索の目的が達成されません。
\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コマンドで問題が発生するのを避けるために、変更したマクロに新しい名前を選択します。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}