
Я написал диссертацию с библиографическими ссылками в сносках и хотел бы организовать их в библиографию в конце диссертации (используя Lyx).
Я мог бы скопировать каждую сноску и вставить ее в такой документ, но это заняло бы много времени.
Знаете ли вы способ автоматически объединить содержание каждой сноски в один документ, который я мог бы организовать и представить в виде своей библиографии?
Большое спасибо за вашу помощь!
решение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}
Выход