I need to use the amsplain bibliography style (or an identical appearing style), but the sources need to be sorted by order of first appearance in the document, not how they are arranged in the bibtext file. How can I do this?
[Tex/LaTex] Use amsplain, but sort by appearance in document, not bibtex file
bibliographiesbibtex
Related Solutions
This question is much easier than the other.
You can get the bibliography in order of appearance with
\bibliographystyle{unsrt}
if not using biblatex
, or with the option sorting=none
to biblatex
. Say that your main document is sebastianmain.tex
. Compile it and run bibtex
(or biber
).
Don't load any package for the bibliography in the secondary document and say
\input{sebastianmain.bbl}
where the bibliography should appear; or
\begin{lrbox}{0}\input{sebastianmain.bbl}\end{lrbox}
if you don't want the bibliography to appear. In the secondary document you can use the same keys as in the main one.
Most of the needed changes to the numeric
style of biblatex
are easy -- the somewhat tricky part (I hope I got it right) is switching the location of the pages field. Traditional unsrt
:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{Dudarev1998,
author = {Dudarev, S. L. and Botton, G. A. and Savrasov, S. Y. and Humphreys,
C. J. and Sutton, A. P.},
title = {Electron-energy-loss spectra and the structural stability of nickel
oxide: An LSDA+U study},
journal = {Phys. Rev. B},
year = {1998},
volume = {57},
pages = {1505--1509},
month = {Jan},
doi = {10.1103/PhysRevB.57.1505},
number = {3},
publisher = {American Physical Society},
url = {http://link.aps.org/doi/10.1103/PhysRevB.57.1505}
}
\end{filecontents}
\begin{document}
\nocite{*}
\bibliographystyle{unsrt}
\bibliography{\jobname}
\end{document}
biblatex
emulation:
\documentclass{article}
\usepackage[sorting=none,maxnames=99,firstinits=true,doi=false,url=false]{biblatex}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{#1}
\renewbibmacro{in:}{%
\ifentrytype{article}{%
}{%
\printtext{\bibstring{in}\intitlepunct}%
}%
}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\renewbibmacro*{volume+number+eid}{%
\setunit{\addcomma\space}%
\printfield{volume}%
\printfield{number}%
\setunit{\addcomma\space}%
\printfield{eid}%
\setunit{\addcolon}%
\printfield{pages}}
\renewbibmacro*{issue+date}{%
\setunit{\addcomma\space}%
\iffieldundef{issue}
{\usebibmacro{date}}
{\printfield{issue}%
\setunit*{\addspace}%
\usebibmacro{date}}%
\newunit}
\renewbibmacro*{note+pages}{%
\printfield{note}%
\newunit}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{Dudarev1998,
author = {Dudarev, S. L. and Botton, G. A. and Savrasov, S. Y. and Humphreys,
C. J. and Sutton, A. P.},
title = {Electron-energy-loss spectra and the structural stability of nickel
oxide: An LSDA+U study},
journal = {Phys. Rev. B},
year = {1998},
volume = {57},
pages = {1505--1509},
month = {Jan},
doi = {10.1103/PhysRevB.57.1505},
number = {3},
publisher = {American Physical Society},
url = {http://link.aps.org/doi/10.1103/PhysRevB.57.1505}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\nocite{*}
\begin{document}
\printbibliography
\end{document}
Note: I assumed that you used the issue
field by mistake and that the number
field is the correct one (both for traditional BibTeX and biblatex
).
Best Answer
amsplain.bst
can easily be modified to suppress the sort.look for the line
and further down,
comment out every line, inclusive, in that stretch of code.
then modify the header to acknowledge the file's origin, but remove any indication that ams might be responsible for maintenance or support, and rename the resulting file. (the lppl didn't exist when the
ams*.bst
files were created, or it would have been applied to this file; if any changes are made in the future, the lppl will be used.)