I'd like to sort my references alphabetically by last name of the author (firstly Art, then Fart). There's one more thing – I want to have the last names put in the front.
I guess the latter can be solved simply by
\bibitem{art} ART, John.
\bibitem{fart} FART, Jack.
I don't know about the former. I'm still new to libraries, so I don't mind using any package. I prefer the simplest code possible though. (I'm using the TeXworks editor.)
My code is below
\documentclass{article}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.~\cite{fart} Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.~\cite{art}
\begin{thebibliography}{99}
\addcontentsline{toc}{chapter}{Bibliography}
\bibitem{art}
ART, John.
\bibitem{fart}
FART, Jack.
\end{thebibliography}
\end{document}
Picture with intention included:
Thank you!
Best Answer
Sorting of the bibliography requires that you have an external database of entries rather than a hand built list. In your case your external file
mybib.bib
could be:To use this in your document there are two approaches: (1) traditional
bibtex
; (2) modernbiblatex
.Bibtex approach
Choose a style for the bibliography via
\bibliographystyle
. Choose the database file and print the bibliography via\bibliography{mybib}
. As you seem to want your authors listed asLastname, Firstname
then one choice is theapa
style, which requires thenatbib
package; pass the optionnumbers
to this package to get numerical citations.Compile as
to get
Read more at bibtex on CTAN
Biblatex approach
Load the package
biblatex
, withstyle=numeric
for numerical citations. To get Lastname, Firstname in the bibilography use the command\DeclareNameAlias{default}{last-first}
. Point to your database via\addbibresource{mybib.bib}
. Put\printbibliography
at the place in you file you want the bibliography to appear.Compile with
to get
Read more at Guidelines for customizing biblatex styles and in the
biblatex
manual combined with the bitex reference above.