Should I cite using beginthebibliography or beginfilecontents* The Next CEO of Stack Overflowbiblatex in a nutshell (for beginners)bibtex vs. biber and biblatex vs. natbibQuestion mark or bold citation key instead of citation numberWhen I use the beginthebibliography command, I get it as a chapter. How can I get rid of that?How to reference properly when citations are grouped by sectionsthebibliography environment printing cite keyTwo bibliography using thebibliographyHow do I print out more than 200 citations in beginthebibliography … endthebibliographypdfmdfivesum error triggered by beginthebibliographyChange style of references when using beginthebibliographyShould I cite TikZ code?References: cite thebibliography not displayed as [number]?Remove bibliography title using thebibliographyThebibliographyMultiple bibliographies using BibTeX and thebibliography?

Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis

Why didn't Khan get resurrected in the Genesis Explosion?

Why did CATV standarize in 75 ohms and everyone else in 50?

Should I tutor a student who I know has cheated on their homework?

Why does the flight controls check come before arming the autobrake on the A320?

Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?

Won the lottery - how do I keep the money?

Can we say or write : "No, it'sn't"?

INSERT to a table from a database to other (same SQL Server) using Dynamic SQL

Is it okay to majorly distort historical facts while writing a fiction story?

"misplaced omit" error when >centering columns

Unclear about dynamic binding

Does increasing your ability score affect your main stat?

Can MTA send mail via a relay without being told so?

What happened in Rome, when the western empire "fell"?

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

Why is information "lost" when it got into a black hole?

WOW air has ceased operation, can I get my tickets refunded?

Is micro rebar a better way to reinforce concrete than rebar?

How to place nodes around a circle from some initial angle?

Reference request: Grassmannian and Plucker coordinates in type B, C, D

What connection does MS Office have to Netscape Navigator?

Chain wire methods together in Lightning Web Components

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?



Should I cite using beginthebibliography or beginfilecontents*



The Next CEO of Stack Overflowbiblatex in a nutshell (for beginners)bibtex vs. biber and biblatex vs. natbibQuestion mark or bold citation key instead of citation numberWhen I use the beginthebibliography command, I get it as a chapter. How can I get rid of that?How to reference properly when citations are grouped by sectionsthebibliography environment printing cite keyTwo bibliography using thebibliographyHow do I print out more than 200 citations in beginthebibliography … endthebibliographypdfmdfivesum error triggered by beginthebibliographyChange style of references when using beginthebibliographyShould I cite TikZ code?References: cite thebibliography not displayed as [number]?Remove bibliography title using thebibliographyThebibliographyMultiple bibliographies using BibTeX and thebibliography?










2















I am new to LaTeX and I need to create a list of references.



I browsed through this forum and couldn't find some uniform standard for doing references.



Many people are using, e.g, How to reference properly when citations are grouped by sections



beginfilecontents*

@articleA1,
keywords = articles,
title=First Paper,
author=Green,
journal=Journal 1,
note=based on citeC2,
year=2014



Others are using, e.g., When I use the beginthebibliography command, I get it as a chapter. How can I get rid of that?



beginthebibliography10
bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
endthebibliography


What is the form of citation that someone new to LaTeX should use?



And based on what criteria would one choose one method of citation over the other?










share|improve this question



















  • 2





    the filecontents version is a bibtex .bib file normally that would be edited as a separate file, sometimes people put it in filecontents to make a single file example to post here but there is no advantage to doing that in a real document. bibtex will take a .bib file and generate a bibliography enviornment like the one you show, so the two methods are not so different.

    – David Carlisle
    4 hours ago












  • @DavidCarlisle, may be you didn't notice the second method that is a bibliography created be beginthebibliography and not by using a .bib file. I would add that in the second method this kind of manual created method has the disadvantage thet you can't easy change its style by selecting another .bst (bibliography style) to customize your exported form .bib bibliography.

    – koleygr
    3 hours ago







  • 2





    @koleygr but to latex it is the same thing, all bibtex does is generate a thebibliography enviornment for you. I agree the OP should start by using bibtex and a bib file

    – David Carlisle
    3 hours ago












  • To comment on the question: the 'normal' way of creating a list of references (called 'bibliography') is to make a separate file with the references in it and run BibTeX or BibLaTeX on your document. See for example latex-tutorial.com/tutorials/bibtex.

    – Marijn
    3 hours ago











  • Ok @DavidCarlisle... Of course bibtex generates the .bbl that is like this ... I just wanted to add that by using bibtex you don't have to edit all your entries in order to change between usual styles of bibliography ... But of course (in some cases) even this way could be simpler if you don't know what to do with a complicated .bst file and/or you don't have the knowledge to change the bst file etc.

    – koleygr
    3 hours ago















2















I am new to LaTeX and I need to create a list of references.



I browsed through this forum and couldn't find some uniform standard for doing references.



Many people are using, e.g, How to reference properly when citations are grouped by sections



beginfilecontents*

@articleA1,
keywords = articles,
title=First Paper,
author=Green,
journal=Journal 1,
note=based on citeC2,
year=2014



Others are using, e.g., When I use the beginthebibliography command, I get it as a chapter. How can I get rid of that?



beginthebibliography10
bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
endthebibliography


What is the form of citation that someone new to LaTeX should use?



And based on what criteria would one choose one method of citation over the other?










share|improve this question



















  • 2





    the filecontents version is a bibtex .bib file normally that would be edited as a separate file, sometimes people put it in filecontents to make a single file example to post here but there is no advantage to doing that in a real document. bibtex will take a .bib file and generate a bibliography enviornment like the one you show, so the two methods are not so different.

    – David Carlisle
    4 hours ago












  • @DavidCarlisle, may be you didn't notice the second method that is a bibliography created be beginthebibliography and not by using a .bib file. I would add that in the second method this kind of manual created method has the disadvantage thet you can't easy change its style by selecting another .bst (bibliography style) to customize your exported form .bib bibliography.

    – koleygr
    3 hours ago







  • 2





    @koleygr but to latex it is the same thing, all bibtex does is generate a thebibliography enviornment for you. I agree the OP should start by using bibtex and a bib file

    – David Carlisle
    3 hours ago












  • To comment on the question: the 'normal' way of creating a list of references (called 'bibliography') is to make a separate file with the references in it and run BibTeX or BibLaTeX on your document. See for example latex-tutorial.com/tutorials/bibtex.

    – Marijn
    3 hours ago











  • Ok @DavidCarlisle... Of course bibtex generates the .bbl that is like this ... I just wanted to add that by using bibtex you don't have to edit all your entries in order to change between usual styles of bibliography ... But of course (in some cases) even this way could be simpler if you don't know what to do with a complicated .bst file and/or you don't have the knowledge to change the bst file etc.

    – koleygr
    3 hours ago













2












2








2








I am new to LaTeX and I need to create a list of references.



I browsed through this forum and couldn't find some uniform standard for doing references.



Many people are using, e.g, How to reference properly when citations are grouped by sections



beginfilecontents*

@articleA1,
keywords = articles,
title=First Paper,
author=Green,
journal=Journal 1,
note=based on citeC2,
year=2014



Others are using, e.g., When I use the beginthebibliography command, I get it as a chapter. How can I get rid of that?



beginthebibliography10
bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
endthebibliography


What is the form of citation that someone new to LaTeX should use?



And based on what criteria would one choose one method of citation over the other?










share|improve this question
















I am new to LaTeX and I need to create a list of references.



I browsed through this forum and couldn't find some uniform standard for doing references.



Many people are using, e.g, How to reference properly when citations are grouped by sections



beginfilecontents*

@articleA1,
keywords = articles,
title=First Paper,
author=Green,
journal=Journal 1,
note=based on citeC2,
year=2014



Others are using, e.g., When I use the beginthebibliography command, I get it as a chapter. How can I get rid of that?



beginthebibliography10
bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
endthebibliography


What is the form of citation that someone new to LaTeX should use?



And based on what criteria would one choose one method of citation over the other?







bibliographies






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 hours ago









Kurt

40.1k850164




40.1k850164










asked 4 hours ago









The man of your dreamThe man of your dream

1354




1354







  • 2





    the filecontents version is a bibtex .bib file normally that would be edited as a separate file, sometimes people put it in filecontents to make a single file example to post here but there is no advantage to doing that in a real document. bibtex will take a .bib file and generate a bibliography enviornment like the one you show, so the two methods are not so different.

    – David Carlisle
    4 hours ago












  • @DavidCarlisle, may be you didn't notice the second method that is a bibliography created be beginthebibliography and not by using a .bib file. I would add that in the second method this kind of manual created method has the disadvantage thet you can't easy change its style by selecting another .bst (bibliography style) to customize your exported form .bib bibliography.

    – koleygr
    3 hours ago







  • 2





    @koleygr but to latex it is the same thing, all bibtex does is generate a thebibliography enviornment for you. I agree the OP should start by using bibtex and a bib file

    – David Carlisle
    3 hours ago












  • To comment on the question: the 'normal' way of creating a list of references (called 'bibliography') is to make a separate file with the references in it and run BibTeX or BibLaTeX on your document. See for example latex-tutorial.com/tutorials/bibtex.

    – Marijn
    3 hours ago











  • Ok @DavidCarlisle... Of course bibtex generates the .bbl that is like this ... I just wanted to add that by using bibtex you don't have to edit all your entries in order to change between usual styles of bibliography ... But of course (in some cases) even this way could be simpler if you don't know what to do with a complicated .bst file and/or you don't have the knowledge to change the bst file etc.

    – koleygr
    3 hours ago












  • 2





    the filecontents version is a bibtex .bib file normally that would be edited as a separate file, sometimes people put it in filecontents to make a single file example to post here but there is no advantage to doing that in a real document. bibtex will take a .bib file and generate a bibliography enviornment like the one you show, so the two methods are not so different.

    – David Carlisle
    4 hours ago












  • @DavidCarlisle, may be you didn't notice the second method that is a bibliography created be beginthebibliography and not by using a .bib file. I would add that in the second method this kind of manual created method has the disadvantage thet you can't easy change its style by selecting another .bst (bibliography style) to customize your exported form .bib bibliography.

    – koleygr
    3 hours ago







  • 2





    @koleygr but to latex it is the same thing, all bibtex does is generate a thebibliography enviornment for you. I agree the OP should start by using bibtex and a bib file

    – David Carlisle
    3 hours ago












  • To comment on the question: the 'normal' way of creating a list of references (called 'bibliography') is to make a separate file with the references in it and run BibTeX or BibLaTeX on your document. See for example latex-tutorial.com/tutorials/bibtex.

    – Marijn
    3 hours ago











  • Ok @DavidCarlisle... Of course bibtex generates the .bbl that is like this ... I just wanted to add that by using bibtex you don't have to edit all your entries in order to change between usual styles of bibliography ... But of course (in some cases) even this way could be simpler if you don't know what to do with a complicated .bst file and/or you don't have the knowledge to change the bst file etc.

    – koleygr
    3 hours ago







2




2





the filecontents version is a bibtex .bib file normally that would be edited as a separate file, sometimes people put it in filecontents to make a single file example to post here but there is no advantage to doing that in a real document. bibtex will take a .bib file and generate a bibliography enviornment like the one you show, so the two methods are not so different.

– David Carlisle
4 hours ago






the filecontents version is a bibtex .bib file normally that would be edited as a separate file, sometimes people put it in filecontents to make a single file example to post here but there is no advantage to doing that in a real document. bibtex will take a .bib file and generate a bibliography enviornment like the one you show, so the two methods are not so different.

– David Carlisle
4 hours ago














@DavidCarlisle, may be you didn't notice the second method that is a bibliography created be beginthebibliography and not by using a .bib file. I would add that in the second method this kind of manual created method has the disadvantage thet you can't easy change its style by selecting another .bst (bibliography style) to customize your exported form .bib bibliography.

– koleygr
3 hours ago






@DavidCarlisle, may be you didn't notice the second method that is a bibliography created be beginthebibliography and not by using a .bib file. I would add that in the second method this kind of manual created method has the disadvantage thet you can't easy change its style by selecting another .bst (bibliography style) to customize your exported form .bib bibliography.

– koleygr
3 hours ago





2




2





@koleygr but to latex it is the same thing, all bibtex does is generate a thebibliography enviornment for you. I agree the OP should start by using bibtex and a bib file

– David Carlisle
3 hours ago






@koleygr but to latex it is the same thing, all bibtex does is generate a thebibliography enviornment for you. I agree the OP should start by using bibtex and a bib file

– David Carlisle
3 hours ago














To comment on the question: the 'normal' way of creating a list of references (called 'bibliography') is to make a separate file with the references in it and run BibTeX or BibLaTeX on your document. See for example latex-tutorial.com/tutorials/bibtex.

– Marijn
3 hours ago





To comment on the question: the 'normal' way of creating a list of references (called 'bibliography') is to make a separate file with the references in it and run BibTeX or BibLaTeX on your document. See for example latex-tutorial.com/tutorials/bibtex.

– Marijn
3 hours ago













Ok @DavidCarlisle... Of course bibtex generates the .bbl that is like this ... I just wanted to add that by using bibtex you don't have to edit all your entries in order to change between usual styles of bibliography ... But of course (in some cases) even this way could be simpler if you don't know what to do with a complicated .bst file and/or you don't have the knowledge to change the bst file etc.

– koleygr
3 hours ago





Ok @DavidCarlisle... Of course bibtex generates the .bbl that is like this ... I just wanted to add that by using bibtex you don't have to edit all your entries in order to change between usual styles of bibliography ... But of course (in some cases) even this way could be simpler if you don't know what to do with a complicated .bst file and/or you don't have the knowledge to change the bst file etc.

– koleygr
3 hours ago










2 Answers
2






active

oldest

votes


















2














For practical purposes the distinction that should be made is not between thebibliography on one side and filecontents on the other, but between thebibliography on one side and .bib files and BibTeX on the other.



In the bibliography context filecontents is usually only used to make example files self-contained and produce a .bib file for use with BibTeX. That is why you will find many mentions of it here, but in production use one would normally not use it. (I don't doubt that some people do, maybe because they find it more convenient, or maybe because they picked it up as a habit from various sites on the web.)



Manual thebibliography



thebibliography is the manual way to produce bibliographies in citations. All LaTeX offers you here is basically a way to produce a list of labelled entries that can be referenced with cite. thebibliography usually works like an enumerate list that uses bibitem[<optional label>]<entry key> instead of item[<optional label>] and automatically sets a label that you can refer to with cite (instead of ref). Everything else is left to you. You have to write and format the entire entry, you have to sort the list, you have to assign labels if you don't want to use a numbered citation style.



beginthebibliography2
bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
endthebibliography


Pros



  • The method is easy to get the hang of once you realise it is just a fancy enumerate.

  • You have full control over all details of the formatting and sorting of the entries.

  • No external programs are needed to compile the citations. It is enough to run LaTeX twice (or three times).

Cons



  • There is a chance of inconsistencies since you have to format all entries by hand.

  • It is time consuming to change the bibliography style, since you have to manually reformat every entry. (Suppose you want the name format Dower, John W. instead of John W. Dower in all of your entries. You'd have to invert each and every name manually.)

  • When you add new entries, you need to make sure to get the sorting order right. This is especially tricky if you want to sort your bibliography in citation order so that in your text the first work you cite is numbered [1], the second [2] and so forth. Every time you move around a few sentences with citations you run the risk of having to check your sort order.

  • In case your bibliography entries have context-dependent features like disambiguation letters for works by the same author from the same year (Sigfridsson 2000a and Sigfridsson 2000b), you need to manually calculate those features and keep track of them if anything changes.

For a handful bibliography entries with a straightforward bibliography style writing thebibliography manually is an option. But as soon as you plan on citing more works or want to be able to change the style easily or want to avoid inconsistencies other methods are usually better.




.bib files (BibTeX)



.bib files are a way to address many of the cons of a manual thebibliography by introducing another layer of abstraction and a middle man called BibTeX. .bib files contain the relevant bibliographic information of a work you want to cite in a systematic and machine-readable form.



@articlesigfridsson,
author = Sigfridsson, Emma and Ryde, Ulf,
title = Comparison of methods for deriving atomic charges from the
electrostatic potential and moments,
journal = Journal of Computational Chemistry,
year = 1998,
volume = 19,
number = 4,
pages = 377-395,
doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,



Instead of writing thebibliography manually you tell LaTeX about the bibliography style you would like to see your bibliography formatted in and BibTeX (a helper program, see Question mark or bold citation key instead of citation number) will produce the thebibliography environment for you (in the .bbl file), which LaTeX automatically reads and typesets.



Assuming your .bib file called mybibfile.bib contains the above entry, you could cite it and produce a bibliography in your document called mydoc.tex with



documentclassarticle

begindocument
citesigfridsson
bibliographystyleplain
bibliographymybibfile
enddocument


by running (at least) LaTeX, BibTeX, LaTeX, LaTeX (more precisely pdflatex mydoc, bibtex mydoc, pdflatex mydoc, pdflatex mydoc, assuming pdflatex is your preferred flavour of LaTeX) on that file.



Pros



  • All entries are automatically formatted according to a given style. Inconsistencies are less likely.

  • Changing the output style is as easy as selecting another bibliographystyle.

  • Sorting happens automatically.

  • Extra information can be calculated on the fly for you.

  • It is much easier to re-use entries from other documents by just copying them over. They way BibTeX works means that you can have .bib entries in your .bib file that you don't cite. That means that it is possible to have one master .bib file for several documents with different bibliographies.

Cons



  • You need an external program (BibTeX) and extra compilation steps (LaTeX, BibTeX, LaTeX, LaTeX instead of just LaTeX, LaTeX).

  • You need an external .bib file.

  • If you want to modify the format you need to learn to manipulate BibTeX styles (.bst files) with their reverse Polish notation.

  • You need to learn how to write .bib files and use the BibTeX ecosystem.


.bib files (biblatex)



There is actually another method that shares the same basic ideas of .bib files as the BibTeX approach: biblatex. From a user perspective the BibTeX method explained above and biblatex are not all that different: You have a .bib file, you have a few commands in your .tex file to tell LaTeX and its helper which bibliography style you want, you run an external program (with biblatex usually Biber instead of BibTeX, though biblatex also works with BibTeX as backend). But under the hood the two systems are very different. biblatex does not rely on thebibliography and completely reimplements all bibliographic and citation features. Its bibliography style programming language is not based on the reverse Polish notation from BibTeX, styles can be programmed directly in LaTeX.



To the intents and purposes of this comparison the pros and cons of biblatex and BibTeX vs thebibliography are roughly the same. A detailed comparison can be found in bibtex vs. biber and biblatex vs. natbib.



.bib files make sense if you have a larger bibliography and if you don't want to have to worry about consistency, formatting details and sorting. I usually recommend to use .bib files over manual thebibliography. Whether you want to use classical BibTeX or biblatex is a different matter (I'm biased towards biblatex, but there are reasons to prefer BibTeX over biblatex).




filecontents



As mentioned above filecontents is not really something that can be compared to thebibliography and the BibTeX or biblatex approach to bibliographies, it is just a way to produce external files from within a .tex document. mydoc.tex from above would then look like



documentclassarticle

usepackagefilecontents
beginfilecontentsjobname.bib
@articlesigfridsson,
author = Sigfridsson, Emma and Ryde, Ulf,
title = Comparison of methods for deriving atomic charges from the
electrostatic potential and moments,
journal = Journal of Computational Chemistry,
year = 1998,
volume = 19,
number = 4,
pages = 377-395,
doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,

endfilecontents

begindocument
citesigfridsson
bibliographystyleplain
bibliographyjobname
enddocument


You would run LaTeX, BibTeX, LaTeX, LaTeX on that file and that would produce a document with a citation and a bibliography. The interesting bit is that the first LaTeX run will produce the .bib file mydoc.bib that is then used as the bibliography database.




Further reading



This answer was meant as a short comparison between manual thebibliography and .bib files with BibTeX/biblatex. It does not want to be a tutorial or showcase of BibTeX.



There are many tutorials and beginner's guides out there for bibliographies with LaTeX. Some are very good, others not so much.



I think https://www.dickimaw-books.com/latex/novices/html/biblio.html and https://www.dickimaw-books.com/latex/thesis/html/citations.html are very good places to start for thebibliography and BibTeX/biblatex.



For biblatex there is biblatex in a nutshell (for beginners).






share|improve this answer

























  • Wow thats the longest reply I have ever seen. Thank you

    – The man of your dream
    41 mins ago


















1














Just to make it clear: In your given code is an relevant error (you missed to define the filename the given code should be stored in: mybibfile.bib), it should be:



beginfilecontents*mybibfile.bib

@articleA1,
keywords = articles,
title=First Paper,
author=Green,
journal=Journal 1,
note=based on citeC2,
year=2014



That simply means (check also the documentation of filecontents with texdoc filecontents) that the following tex code in an mwe (and only in an mwe, for your work you need not to use filecontents) has an line like



bibliographymybibfile 


for bibtex or



addbibresourcemybibfile.bib


for biblatex and biber.



For you you would have two files, one called mybibfile.bib (containing the bib entrys you need in your tex document mwe.tex):



@articleA1,
keywords = articles,
title=First Paper,
author=Green,
journal=Journal 1,
note=based on citeC2,
year=2014



In your file mwe.tex you use this bib file as showed above. In your text you have then somewhere citeA1 to reference this bib entry.



Do not write the bibliography by your own with adding



beginthebibliography10
bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
endthebibliography


into mwe.tex. That too much ends with ugly errors you can omit using a bib file.



So the following MWE



RequirePackagefilecontents
beginfilecontents*mybibfile.bib
@articleA1,
keywords = articles,
title = First Paper,
author = Green,
journal = Journal 1,
note = based on citeC2,
year = 2014,

@bookadams,
title = The Restaurant at the End of the Universe,
author = Douglas Adams,
series = The Hitchhiker's Guide to the Galaxy,
publisher = Pan Macmillan,
year = 1980,

endfilecontents*


documentclass[10pt,a4paper]article

begindocument

This is text with citeA1 and citeadams.

bibliographystyleunsrt
bibliographymybibfile

enddocument


is equivalent to the usage in reality of the bib file mybibfile.bib



@articleA1,
keywords = articles,
title = First Paper,
author = Green,
journal = Journal 1,
note = based on citeC2,
year = 2014,

@bookadams,
title = The Restaurant at the End of the Universe,
author = Douglas Adams,
series = The Hitchhiker's Guide to the Galaxy,
publisher = Pan Macmillan,
year = 1980,



and the tex code in file mwe.tex in the same directory:



documentclass[10pt,a4paper]article

begindocument

This is text with citeA1 and citeadams.

bibliographystyleunsrt
bibliographymybibfile

enddocument


Conclusion:



Please read an introduction into LaTeX and bibtex and using bib files!






share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "85"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482318%2fshould-i-cite-using-beginthebibliography-or-beginfilecontents%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    For practical purposes the distinction that should be made is not between thebibliography on one side and filecontents on the other, but between thebibliography on one side and .bib files and BibTeX on the other.



    In the bibliography context filecontents is usually only used to make example files self-contained and produce a .bib file for use with BibTeX. That is why you will find many mentions of it here, but in production use one would normally not use it. (I don't doubt that some people do, maybe because they find it more convenient, or maybe because they picked it up as a habit from various sites on the web.)



    Manual thebibliography



    thebibliography is the manual way to produce bibliographies in citations. All LaTeX offers you here is basically a way to produce a list of labelled entries that can be referenced with cite. thebibliography usually works like an enumerate list that uses bibitem[<optional label>]<entry key> instead of item[<optional label>] and automatically sets a label that you can refer to with cite (instead of ref). Everything else is left to you. You have to write and format the entire entry, you have to sort the list, you have to assign labels if you don't want to use a numbered citation style.



    beginthebibliography2
    bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
    bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
    endthebibliography


    Pros



    • The method is easy to get the hang of once you realise it is just a fancy enumerate.

    • You have full control over all details of the formatting and sorting of the entries.

    • No external programs are needed to compile the citations. It is enough to run LaTeX twice (or three times).

    Cons



    • There is a chance of inconsistencies since you have to format all entries by hand.

    • It is time consuming to change the bibliography style, since you have to manually reformat every entry. (Suppose you want the name format Dower, John W. instead of John W. Dower in all of your entries. You'd have to invert each and every name manually.)

    • When you add new entries, you need to make sure to get the sorting order right. This is especially tricky if you want to sort your bibliography in citation order so that in your text the first work you cite is numbered [1], the second [2] and so forth. Every time you move around a few sentences with citations you run the risk of having to check your sort order.

    • In case your bibliography entries have context-dependent features like disambiguation letters for works by the same author from the same year (Sigfridsson 2000a and Sigfridsson 2000b), you need to manually calculate those features and keep track of them if anything changes.

    For a handful bibliography entries with a straightforward bibliography style writing thebibliography manually is an option. But as soon as you plan on citing more works or want to be able to change the style easily or want to avoid inconsistencies other methods are usually better.




    .bib files (BibTeX)



    .bib files are a way to address many of the cons of a manual thebibliography by introducing another layer of abstraction and a middle man called BibTeX. .bib files contain the relevant bibliographic information of a work you want to cite in a systematic and machine-readable form.



    @articlesigfridsson,
    author = Sigfridsson, Emma and Ryde, Ulf,
    title = Comparison of methods for deriving atomic charges from the
    electrostatic potential and moments,
    journal = Journal of Computational Chemistry,
    year = 1998,
    volume = 19,
    number = 4,
    pages = 377-395,
    doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,



    Instead of writing thebibliography manually you tell LaTeX about the bibliography style you would like to see your bibliography formatted in and BibTeX (a helper program, see Question mark or bold citation key instead of citation number) will produce the thebibliography environment for you (in the .bbl file), which LaTeX automatically reads and typesets.



    Assuming your .bib file called mybibfile.bib contains the above entry, you could cite it and produce a bibliography in your document called mydoc.tex with



    documentclassarticle

    begindocument
    citesigfridsson
    bibliographystyleplain
    bibliographymybibfile
    enddocument


    by running (at least) LaTeX, BibTeX, LaTeX, LaTeX (more precisely pdflatex mydoc, bibtex mydoc, pdflatex mydoc, pdflatex mydoc, assuming pdflatex is your preferred flavour of LaTeX) on that file.



    Pros



    • All entries are automatically formatted according to a given style. Inconsistencies are less likely.

    • Changing the output style is as easy as selecting another bibliographystyle.

    • Sorting happens automatically.

    • Extra information can be calculated on the fly for you.

    • It is much easier to re-use entries from other documents by just copying them over. They way BibTeX works means that you can have .bib entries in your .bib file that you don't cite. That means that it is possible to have one master .bib file for several documents with different bibliographies.

    Cons



    • You need an external program (BibTeX) and extra compilation steps (LaTeX, BibTeX, LaTeX, LaTeX instead of just LaTeX, LaTeX).

    • You need an external .bib file.

    • If you want to modify the format you need to learn to manipulate BibTeX styles (.bst files) with their reverse Polish notation.

    • You need to learn how to write .bib files and use the BibTeX ecosystem.


    .bib files (biblatex)



    There is actually another method that shares the same basic ideas of .bib files as the BibTeX approach: biblatex. From a user perspective the BibTeX method explained above and biblatex are not all that different: You have a .bib file, you have a few commands in your .tex file to tell LaTeX and its helper which bibliography style you want, you run an external program (with biblatex usually Biber instead of BibTeX, though biblatex also works with BibTeX as backend). But under the hood the two systems are very different. biblatex does not rely on thebibliography and completely reimplements all bibliographic and citation features. Its bibliography style programming language is not based on the reverse Polish notation from BibTeX, styles can be programmed directly in LaTeX.



    To the intents and purposes of this comparison the pros and cons of biblatex and BibTeX vs thebibliography are roughly the same. A detailed comparison can be found in bibtex vs. biber and biblatex vs. natbib.



    .bib files make sense if you have a larger bibliography and if you don't want to have to worry about consistency, formatting details and sorting. I usually recommend to use .bib files over manual thebibliography. Whether you want to use classical BibTeX or biblatex is a different matter (I'm biased towards biblatex, but there are reasons to prefer BibTeX over biblatex).




    filecontents



    As mentioned above filecontents is not really something that can be compared to thebibliography and the BibTeX or biblatex approach to bibliographies, it is just a way to produce external files from within a .tex document. mydoc.tex from above would then look like



    documentclassarticle

    usepackagefilecontents
    beginfilecontentsjobname.bib
    @articlesigfridsson,
    author = Sigfridsson, Emma and Ryde, Ulf,
    title = Comparison of methods for deriving atomic charges from the
    electrostatic potential and moments,
    journal = Journal of Computational Chemistry,
    year = 1998,
    volume = 19,
    number = 4,
    pages = 377-395,
    doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,

    endfilecontents

    begindocument
    citesigfridsson
    bibliographystyleplain
    bibliographyjobname
    enddocument


    You would run LaTeX, BibTeX, LaTeX, LaTeX on that file and that would produce a document with a citation and a bibliography. The interesting bit is that the first LaTeX run will produce the .bib file mydoc.bib that is then used as the bibliography database.




    Further reading



    This answer was meant as a short comparison between manual thebibliography and .bib files with BibTeX/biblatex. It does not want to be a tutorial or showcase of BibTeX.



    There are many tutorials and beginner's guides out there for bibliographies with LaTeX. Some are very good, others not so much.



    I think https://www.dickimaw-books.com/latex/novices/html/biblio.html and https://www.dickimaw-books.com/latex/thesis/html/citations.html are very good places to start for thebibliography and BibTeX/biblatex.



    For biblatex there is biblatex in a nutshell (for beginners).






    share|improve this answer

























    • Wow thats the longest reply I have ever seen. Thank you

      – The man of your dream
      41 mins ago















    2














    For practical purposes the distinction that should be made is not between thebibliography on one side and filecontents on the other, but between thebibliography on one side and .bib files and BibTeX on the other.



    In the bibliography context filecontents is usually only used to make example files self-contained and produce a .bib file for use with BibTeX. That is why you will find many mentions of it here, but in production use one would normally not use it. (I don't doubt that some people do, maybe because they find it more convenient, or maybe because they picked it up as a habit from various sites on the web.)



    Manual thebibliography



    thebibliography is the manual way to produce bibliographies in citations. All LaTeX offers you here is basically a way to produce a list of labelled entries that can be referenced with cite. thebibliography usually works like an enumerate list that uses bibitem[<optional label>]<entry key> instead of item[<optional label>] and automatically sets a label that you can refer to with cite (instead of ref). Everything else is left to you. You have to write and format the entire entry, you have to sort the list, you have to assign labels if you don't want to use a numbered citation style.



    beginthebibliography2
    bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
    bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
    endthebibliography


    Pros



    • The method is easy to get the hang of once you realise it is just a fancy enumerate.

    • You have full control over all details of the formatting and sorting of the entries.

    • No external programs are needed to compile the citations. It is enough to run LaTeX twice (or three times).

    Cons



    • There is a chance of inconsistencies since you have to format all entries by hand.

    • It is time consuming to change the bibliography style, since you have to manually reformat every entry. (Suppose you want the name format Dower, John W. instead of John W. Dower in all of your entries. You'd have to invert each and every name manually.)

    • When you add new entries, you need to make sure to get the sorting order right. This is especially tricky if you want to sort your bibliography in citation order so that in your text the first work you cite is numbered [1], the second [2] and so forth. Every time you move around a few sentences with citations you run the risk of having to check your sort order.

    • In case your bibliography entries have context-dependent features like disambiguation letters for works by the same author from the same year (Sigfridsson 2000a and Sigfridsson 2000b), you need to manually calculate those features and keep track of them if anything changes.

    For a handful bibliography entries with a straightforward bibliography style writing thebibliography manually is an option. But as soon as you plan on citing more works or want to be able to change the style easily or want to avoid inconsistencies other methods are usually better.




    .bib files (BibTeX)



    .bib files are a way to address many of the cons of a manual thebibliography by introducing another layer of abstraction and a middle man called BibTeX. .bib files contain the relevant bibliographic information of a work you want to cite in a systematic and machine-readable form.



    @articlesigfridsson,
    author = Sigfridsson, Emma and Ryde, Ulf,
    title = Comparison of methods for deriving atomic charges from the
    electrostatic potential and moments,
    journal = Journal of Computational Chemistry,
    year = 1998,
    volume = 19,
    number = 4,
    pages = 377-395,
    doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,



    Instead of writing thebibliography manually you tell LaTeX about the bibliography style you would like to see your bibliography formatted in and BibTeX (a helper program, see Question mark or bold citation key instead of citation number) will produce the thebibliography environment for you (in the .bbl file), which LaTeX automatically reads and typesets.



    Assuming your .bib file called mybibfile.bib contains the above entry, you could cite it and produce a bibliography in your document called mydoc.tex with



    documentclassarticle

    begindocument
    citesigfridsson
    bibliographystyleplain
    bibliographymybibfile
    enddocument


    by running (at least) LaTeX, BibTeX, LaTeX, LaTeX (more precisely pdflatex mydoc, bibtex mydoc, pdflatex mydoc, pdflatex mydoc, assuming pdflatex is your preferred flavour of LaTeX) on that file.



    Pros



    • All entries are automatically formatted according to a given style. Inconsistencies are less likely.

    • Changing the output style is as easy as selecting another bibliographystyle.

    • Sorting happens automatically.

    • Extra information can be calculated on the fly for you.

    • It is much easier to re-use entries from other documents by just copying them over. They way BibTeX works means that you can have .bib entries in your .bib file that you don't cite. That means that it is possible to have one master .bib file for several documents with different bibliographies.

    Cons



    • You need an external program (BibTeX) and extra compilation steps (LaTeX, BibTeX, LaTeX, LaTeX instead of just LaTeX, LaTeX).

    • You need an external .bib file.

    • If you want to modify the format you need to learn to manipulate BibTeX styles (.bst files) with their reverse Polish notation.

    • You need to learn how to write .bib files and use the BibTeX ecosystem.


    .bib files (biblatex)



    There is actually another method that shares the same basic ideas of .bib files as the BibTeX approach: biblatex. From a user perspective the BibTeX method explained above and biblatex are not all that different: You have a .bib file, you have a few commands in your .tex file to tell LaTeX and its helper which bibliography style you want, you run an external program (with biblatex usually Biber instead of BibTeX, though biblatex also works with BibTeX as backend). But under the hood the two systems are very different. biblatex does not rely on thebibliography and completely reimplements all bibliographic and citation features. Its bibliography style programming language is not based on the reverse Polish notation from BibTeX, styles can be programmed directly in LaTeX.



    To the intents and purposes of this comparison the pros and cons of biblatex and BibTeX vs thebibliography are roughly the same. A detailed comparison can be found in bibtex vs. biber and biblatex vs. natbib.



    .bib files make sense if you have a larger bibliography and if you don't want to have to worry about consistency, formatting details and sorting. I usually recommend to use .bib files over manual thebibliography. Whether you want to use classical BibTeX or biblatex is a different matter (I'm biased towards biblatex, but there are reasons to prefer BibTeX over biblatex).




    filecontents



    As mentioned above filecontents is not really something that can be compared to thebibliography and the BibTeX or biblatex approach to bibliographies, it is just a way to produce external files from within a .tex document. mydoc.tex from above would then look like



    documentclassarticle

    usepackagefilecontents
    beginfilecontentsjobname.bib
    @articlesigfridsson,
    author = Sigfridsson, Emma and Ryde, Ulf,
    title = Comparison of methods for deriving atomic charges from the
    electrostatic potential and moments,
    journal = Journal of Computational Chemistry,
    year = 1998,
    volume = 19,
    number = 4,
    pages = 377-395,
    doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,

    endfilecontents

    begindocument
    citesigfridsson
    bibliographystyleplain
    bibliographyjobname
    enddocument


    You would run LaTeX, BibTeX, LaTeX, LaTeX on that file and that would produce a document with a citation and a bibliography. The interesting bit is that the first LaTeX run will produce the .bib file mydoc.bib that is then used as the bibliography database.




    Further reading



    This answer was meant as a short comparison between manual thebibliography and .bib files with BibTeX/biblatex. It does not want to be a tutorial or showcase of BibTeX.



    There are many tutorials and beginner's guides out there for bibliographies with LaTeX. Some are very good, others not so much.



    I think https://www.dickimaw-books.com/latex/novices/html/biblio.html and https://www.dickimaw-books.com/latex/thesis/html/citations.html are very good places to start for thebibliography and BibTeX/biblatex.



    For biblatex there is biblatex in a nutshell (for beginners).






    share|improve this answer

























    • Wow thats the longest reply I have ever seen. Thank you

      – The man of your dream
      41 mins ago













    2












    2








    2







    For practical purposes the distinction that should be made is not between thebibliography on one side and filecontents on the other, but between thebibliography on one side and .bib files and BibTeX on the other.



    In the bibliography context filecontents is usually only used to make example files self-contained and produce a .bib file for use with BibTeX. That is why you will find many mentions of it here, but in production use one would normally not use it. (I don't doubt that some people do, maybe because they find it more convenient, or maybe because they picked it up as a habit from various sites on the web.)



    Manual thebibliography



    thebibliography is the manual way to produce bibliographies in citations. All LaTeX offers you here is basically a way to produce a list of labelled entries that can be referenced with cite. thebibliography usually works like an enumerate list that uses bibitem[<optional label>]<entry key> instead of item[<optional label>] and automatically sets a label that you can refer to with cite (instead of ref). Everything else is left to you. You have to write and format the entire entry, you have to sort the list, you have to assign labels if you don't want to use a numbered citation style.



    beginthebibliography2
    bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
    bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
    endthebibliography


    Pros



    • The method is easy to get the hang of once you realise it is just a fancy enumerate.

    • You have full control over all details of the formatting and sorting of the entries.

    • No external programs are needed to compile the citations. It is enough to run LaTeX twice (or three times).

    Cons



    • There is a chance of inconsistencies since you have to format all entries by hand.

    • It is time consuming to change the bibliography style, since you have to manually reformat every entry. (Suppose you want the name format Dower, John W. instead of John W. Dower in all of your entries. You'd have to invert each and every name manually.)

    • When you add new entries, you need to make sure to get the sorting order right. This is especially tricky if you want to sort your bibliography in citation order so that in your text the first work you cite is numbered [1], the second [2] and so forth. Every time you move around a few sentences with citations you run the risk of having to check your sort order.

    • In case your bibliography entries have context-dependent features like disambiguation letters for works by the same author from the same year (Sigfridsson 2000a and Sigfridsson 2000b), you need to manually calculate those features and keep track of them if anything changes.

    For a handful bibliography entries with a straightforward bibliography style writing thebibliography manually is an option. But as soon as you plan on citing more works or want to be able to change the style easily or want to avoid inconsistencies other methods are usually better.




    .bib files (BibTeX)



    .bib files are a way to address many of the cons of a manual thebibliography by introducing another layer of abstraction and a middle man called BibTeX. .bib files contain the relevant bibliographic information of a work you want to cite in a systematic and machine-readable form.



    @articlesigfridsson,
    author = Sigfridsson, Emma and Ryde, Ulf,
    title = Comparison of methods for deriving atomic charges from the
    electrostatic potential and moments,
    journal = Journal of Computational Chemistry,
    year = 1998,
    volume = 19,
    number = 4,
    pages = 377-395,
    doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,



    Instead of writing thebibliography manually you tell LaTeX about the bibliography style you would like to see your bibliography formatted in and BibTeX (a helper program, see Question mark or bold citation key instead of citation number) will produce the thebibliography environment for you (in the .bbl file), which LaTeX automatically reads and typesets.



    Assuming your .bib file called mybibfile.bib contains the above entry, you could cite it and produce a bibliography in your document called mydoc.tex with



    documentclassarticle

    begindocument
    citesigfridsson
    bibliographystyleplain
    bibliographymybibfile
    enddocument


    by running (at least) LaTeX, BibTeX, LaTeX, LaTeX (more precisely pdflatex mydoc, bibtex mydoc, pdflatex mydoc, pdflatex mydoc, assuming pdflatex is your preferred flavour of LaTeX) on that file.



    Pros



    • All entries are automatically formatted according to a given style. Inconsistencies are less likely.

    • Changing the output style is as easy as selecting another bibliographystyle.

    • Sorting happens automatically.

    • Extra information can be calculated on the fly for you.

    • It is much easier to re-use entries from other documents by just copying them over. They way BibTeX works means that you can have .bib entries in your .bib file that you don't cite. That means that it is possible to have one master .bib file for several documents with different bibliographies.

    Cons



    • You need an external program (BibTeX) and extra compilation steps (LaTeX, BibTeX, LaTeX, LaTeX instead of just LaTeX, LaTeX).

    • You need an external .bib file.

    • If you want to modify the format you need to learn to manipulate BibTeX styles (.bst files) with their reverse Polish notation.

    • You need to learn how to write .bib files and use the BibTeX ecosystem.


    .bib files (biblatex)



    There is actually another method that shares the same basic ideas of .bib files as the BibTeX approach: biblatex. From a user perspective the BibTeX method explained above and biblatex are not all that different: You have a .bib file, you have a few commands in your .tex file to tell LaTeX and its helper which bibliography style you want, you run an external program (with biblatex usually Biber instead of BibTeX, though biblatex also works with BibTeX as backend). But under the hood the two systems are very different. biblatex does not rely on thebibliography and completely reimplements all bibliographic and citation features. Its bibliography style programming language is not based on the reverse Polish notation from BibTeX, styles can be programmed directly in LaTeX.



    To the intents and purposes of this comparison the pros and cons of biblatex and BibTeX vs thebibliography are roughly the same. A detailed comparison can be found in bibtex vs. biber and biblatex vs. natbib.



    .bib files make sense if you have a larger bibliography and if you don't want to have to worry about consistency, formatting details and sorting. I usually recommend to use .bib files over manual thebibliography. Whether you want to use classical BibTeX or biblatex is a different matter (I'm biased towards biblatex, but there are reasons to prefer BibTeX over biblatex).




    filecontents



    As mentioned above filecontents is not really something that can be compared to thebibliography and the BibTeX or biblatex approach to bibliographies, it is just a way to produce external files from within a .tex document. mydoc.tex from above would then look like



    documentclassarticle

    usepackagefilecontents
    beginfilecontentsjobname.bib
    @articlesigfridsson,
    author = Sigfridsson, Emma and Ryde, Ulf,
    title = Comparison of methods for deriving atomic charges from the
    electrostatic potential and moments,
    journal = Journal of Computational Chemistry,
    year = 1998,
    volume = 19,
    number = 4,
    pages = 377-395,
    doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,

    endfilecontents

    begindocument
    citesigfridsson
    bibliographystyleplain
    bibliographyjobname
    enddocument


    You would run LaTeX, BibTeX, LaTeX, LaTeX on that file and that would produce a document with a citation and a bibliography. The interesting bit is that the first LaTeX run will produce the .bib file mydoc.bib that is then used as the bibliography database.




    Further reading



    This answer was meant as a short comparison between manual thebibliography and .bib files with BibTeX/biblatex. It does not want to be a tutorial or showcase of BibTeX.



    There are many tutorials and beginner's guides out there for bibliographies with LaTeX. Some are very good, others not so much.



    I think https://www.dickimaw-books.com/latex/novices/html/biblio.html and https://www.dickimaw-books.com/latex/thesis/html/citations.html are very good places to start for thebibliography and BibTeX/biblatex.



    For biblatex there is biblatex in a nutshell (for beginners).






    share|improve this answer















    For practical purposes the distinction that should be made is not between thebibliography on one side and filecontents on the other, but between thebibliography on one side and .bib files and BibTeX on the other.



    In the bibliography context filecontents is usually only used to make example files self-contained and produce a .bib file for use with BibTeX. That is why you will find many mentions of it here, but in production use one would normally not use it. (I don't doubt that some people do, maybe because they find it more convenient, or maybe because they picked it up as a habit from various sites on the web.)



    Manual thebibliography



    thebibliography is the manual way to produce bibliographies in citations. All LaTeX offers you here is basically a way to produce a list of labelled entries that can be referenced with cite. thebibliography usually works like an enumerate list that uses bibitem[<optional label>]<entry key> instead of item[<optional label>] and automatically sets a label that you can refer to with cite (instead of ref). Everything else is left to you. You have to write and format the entire entry, you have to sort the list, you have to assign labels if you don't want to use a numbered citation style.



    beginthebibliography2
    bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
    bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
    endthebibliography


    Pros



    • The method is easy to get the hang of once you realise it is just a fancy enumerate.

    • You have full control over all details of the formatting and sorting of the entries.

    • No external programs are needed to compile the citations. It is enough to run LaTeX twice (or three times).

    Cons



    • There is a chance of inconsistencies since you have to format all entries by hand.

    • It is time consuming to change the bibliography style, since you have to manually reformat every entry. (Suppose you want the name format Dower, John W. instead of John W. Dower in all of your entries. You'd have to invert each and every name manually.)

    • When you add new entries, you need to make sure to get the sorting order right. This is especially tricky if you want to sort your bibliography in citation order so that in your text the first work you cite is numbered [1], the second [2] and so forth. Every time you move around a few sentences with citations you run the risk of having to check your sort order.

    • In case your bibliography entries have context-dependent features like disambiguation letters for works by the same author from the same year (Sigfridsson 2000a and Sigfridsson 2000b), you need to manually calculate those features and keep track of them if anything changes.

    For a handful bibliography entries with a straightforward bibliography style writing thebibliography manually is an option. But as soon as you plan on citing more works or want to be able to change the style easily or want to avoid inconsistencies other methods are usually better.




    .bib files (BibTeX)



    .bib files are a way to address many of the cons of a manual thebibliography by introducing another layer of abstraction and a middle man called BibTeX. .bib files contain the relevant bibliographic information of a work you want to cite in a systematic and machine-readable form.



    @articlesigfridsson,
    author = Sigfridsson, Emma and Ryde, Ulf,
    title = Comparison of methods for deriving atomic charges from the
    electrostatic potential and moments,
    journal = Journal of Computational Chemistry,
    year = 1998,
    volume = 19,
    number = 4,
    pages = 377-395,
    doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,



    Instead of writing thebibliography manually you tell LaTeX about the bibliography style you would like to see your bibliography formatted in and BibTeX (a helper program, see Question mark or bold citation key instead of citation number) will produce the thebibliography environment for you (in the .bbl file), which LaTeX automatically reads and typesets.



    Assuming your .bib file called mybibfile.bib contains the above entry, you could cite it and produce a bibliography in your document called mydoc.tex with



    documentclassarticle

    begindocument
    citesigfridsson
    bibliographystyleplain
    bibliographymybibfile
    enddocument


    by running (at least) LaTeX, BibTeX, LaTeX, LaTeX (more precisely pdflatex mydoc, bibtex mydoc, pdflatex mydoc, pdflatex mydoc, assuming pdflatex is your preferred flavour of LaTeX) on that file.



    Pros



    • All entries are automatically formatted according to a given style. Inconsistencies are less likely.

    • Changing the output style is as easy as selecting another bibliographystyle.

    • Sorting happens automatically.

    • Extra information can be calculated on the fly for you.

    • It is much easier to re-use entries from other documents by just copying them over. They way BibTeX works means that you can have .bib entries in your .bib file that you don't cite. That means that it is possible to have one master .bib file for several documents with different bibliographies.

    Cons



    • You need an external program (BibTeX) and extra compilation steps (LaTeX, BibTeX, LaTeX, LaTeX instead of just LaTeX, LaTeX).

    • You need an external .bib file.

    • If you want to modify the format you need to learn to manipulate BibTeX styles (.bst files) with their reverse Polish notation.

    • You need to learn how to write .bib files and use the BibTeX ecosystem.


    .bib files (biblatex)



    There is actually another method that shares the same basic ideas of .bib files as the BibTeX approach: biblatex. From a user perspective the BibTeX method explained above and biblatex are not all that different: You have a .bib file, you have a few commands in your .tex file to tell LaTeX and its helper which bibliography style you want, you run an external program (with biblatex usually Biber instead of BibTeX, though biblatex also works with BibTeX as backend). But under the hood the two systems are very different. biblatex does not rely on thebibliography and completely reimplements all bibliographic and citation features. Its bibliography style programming language is not based on the reverse Polish notation from BibTeX, styles can be programmed directly in LaTeX.



    To the intents and purposes of this comparison the pros and cons of biblatex and BibTeX vs thebibliography are roughly the same. A detailed comparison can be found in bibtex vs. biber and biblatex vs. natbib.



    .bib files make sense if you have a larger bibliography and if you don't want to have to worry about consistency, formatting details and sorting. I usually recommend to use .bib files over manual thebibliography. Whether you want to use classical BibTeX or biblatex is a different matter (I'm biased towards biblatex, but there are reasons to prefer BibTeX over biblatex).




    filecontents



    As mentioned above filecontents is not really something that can be compared to thebibliography and the BibTeX or biblatex approach to bibliographies, it is just a way to produce external files from within a .tex document. mydoc.tex from above would then look like



    documentclassarticle

    usepackagefilecontents
    beginfilecontentsjobname.bib
    @articlesigfridsson,
    author = Sigfridsson, Emma and Ryde, Ulf,
    title = Comparison of methods for deriving atomic charges from the
    electrostatic potential and moments,
    journal = Journal of Computational Chemistry,
    year = 1998,
    volume = 19,
    number = 4,
    pages = 377-395,
    doi = 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P,

    endfilecontents

    begindocument
    citesigfridsson
    bibliographystyleplain
    bibliographyjobname
    enddocument


    You would run LaTeX, BibTeX, LaTeX, LaTeX on that file and that would produce a document with a citation and a bibliography. The interesting bit is that the first LaTeX run will produce the .bib file mydoc.bib that is then used as the bibliography database.




    Further reading



    This answer was meant as a short comparison between manual thebibliography and .bib files with BibTeX/biblatex. It does not want to be a tutorial or showcase of BibTeX.



    There are many tutorials and beginner's guides out there for bibliographies with LaTeX. Some are very good, others not so much.



    I think https://www.dickimaw-books.com/latex/novices/html/biblio.html and https://www.dickimaw-books.com/latex/thesis/html/citations.html are very good places to start for thebibliography and BibTeX/biblatex.



    For biblatex there is biblatex in a nutshell (for beginners).







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 2 hours ago

























    answered 2 hours ago









    moewemoewe

    95.6k10116358




    95.6k10116358












    • Wow thats the longest reply I have ever seen. Thank you

      – The man of your dream
      41 mins ago

















    • Wow thats the longest reply I have ever seen. Thank you

      – The man of your dream
      41 mins ago
















    Wow thats the longest reply I have ever seen. Thank you

    – The man of your dream
    41 mins ago





    Wow thats the longest reply I have ever seen. Thank you

    – The man of your dream
    41 mins ago











    1














    Just to make it clear: In your given code is an relevant error (you missed to define the filename the given code should be stored in: mybibfile.bib), it should be:



    beginfilecontents*mybibfile.bib

    @articleA1,
    keywords = articles,
    title=First Paper,
    author=Green,
    journal=Journal 1,
    note=based on citeC2,
    year=2014



    That simply means (check also the documentation of filecontents with texdoc filecontents) that the following tex code in an mwe (and only in an mwe, for your work you need not to use filecontents) has an line like



    bibliographymybibfile 


    for bibtex or



    addbibresourcemybibfile.bib


    for biblatex and biber.



    For you you would have two files, one called mybibfile.bib (containing the bib entrys you need in your tex document mwe.tex):



    @articleA1,
    keywords = articles,
    title=First Paper,
    author=Green,
    journal=Journal 1,
    note=based on citeC2,
    year=2014



    In your file mwe.tex you use this bib file as showed above. In your text you have then somewhere citeA1 to reference this bib entry.



    Do not write the bibliography by your own with adding



    beginthebibliography10
    bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
    bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
    endthebibliography


    into mwe.tex. That too much ends with ugly errors you can omit using a bib file.



    So the following MWE



    RequirePackagefilecontents
    beginfilecontents*mybibfile.bib
    @articleA1,
    keywords = articles,
    title = First Paper,
    author = Green,
    journal = Journal 1,
    note = based on citeC2,
    year = 2014,

    @bookadams,
    title = The Restaurant at the End of the Universe,
    author = Douglas Adams,
    series = The Hitchhiker's Guide to the Galaxy,
    publisher = Pan Macmillan,
    year = 1980,

    endfilecontents*


    documentclass[10pt,a4paper]article

    begindocument

    This is text with citeA1 and citeadams.

    bibliographystyleunsrt
    bibliographymybibfile

    enddocument


    is equivalent to the usage in reality of the bib file mybibfile.bib



    @articleA1,
    keywords = articles,
    title = First Paper,
    author = Green,
    journal = Journal 1,
    note = based on citeC2,
    year = 2014,

    @bookadams,
    title = The Restaurant at the End of the Universe,
    author = Douglas Adams,
    series = The Hitchhiker's Guide to the Galaxy,
    publisher = Pan Macmillan,
    year = 1980,



    and the tex code in file mwe.tex in the same directory:



    documentclass[10pt,a4paper]article

    begindocument

    This is text with citeA1 and citeadams.

    bibliographystyleunsrt
    bibliographymybibfile

    enddocument


    Conclusion:



    Please read an introduction into LaTeX and bibtex and using bib files!






    share|improve this answer





























      1














      Just to make it clear: In your given code is an relevant error (you missed to define the filename the given code should be stored in: mybibfile.bib), it should be:



      beginfilecontents*mybibfile.bib

      @articleA1,
      keywords = articles,
      title=First Paper,
      author=Green,
      journal=Journal 1,
      note=based on citeC2,
      year=2014



      That simply means (check also the documentation of filecontents with texdoc filecontents) that the following tex code in an mwe (and only in an mwe, for your work you need not to use filecontents) has an line like



      bibliographymybibfile 


      for bibtex or



      addbibresourcemybibfile.bib


      for biblatex and biber.



      For you you would have two files, one called mybibfile.bib (containing the bib entrys you need in your tex document mwe.tex):



      @articleA1,
      keywords = articles,
      title=First Paper,
      author=Green,
      journal=Journal 1,
      note=based on citeC2,
      year=2014



      In your file mwe.tex you use this bib file as showed above. In your text you have then somewhere citeA1 to reference this bib entry.



      Do not write the bibliography by your own with adding



      beginthebibliography10
      bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
      bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
      endthebibliography


      into mwe.tex. That too much ends with ugly errors you can omit using a bib file.



      So the following MWE



      RequirePackagefilecontents
      beginfilecontents*mybibfile.bib
      @articleA1,
      keywords = articles,
      title = First Paper,
      author = Green,
      journal = Journal 1,
      note = based on citeC2,
      year = 2014,

      @bookadams,
      title = The Restaurant at the End of the Universe,
      author = Douglas Adams,
      series = The Hitchhiker's Guide to the Galaxy,
      publisher = Pan Macmillan,
      year = 1980,

      endfilecontents*


      documentclass[10pt,a4paper]article

      begindocument

      This is text with citeA1 and citeadams.

      bibliographystyleunsrt
      bibliographymybibfile

      enddocument


      is equivalent to the usage in reality of the bib file mybibfile.bib



      @articleA1,
      keywords = articles,
      title = First Paper,
      author = Green,
      journal = Journal 1,
      note = based on citeC2,
      year = 2014,

      @bookadams,
      title = The Restaurant at the End of the Universe,
      author = Douglas Adams,
      series = The Hitchhiker's Guide to the Galaxy,
      publisher = Pan Macmillan,
      year = 1980,



      and the tex code in file mwe.tex in the same directory:



      documentclass[10pt,a4paper]article

      begindocument

      This is text with citeA1 and citeadams.

      bibliographystyleunsrt
      bibliographymybibfile

      enddocument


      Conclusion:



      Please read an introduction into LaTeX and bibtex and using bib files!






      share|improve this answer



























        1












        1








        1







        Just to make it clear: In your given code is an relevant error (you missed to define the filename the given code should be stored in: mybibfile.bib), it should be:



        beginfilecontents*mybibfile.bib

        @articleA1,
        keywords = articles,
        title=First Paper,
        author=Green,
        journal=Journal 1,
        note=based on citeC2,
        year=2014



        That simply means (check also the documentation of filecontents with texdoc filecontents) that the following tex code in an mwe (and only in an mwe, for your work you need not to use filecontents) has an line like



        bibliographymybibfile 


        for bibtex or



        addbibresourcemybibfile.bib


        for biblatex and biber.



        For you you would have two files, one called mybibfile.bib (containing the bib entrys you need in your tex document mwe.tex):



        @articleA1,
        keywords = articles,
        title=First Paper,
        author=Green,
        journal=Journal 1,
        note=based on citeC2,
        year=2014



        In your file mwe.tex you use this bib file as showed above. In your text you have then somewhere citeA1 to reference this bib entry.



        Do not write the bibliography by your own with adding



        beginthebibliography10
        bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
        bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
        endthebibliography


        into mwe.tex. That too much ends with ugly errors you can omit using a bib file.



        So the following MWE



        RequirePackagefilecontents
        beginfilecontents*mybibfile.bib
        @articleA1,
        keywords = articles,
        title = First Paper,
        author = Green,
        journal = Journal 1,
        note = based on citeC2,
        year = 2014,

        @bookadams,
        title = The Restaurant at the End of the Universe,
        author = Douglas Adams,
        series = The Hitchhiker's Guide to the Galaxy,
        publisher = Pan Macmillan,
        year = 1980,

        endfilecontents*


        documentclass[10pt,a4paper]article

        begindocument

        This is text with citeA1 and citeadams.

        bibliographystyleunsrt
        bibliographymybibfile

        enddocument


        is equivalent to the usage in reality of the bib file mybibfile.bib



        @articleA1,
        keywords = articles,
        title = First Paper,
        author = Green,
        journal = Journal 1,
        note = based on citeC2,
        year = 2014,

        @bookadams,
        title = The Restaurant at the End of the Universe,
        author = Douglas Adams,
        series = The Hitchhiker's Guide to the Galaxy,
        publisher = Pan Macmillan,
        year = 1980,



        and the tex code in file mwe.tex in the same directory:



        documentclass[10pt,a4paper]article

        begindocument

        This is text with citeA1 and citeadams.

        bibliographystyleunsrt
        bibliographymybibfile

        enddocument


        Conclusion:



        Please read an introduction into LaTeX and bibtex and using bib files!






        share|improve this answer















        Just to make it clear: In your given code is an relevant error (you missed to define the filename the given code should be stored in: mybibfile.bib), it should be:



        beginfilecontents*mybibfile.bib

        @articleA1,
        keywords = articles,
        title=First Paper,
        author=Green,
        journal=Journal 1,
        note=based on citeC2,
        year=2014



        That simply means (check also the documentation of filecontents with texdoc filecontents) that the following tex code in an mwe (and only in an mwe, for your work you need not to use filecontents) has an line like



        bibliographymybibfile 


        for bibtex or



        addbibresourcemybibfile.bib


        for biblatex and biber.



        For you you would have two files, one called mybibfile.bib (containing the bib entrys you need in your tex document mwe.tex):



        @articleA1,
        keywords = articles,
        title=First Paper,
        author=Green,
        journal=Journal 1,
        note=based on citeC2,
        year=2014



        In your file mwe.tex you use this bib file as showed above. In your text you have then somewhere citeA1 to reference this bib entry.



        Do not write the bibliography by your own with adding



        beginthebibliography10
        bibitemnotes John W. Dower emphReadings compiled for History 21.479. 1991.
        bibitemimpj The Japan Reader emphImperial Japan 1800-1945 1973: Random House, N.Y.
        endthebibliography


        into mwe.tex. That too much ends with ugly errors you can omit using a bib file.



        So the following MWE



        RequirePackagefilecontents
        beginfilecontents*mybibfile.bib
        @articleA1,
        keywords = articles,
        title = First Paper,
        author = Green,
        journal = Journal 1,
        note = based on citeC2,
        year = 2014,

        @bookadams,
        title = The Restaurant at the End of the Universe,
        author = Douglas Adams,
        series = The Hitchhiker's Guide to the Galaxy,
        publisher = Pan Macmillan,
        year = 1980,

        endfilecontents*


        documentclass[10pt,a4paper]article

        begindocument

        This is text with citeA1 and citeadams.

        bibliographystyleunsrt
        bibliographymybibfile

        enddocument


        is equivalent to the usage in reality of the bib file mybibfile.bib



        @articleA1,
        keywords = articles,
        title = First Paper,
        author = Green,
        journal = Journal 1,
        note = based on citeC2,
        year = 2014,

        @bookadams,
        title = The Restaurant at the End of the Universe,
        author = Douglas Adams,
        series = The Hitchhiker's Guide to the Galaxy,
        publisher = Pan Macmillan,
        year = 1980,



        and the tex code in file mwe.tex in the same directory:



        documentclass[10pt,a4paper]article

        begindocument

        This is text with citeA1 and citeadams.

        bibliographystyleunsrt
        bibliographymybibfile

        enddocument


        Conclusion:



        Please read an introduction into LaTeX and bibtex and using bib files!







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 hours ago

























        answered 3 hours ago









        KurtKurt

        40.1k850164




        40.1k850164



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482318%2fshould-i-cite-using-beginthebibliography-or-beginfilecontents%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            名間水力發電廠 目录 沿革 設施 鄰近設施 註釋 外部連結 导航菜单23°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.7113923°50′10″N 120°42′41″E / 23.83611°N 120.71139°E / 23.83611; 120.71139計畫概要原始内容臺灣第一座BOT 模式開發的水力發電廠-名間水力電廠名間水力發電廠 水利署首件BOT案原始内容《小檔案》名間電廠 首座BOT水力發電廠原始内容名間電廠BOT - 經濟部水利署中區水資源局

            Prove that NP is closed under karp reduction?Space(n) not closed under Karp reductions - what about NTime(n)?Class P is closed under rotation?Prove or disprove that $NL$ is closed under polynomial many-one reductions$mathbfNC_2$ is closed under log-space reductionOn Karp reductionwhen can I know if a class (complexity) is closed under reduction (cook/karp)Check if class $PSPACE$ is closed under polyonomially space reductionIs NPSPACE also closed under polynomial-time reduction and under log-space reduction?Prove PSPACE is closed under complement?Prove PSPACE is closed under union?

            Is my guitar’s action too high? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Strings too stiff on a recently purchased acoustic guitar | Cort AD880CEIs the action of my guitar really high?Μy little finger is too weak to play guitarWith guitar, how long should I give my fingers to strengthen / callous?When playing a fret the guitar sounds mutedPlaying (Barre) chords up the guitar neckI think my guitar strings are wound too tight and I can't play barre chordsF barre chord on an SG guitarHow to find to the right strings of a barre chord by feel?High action on higher fret on my steel acoustic guitar