by Thomas Mejtoft, PhD
This page have some tips and trix on how to use BibTeX and how to write citations to references in the text.
Even though these things are general, I recommend using BibTeX with Overleaf when writing.
When compiling your paper, do not forget to read through the output of the reference list to see that everything in the output of the reference list looks like it should and make sense! This is even more important for reference entries you have entered yourself and not exported from a publisher, database etc. As a reader, you should be able to find the reference based on the reference list in the paper.
Below are some tips and tricks on using BibTeX to organize your reference when writing in LaTeX.
Hope you find this material useful!
If you are looking for other resources around writing to use, here is a page with resources and material. If you are looking for how to use and cite figures, screenshots, code etc. please refer to the following documents: How to use and cite figures from other sources, How to cite screenshots, References to secondary sources and review articles, Writing references to personal communication, Writing references to programming code, and Citing content created by generative AI. Regarding quotes and visualizing data, please read the following documents: Master quotes in writing and How to visualize your data in an understandable way.
Setting up BibTeX and defining the output style
There are two commands that are necessary to use to get BibTeX to work in the first place.
\bibliographystyle{<style>}
\bibliography{<bibliography_file.bib>}
example:
\bibliographystyle{apacite}
\bibliography{references.bib}
The bibliography styles are determined by a .bst file (e.g., apacite.bst). However, most of the commons ones are included in e.g., Overleaf. There are a few different bibliography styles that might be of interest.
\bibliographystyle{apacite} % APA style, i.e., a name and year system
\bibliographystyle{IEEEtran} % IEEE, i.e., a number and bracket system
\bibliographystyle{ACM-Reference-Format} % ACM, i.e., a number and bracket system
Observe that the style is case-sensitive (must be the same as the filename of the .bst file)
Citing references in text and ‘natbib’ package
For citation in text, it is possible to use the cite-command in LaTeX. When using \cite{...}
, one or more references can be put into one citation. If you want to cite several sources at the same location in the text, separate them using a ,
(comma) within the same cite-command (other commands described below using natbib
also supports this feature).
\cite{REF_1} % Citing one source
\cite{REF_1,REF_2,REF_3,...}. % Citing several sources at the same location
Example
LaTeX code:
Previous research \cite{Mejtoft:2007,Svengelson:2018} show that everything is possible to achieve. However, this does not include flying a kite \cite{Mejtoft:2020}.
BibTeX entries (examples):
@article{Mejtoft:2007,
...
}
@book{Svengelson:2018,
...
}
@inproceedings{Mejtoft:2020,
...
}
Output (bibliographystyle: apacite):
Previous research (Mejtoft, 2007; Svengelson, 2018) show that everything is possible to achieve. However, this does not include flying a kite (Mejtoft, 2020).
Output (bibliographystyle: ACM-Reference-Format):
Previous research [23, 45] show that everything is possible to achieve. However, this does not include flying a kite [34].
For references, especially when writing using a (name, year) system (e.g., APA Style), there are some help you can get from the bibliography management add-on ‘natbib
‘ and its citation styles. Observe that there are alternatives to the commands below when there are several authors on a publication (by using an asterisk*
).
\usepackage{natbib} % Parenthetical citation
\usepackage[numbers]{natbib} % Numerical citation
...
\citep{REF_1} % Parenthetical, or bracket, citation, e.g., "(Mejtoft, 2009)" or "[3]"
\citep*{REF_1} % Parenthetical citation with all authors printed in the text
\citet{REF_1} % Textual citation, e.g., "Mejtoft (2009)" or "Mejtoft [3]"
\citet*{REF_1} % Textual citation with all authors printed in the text
\citeauthor{REF_1} % Only the name of author(s) in citation, e.g., "Mejtoft"
\citeyear{REF_1} % Only the year of publication in citation, e.g., "2009"
From time to time a page number needs to be included in the reference. This is done by specifying this in the \cite
command.
\cite[p. 89]{REF_1} % For reference to one page
\cite[pp. 89--90]{REF_1} % For reference to a range of pages
\cite[pp. 89, 90]{REF_1} % For reference to multiple, discontinuous, pages
\usepackage{natbib}
\citet[p. 89]{REF_1} % e.g., "Mejtoft (2009, p. 89)" or "[23, p. 89]
\citep[p. 89]{REF_1} % e.g., "(Mejtoft, 2009, p. 89)"
In a similar way as above, it is possible to add information both before and after the citation mark or just before the citation mark.
\usepackage{natbib}
\citep[see][chapter 8]{REF_1} % e.g., "(see Mejtoft, 2009, chapter 8)"
\citep[e.g.][]{REF_1} % e.g., "(e.g. Mejtoft, 2009)"
Example with parenthetical citations using APA Style.
LaTeX code:
\usepackage{natbib}
\usepackage{apacite}
According to \citet{Mejtoft:2009} many firms using this strategy fail. However, results from a the study carried out by \citeauthor{Mejtoft:2009} in \citeyear{Mejtoft:2009}, failure is not the only option. Firms that break through the market might survive \citep{Mejtoft:2009}. \citet[p. 45]{Mejtoft:2009} states that ``even though some survive, not everyone can''. There are many more examples of this phenomenon \citep[see][Ch 4]{Mejtoft:2009}.
BibTeX entry:
@book{Mejtoft:2009,
Author = {Thomas Mejtoft},
Title = {The survival in any industry},
Publisher = {The publishing Co.},
Year = {2009},
address = {New York, NY, USA}
}
Output (bibliographystyle: apacite):
According to Mejtoft (2009) many firms using this strategy fail. However, results from a the study carried out by Mejtoft in 2009, failure is not the only option. Firms that break through the market might survive (Mejtoft, 2009). Mejtoft (2009, p. 45) states that “even though some survive, not everyone can”. There are many more examples of this phenomenon (see Mejtoft, 2009, Ch 4).
A similar use of names and year around numerical citations can be achieved setting numbers
in the natbib
package using \usepackage[numbers]{natbib}
and using the bibliographystyle IEEEtranN
(observe the double “nN”).
LaTeX code:
\usepackage[numbers]{natbib}
According to \citet{Mejtoft:2009} many firms using this strategy fail. However, results from a the study carried out by \citeauthor{Mejtoft:2009} in \citeyear{Mejtoft:2009}, failure is not the only option. Firms that break through the market might survive \citep{Mejtoft:2009}. \citet[p. 45]{Mejtoft:2009} states that ``even though some survive, not everyone can''. There are many more examples of this phenomenon \citep[see][Ch 4]{Mejtoft:2009}.
BibTeX entry:
@book{Mejtoft:2009,
Author = {Thomas Mejtoft},
Title = {The survival in any industry},
Publisher = {The publishing Co.},
Year = {2009},
address = {New York, NY, USA}
}
Output (bibliographystyle: IEEEtranN):
According to Mejtoft [1] many firms using this strategy fail. However, results from a the study carried out by Mejtoft in 2009, failure is not the only option. Firms that break through the market might survive [1]. Mejtoft [1, p. 45] states that “even though some survive, not everyone can”. There are many more examples of this phenomenon [see 13, Ch 4].
Using BibTeX
When compiling the reference list, it is important to be careful and be sure all information is correct. The reference list is used by the readers if they want to access any of our sources and should, hence, include all information needed for that purpose. Below are some tips on how to create a correct output and some of the common problems that can occur.
When using BibTeX (or other systems) you can often export the correct reference directly from the journal/database. This is done by using the “Export/Download Citation/Cite” button on the journal’s/database’s website. To the right are examples from ACM Digital Library, Taylor & Francis Online, Google Scholar, and IEEE Xplore. Using this feature generates a possibility to export the citation data of the article in different format, e.g., BibTeX. If you are using BibTeX, all information needed for a correct entry is (usually) exported. However, do not fully trust all these automatic BibTeX creators, check and see if the output in your article looks ok. Google Scholar does sometimes create a reference to another source than the original. If it is possible always go to the journal/database where it is published.
Many scientific publication have a DOI (Digital Object Identifier), that is a permanent adress for finding the paper online. There are two ok online tools to convert a DOI name into a BibTeX entry: doi2bib and DOI to BibTeX converter. Please observe that some DOI names might refer to the book/journal and not to the specific paper. Always check the output and see if the BibTeX entry looks correct.
If this feature is not available for your reference, then you need to fill out all the fields by yourself.
Even though it is sometimes easy to find a copy complete BibTeX entries into your project, the information might contain information that is not needed and most often the entries are noisy. It is therefore recommended that you always go through a copied BibTeX entry and see if it is complete and clear out (totally) unnecessary information. This reduced the risk of problems when formatting your references. To do this you need to understand the structure of the BibTeX entry.
Understanding BibTeX Entries
An important part of BibTeX is the .bib file, which contains the BibTeX entries. A BibTeX entry consist of three parts – Entry type, citekey, and a list of key-value pairs. All these things need to be present for the entry to work. The entry starts with the entry type, the other parts are surrounded by curly brackets (or quotation marks) and separated by commas (see example below).
The entry type is the type of refence used. There are ~14 different, more standardized, BibTeX entry types and each entry starts with “@”. The most common entry types are e.g., @article
, @book
and @inproceedings
.
The citekey is a unique key that is used to cite the reference in the text. When creating a larger list of references in BibTeX it is important to structure the list by giving each entry an appropriate citekey. This is important for easier referencing later on. A simple way to solve this is to use e.g., “author:year
” or “DOI name
” as citekey. However, the citekey can be anything e.g., “reference1”, “smartphone-stats” etc. The most important thing is that you easily can remember which citekey corresponds to which entry.
The key-value pairs are different for different entry types but some of the most common ones are e.g., author
, title
, and year
. The key-value pairs should be separated with comma (the comma after the last pair is optional and it does not matter if present or not).
This is the structure of a BibTeX entry:
@entry-type{citekey,
key-1 = {value-1},
key-2 = {value-2},
key-3 = {value-3},
...
key-X = {value-X}
}
In the example below, the entry type is @article
, the citekey mejtoft:2010
, and the key-value pairs author
, title
, and year
(note that this is not a complete BibTeX entry, for complete examples, see below).
@article{mejtoft:2010,
author = {Thomas Mejtoft},
title = {Moving closer to the customers},
year = {2010},
...
}
For examples of BibTeX entries, see below.
Common problems with references (and how to fix them)
Some of the common problems when writing references is that not all the needed information is entered.
Missing page number on journal articles, book chapters, etc.
On articles, book chapters, and other references that are only part of a publication, the page numbers should be included.
Solution: Include the pages
key.
pages = {xxx--yyy},
Pro Tip: en-dash (–) (sv: tankstreck) should be used to specify page range in a reference, this is created by using “--
” between start page (xxx) and end page (yyy) in the BibTex entry.
Missing volume or issue on journal articles
Missing volume or issue of a article might make it more or less impossible to find. For an article this information should be included. Check the publisher, all information is available! The most important is the volume, this cannot be missing.
Solution: Include the following keys: volume
and number
.
volume = {XX},
number = {YY},
Different style on the output of author(s) on different sources
From time to time some authors have full name and some only have initial. This is due to lack of information in the BibTeX entry. The best way to solve this is to include full names (or at least make all entries of a single author similar), then the output in LaTeX changes your BibTeX entry into the correct reference.
Solution: If you have several authors, write the authors in the correct way in the BibTex entry, meaning using AND
(both upper case and lower case works) between the authors names (either way of the example below is fine and will produce the same result).
author = {Thomas Mejtoft AND Ulrik Söderström AND John Doe},
author = {Mejtoft, Thomas AND Söderström, Ulrik AND Doe, John},
Do not abbreviate the first name by just writing the initial. By writing the full first name, the bibliography style configure the references according to the style and will create the initial if needed.
(Underline is just for emphasis and should not be used in the BibTeX-file)
Missing part of last name in reference
If a author has several last names or if the author is e.g., an organization, the references might display incorrectly.
Solution: Words that should be seen as “one word” should be marked with { }
. Hence, curly brackets can be used to identify surnames.
author = {Sven Gunnar {Jonsson Wilkstad}}
So many authors they cause a problem in the reference list
In some cases the number of authors are so many they cause a problem in the reference list. This unusual, since the system usually take care of this problem. However, in some cases you want to force “… et al.”, i.e., shorten the list of authors.
Solution: Type all authors you want in the Author key-value pair and end the list (where you want it to end) with “others”.
BibTeX entry:
...
author = {Thomas Mejtoft AND Helen Cripps AND others},
...
Output (bibliographystyle: apacite):
Mejoft, T., Cripps, H., et al. (2017). ...
Abbreviation of company name
A entry with company as the author of a document (common for e.g., web pages) might be treated as a human with first name and last name and be abbreviated.
Solution: Use curly brackets { }
to identify the company as “one name” and not as first names and last name.
author = {{Goldman Sachs Group}}
In the example above the author becomes “Goldman Sachs Group” and not the abbreviated (and totally wrong) “Group, G. S.”.
Brand names, names, or abbreviations get lower case
Some fields (especially the title field) might become lowercase or all words capitalized if the style requires this. This might get e.g., brand names or names of persons etc. to display incorrectly. Curly brackets can be used to protect capital letters.
Solution: Use curly brackets { }
to identify the words that need special treatment and write them with upper/lower case just as they should be displayed.
title = {Using {Microsoft} {HoloLens} in a driving scenario}
Special characters in fields
Sometimes weird characters appear in the output or characters disappear. This is often due to the unintentional use of special characters in a field, e.g., authors names, title, or journal.
Solution: Escape special characters in the BibTeX file.
Missing book title on book chapter.
Both the title of the chapter and the title of the book need to be in the entry.
Solution: Include the keys: title
and booktitle
.
title = {Xyz},
booktitle = {Zyx}
Missing editor on book with book chapter
If you reference a book chapter from a book with different authors on the chapters, both the author(s) of the chapter and the editor(s) of the book also need to be included.
Solution: Include the keys: author
and editor
.
author = {Xxx},
editor = {Xxx AND Yyy}
Missing year or date
The year (and sometimes the date) is needed to find the reference. Add the year (or date) that the material was published to the entry.
Solution: Include the key: year
.
Tips & Trix: If no year or date is available, write “n.d.
” for “no date”.
Example:
year = {2010}
year = {n.d.}
In the name-year system, “n.d.” is used both in the reference list and for in-text citing, e.g., (Mejtoft, n.d.).
Incorrect source of the published paper
ResearchGate, private web sites, and University web sites are (most often) not official places of publication. They usually contain so-called parallel publication of a published paper (otherwise it is to be regarded as unpublished or self-published work and you should be careful and probably not use that source).
Solution: Find the real source (journal/proceedings/book etc.) and use that source for writing your citation. This information is most often noted somehow on the copy of the paper
Examples of BibTeX styles
Some of the more common BibTeX styles are @article
, @inproceedings
, @incollection
, @book
, @online
, and @techreport
. Here you can find more examples and how to use the different styles.
Key-value pairs in red is needed to create a useful references (in most cases). The other key-value pairs are information that is useful for retrieving the reference.
Please observe that not all optional key-pair values are present in the examples below. For more optional values, please refer to the manual for more information.
Journal article (@article)
This is the common style for a published journal article. This article is written by Thomas Mejtoft and published in the Journal of Strategic Marketing in 2010. The article is printed in the 7th issue of the 18th volume on pages 599 to 611. To cite this entry in your document you use the command:
\cite{mejtoft:2010}
BibTeX entry
@article{mejtoft:2010,
author = {Thomas Mejtoft},
title = {Moving closer to the customers: effects of vertical integration in the Swedish commercial
printing industry},
journal = {Journal of Strategic Marketing},
volume = {18},
number = {7},
pages = {599--611},
year = {2010},
doi = {10.1080/0965254X.2010.529153},
publisher = {Routledge},
}
Many scientific publication have a DOI (digital object identifier), that is lite a permanent adress for finding the paper online. The DOI should always be included if it is available. In the example above, the DOI is "10.1080/0965254X.2010.529153"
.
Conference paper in proceedings (@inproceedings)
This is the common style for a conference paper published in a proceedings (a collections with papers from a conference). This paper is written by Thomas Mejtoft, Sarah Hale, and Ulrik Söderström and presented at the 31st European Conference on Cognitive Ergonomics, it is published in the conference proceedings on pages 41 to 44 (a total of 4 pages) by ACM located in New York, NY.
@inproceedings{Mejtoft-Hale-Soderstrom:2019,
author = {Thomas Mejtoft AND Sarah Hale AND Ulrik S\"{o}derstr\"{o}m},
title = {Design Friction: How intentionally added friction affect users level of satisfaction},
booktitle = {Proceedings of the 31st European Conference on Cognitive Ergonomics},
year = {2019},
pages = {41--44},
doi = {10.1145/3335082.3335106},
publisher = {ACM},
address = {New York, NY, USA},
isbn = {978-1-4503-7166-7},
series = {ECCE 2019},
numpages = {4},
url = {http://doi.acm.org/10.1145/3335082.3335106},
}
Book
This is the style for a published book. The publisher of the book is Morgan & Claypool and their address is San Rafael in the state of California (CA) in the US.
@book{rogers-marshall:2017,
Author = {Yvonne Rogers AND Paul Marshall},
Title = {Research in the wild: Synthesis lectures on human-centered informatics},
Publisher = {Morgan \& Claypool},
Year = {2017},
address = {San Rafael, CA, USA},
}
Most published books have an address given on the title page. For publishers in the US, the common practice is to write "City, State, USA"
or (even more common) just "City, State"
. For publishers in other countries, the practice is to always write "City, Country"
(if states are not used).
example:
@book{Mejtoft:2012,
...
address = {Thousand Oaks, CA, USA},
or
address = {Thousand Oaks, CA},
or
address = {Cambridge, UK},
or
address = {Sydney, NSW, Australia},
or
address = {Lund, Sweden},
}
Chapter in an edited book (@incollection)
Often there are different authors for different chapters in a book, a so-called edited book. It means that (in most cases) there are both author(s) of the chapter and editor(s). In this case the reference should be given to the chapter that you have read. This book chapter is written by Thomas Mejtoft and published in the book Field Guide to Case Study Research in Business-to-business Marketing and Purchasing, edited by Woodside, Pattinson, and Marshall.
@incollection{Mejtoft:2014,
author = {Thomas Mejtoft},
title = {Building Relationships for Survival: Coping Media Industry Dynamics},
booktitle = {Field Guide to Case Study Research in Business-to-business Marketing and Purchasing},
year = {2014},
pages = {39--59},
volume = 21,
editor = {Arch G. Woodside AND Hugh M. Pattinson AND Roger Marshall},
publisher = {Emerald Group Publishing Limited},
address = {Bingley, UK},
doi = {10.1108/S1069-096420140000021000},
chapter = {3},
isbn = {978-1-78441-080-3},
issn = {1069-0964},
URL = {https://www.emeraldinsight.com/doi/abs/10.1108/S1069-096420140000021000},
}
Webpage (@online)
When making references to websites, the actual webpage used should be referenced and not the general site (if that is not intentional). In this example the webpage is written by Thomas Mejtoft in 2024 (in this case the full date is available, but year is the minimum). The date when the webpage was accessed should be stated in Lastaccessed
, in this cade February 8, 2024.
@online{mejtoft:2024,
Author={Thomas Mejtoft},
Title={References using BibTeX},
Year={2023},
Month = {nov},
Day = {29},
url={https://www.mejtoft.se/thomas/education/academic-writing/references-using-bibtex/},
Lastaccessed = {February 8, 2024},
}
If here is no date available, use "n.d."
for no data as year, skip month
and day
.
Other examples
Here are some other examples:
Article in online magazine:
The magazine title is stated in Organization
, in this case The Verge.
@online{brignull:2013,
Author={Harry Brignull},
Title={Dark patterns: Inside the interfaces designed to trick you},
Year={2013},
Month = {aug},
Day = {29},
Organization = {The Verge},
url={https://www.theverge.com/2013/8/29/4640308/dark-patterns-inside-the-interfaces-designed-to-trick-you},
Lastaccessed = {February 8, 2023},
}
Report:
@techreport{Mejtoft:2005,
author = {Thomas Mejtoft},
title = {The cost of digital printing in newspaper production},
institution = {STFI-Packforsk},
year = {2005},
month = {05},
type = {Technical report}
number = {111},
}
Data set:
(loosly based on APA style)
%Published data set
@misc{customer-survey:2021,
author = {Thomas Mejtoft},
title = {Dataset on customer engagement v1.0 [Data file]},
year = {2021},
url = {https://www.mejtoft.se/thomas/resources/},
note = {Retrieved April 22, 2022}
}
%Unpublished data set
@misc{customer-survey:2022,
author = {Thomas Mejtoft},
title = {Dataset on collegial value v1.0 [Unpublished raw data]},
year = {2022},
}
Source code/Software:
(@software
not generically supported in BibTeX, @misc
can be used instead)
@software{Mejtoft:2023,
author = {Thomas Mejtoft},
year = {2023},
month = {jan},
day = {13},
title = {Database extraction in python},
url = {https://www.mejtoft.se/thomas/},
version = {v1.03},
}
%Generic way of including a reference to software in BibTeX
@Misc{Mejtoft:2023,
author = {Thomas Mejtoft},
year = {2023},
month = {jan},
day = {13},
title = {Database extraction in python},
url = {https://www.mejtoft.se/thomas/},
version = {v1.03},
}
Suggested BibTeX entry for ChatGPT
@Misc{Mejtoft:2024,
author = {Thomas Mejtoft},
title = {Database extraction in python},
version = {v1.07},
year = {2024},
month = {nov},
day = {19},
url = {https://www.mejtoft.se/},
}
@Misc{Mejtoft:2024,
author = {Thomas Mejtoft},
title = {Database extraction in python (v.1.07)},
year = {2024},
month = {nov},
day = {19},
url = {https://www.mejtoft.se/},
}
Depending if the version id showin in the current reference format or not, it can be included in the title instead of using version
. Look at the output to see of the version is showing or not.
Generative AI:
@Misc{ChatGPT:2024,
author = {OpenAI},
title = {ChatGPT},
version = {November 2024 release},
year = {2024},
month = {nov},
day = {19},
url = {https://chatgpt.com/},
@Misc{ChatGPT:2024,
author = {OpenAI},
title = {ChatGPT (November 2024 release)},
year = {2024},
month = {nov},
day = {19},
url = {https://chatgpt.com/},
Depending if the version id showin in the current reference format or not, it can be included in the title instead of using version
. Look at the output to see of the version is showing or not.
Cite this page as (APA style):
Mejtoft, T. (2024). References using BibTeX. Retrieved from https://www.mejtoft.se/thomas/education/academic-writing/references-using-bibtex/
(First published by Thomas Mejtoft: 2020-03-11; Last updated: 2024-11-19)