
私は脚注に参考文献を記載した論文を書きました。そして、論文の最後にある参考文献にそれらを整理したいと思います (Lyx を使用)。
すべての脚注をコピーしてそのような文書に貼り付けることもできますが、かなりの時間がかかります。
すべての脚注の内容を 1 つのドキュメントに自動的にまとめ、それを整理して参考文献として提示する方法をご存知ですか?
ご協力ありがとうございました!
答え1
内部コマンドを再定義して\@footnotetext
、その内容をファイルに書き込むことができます。
以下は、脚注をファイルに書き込む簡単な解決策です。ここではfile.ftn
、参考文献としてファイルfile
名が入ります。.tex
\documentclass{article}
\newwrite\footaux
\immediate\openout\footaux\jobname.ftn
\immediate\write\footaux{\string\begin{thebibliography}{99}}
\AtEndDocument{
\immediate\write\footaux{\string\end{thebibliography}}
\closeout\footaux
}
\makeatletter
\let\@footnotetextorig\@footnotetext
\long\def\@footnotetext#1{\@footnotetextorig{#1}\immediate\write\footaux
{\string\bibitem: #1}}
\makeatother
\begin{document}
This is the text\footnote{First footnote}.
\clearpage
This is the text\footnote{Second footnote}.
\end{document}
ファイルは次のとおりです.ftn
:
\begin{thebibliography}{99}
\bibitem: First footnote
\bibitem: Second footnote
\end{thebibliography}
答え2
ソリューションのアイデア
\footnote
脚注テキストを参考文献用にフォーマットされたファイルに保存するようにコマンドを再定義します。- 最後に保存した参考文献を使用します。
ソリューション
\documentclass{article}
\usepackage{lipsum}
\usepackage{url}
\let\originalfootnote\footnote
\newwrite\footnotelist
\immediate\openout\footnotelist\jobname.bls
\immediate\write\footnotelist{\unexpanded{\begin{thebibliography}{99}}}
\def\savefootnote#1{\immediate\write\footnotelist{\unexpanded{\bibitem}{fn\thefootnote}\unexpanded{#1}}}
\def\footnote#1{%
\originalfootnote{#1}%
\savefootnote{#1}}
\AtEndDocument{\immediate\write\footnotelist{\unexpanded{\end{thebibliography}}}%
\immediate\closeout\footnotelist%
\IfFileExists{\jobname.bls}{\input{\jobname.bls}}{\relax}}
\begin{document}
\lipsum[1-10]
Put a footnote here.\footnote{\url{http://www.acm.org}}
\lipsum[11-20]
Put another footnote here.\footnote{\url{http://ieeexplore.ieee.org}}
\lipsum[21-30]
\end{document}
脚注リストファイルを作成しました
\begin {thebibliography}{99}
\bibitem {fn1}\url {http://www.acm.org}
\bibitem {fn2}\url {http://ieeexplore.ieee.org}
\end {thebibliography}
出力