How to manage Bibliography by Latex
For any academic/research writing, incorporating references into a document is an important task.
LaTeX has a variety of features that make dealing with references much simpler.
BibTeX is an auxiliary tool that effectively manages bibliographies.
BibTeX provides for the storage of all references in a bibliographic information file with the file extension .bib
, a kind of flat-file database.
and now, I will use BibTeX to manage my bibliographies.
1.Create an extension file
In my environment, I create an extension file called citations-zsd.bib
for the storage of all references.here is my practical example:
@article{2021data,
title={A data-driven shale gas production forecasting method based on the multi-objective random forest regression},
author={Xue, Liang and Liu, Yuetian and Xiong, Yifei and Liu, Yanli and Cui, Xuehui and Lei, Gang},
journal={Journal of Petroleum Science and Engineering},
volume={196},
pages={107801},
year={2021},
publisher={Elsevier}
}
the above example is my supervisor paper Citation.how to get BibTeX information,you should visit https://scholar.google.com/ and input your papar title.choose the BibTeX button to get it.
2.Use Natbib function
The numeric style of citation is quite common in scientific writing.
In other disciplines, the author-year style, e.g., (Roberts, 2003), such as Harvard is preferred.
I want use Harvard's disciplines to cite papar.
My template is elsarticle's. and elsarticle provide Harvard's author-year style. you must use the file called elsarticle-template-harv.tex
.
The natbib
package is one possible way to get such an output.Natbib allows the user to easily switch between Harvard or numeric.
In my elsarticle-template-harv.tex
file ,my first job is to add the following to your preamble in order to get LaTeX to use the Natbib package:
\usepackage{natbib}
3.Getting current LaTeX document to use your .bib file
At the end of my LaTeX file (that is, after the content, but before \end{document}
),I place the following commands:
\bibliographystyle{plainnat}
\bibliography{citations-zsd}
4.Getting ideal Output
My ideal output is (Xue et al., 2021)
, use the existing \citep
commands to display the type of citation I want.I place the following commands:
\citep{2021data}
References
1.https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management
2.https://assets.ctfassets.net/o78em1y1w4i4/3ro3yQff1q67JHmLi1sAqV/1348e3852f277867230fc4b84a801734/elsdoc-1.pdf