
スタイル ファイルの場合、参考文献の前に謝辞の段落/テキスト セクションを自動的に生成したいと思います (ユーザー提供のマクロによって設定されたいくつかのオプションに基づきます)。この方法は、との両方で機能するはずですbibtex
。biblatex
どうすればよいでしょうか。
bibtex を使用する場合、次のものを先頭に追加することでこれを実現できますthebibliography
:
\BeforeBeginEnvironment{thebibliography}{%
\section{Acknowledgements}%
Example text.%
}
これはbiblatexでは機能しません。パッチを当ててみました\printbibliography
\pretocmd\printbibliography{%
\section{Acknowledgements}%
Example text.%
}{}{}%
しかし、これは機能しません。これに対する簡単でエレガントな解決策はありますか?
++++ MWEを提供するための更新
MWE を提供していないことをお詫びします。1 つの参照を含む template.bib があると仮定します。
@article{RSA78,
author = {Ronald L. Rivest and Adi Shamir and Leonard M. Adleman},
title = {A Method for Obtaining Digital Signatures and Public-Key Cryptosystems},
pages = {120--126},
year = {1978},
journal = {Communications of the ACM},
volume = {21},
number = {2},
publisher = {ACM New York, NY, USA},
doi = {10.1145/359340.359342},
}
次に、参照の表示前に段落/セクションを自動的に挿入したいと思います (著者側でコマンドを変更する必要はありません)。これは MWE です。
\documentclass{article}
\begin{document}
This is an example citation~\cite{RSA78}.
\bibliographystyle{alphaurl}
\bibliography{template}
\end{document}
Bibtex を使用する場合、次のようにしてこれを実現できます。
\documentclass{article}
\usepackage{etoolbox}
\BeforeBeginEnvironment{thebibliography}{%
\section*{Acknowledgements}%
Section text.%
}
\begin{document}
This is an example citation~\cite{RSA78}.
\bibliographystyle{alphaurl}
\bibliography{template}
\end{document}
biblatex / biber を使用してこれを行うにはどうすればよいでしょうか? MWE:
\documentclass{article}
\usepackage{biblatex}
\addbibresource{template.bib}
\begin{document}
This is an example citation~\cite{RSA78}.
\printbibliography
\end{document}
メモオプションを使用しても、\printbibliography
目的を達成できません。
答え1
biblatex
にはこの種の挿入のためのインフラストラクチャがすでに備わっているため、これを行うために内部を再定義する必要はありません。つまり、prenote
のオプションで\printbibliography
、 で定義された bibnote を選択できます\defbibnote
。実際の使用例に応じて、 を呼び出すときに設定することも\printbibliography
、 でグローバル デフォルトを設定することもできます\DeclarePrintbibliographyDefaults
。例では、 をprenote
デフォルトとして設定し、 をtitle
ローカルに設定しています。その方が理にかなっているように思われます。
\documentclass{article}
\usepackage{biblatex}
\addbibresource{template.bib}
\defbibnote{myprenote}{Section text.}
\DeclarePrintbibliographyDefaults{prenote=myprenote}
\begin{document}
This is an example citation~\cite{RSA78}.
\printbibliography[title=Acknowledgements]
\end{document}
編集: コメントで明らかにされているように (ただし、コメントは後で編集されました...)、実際に必要だったのは見出し自体の前に何かを置くことでした。そのためには、\defbibheading
:を設定できます。
\documentclass{article}
\usepackage{biblatex}
\addbibresource{template.bib}
\defbibheading{myheading}[\bibname]{%
\section*{Acknowledgements}%
Section text.%
\section*{#1}%
\markboth{#1}{#1}}
\DeclarePrintbibliographyDefaults{heading=myheading}
\begin{document}
This is an example citation~\cite{RSA78}.
\printbibliography
\end{document}