BibTeX
When you want to use references in your LaTeX, you should use BibTeX.
First, you have to decide which package and compiler you are going to use. There are many different ways to do this, but we will compare two of the most used ways.
Before starting, make sure you have TeXiFy and LaTeX installed according to https://github.com/Hannah-Sten/TeXiFy-IDEA#installation-instructions-installing-intellij-and-the-texify-idea-plugin
Many LaTeX features are also available for BibTeX, including syntax highlighting, reference resolving, formatting, and a structure view.
Terminology
To avoid confusion, we first name some relevant parts.
You write your references in a bibtex file which has a
.bib
extension. This is essentially a database. You can use other software like Mendeley or JabRef to manage this database.You can use LaTeX packages to help you typesetting your bibliography in the way you want, an example is biblatex.
You also have to compile your
.bib
file using a special bibtex compiler. The most common ones are the biber compiler and the (confusingly named) bibtex compiler.
For more information about these differences and more examples, see for example https://tex.stackexchange.com/questions/25701/bibtex-vs-biber-and-biblatex-vs-natbib
Choosing your way of using bibtex
For both methods, your .bib
file can be the same, but you include it in a different way. TeXiFy will try to detect this, and automatically compile with the right compiler.
Using the bibtex compiler and no extra package
Example
main.tex
references.bib
For a downloadable example, see https://github.com/PHPirates/bibtex-mwe
Using the biber compiler and the biblatex package
Example
An example of using the biblatex package:
main.tex
references.bib
For a downloadable example, see https://github.com/PHPirates/biber-biblatex-mwe
Compiling
Once you have chosen which compiler and packages you want, make sure you have a simple example file like above to test it with. This makes it easier to detect and solve any errors you get.
Place your cursor in your main LaTeX file (
main.tex
in the example) and hit Ctrl + Shift + F10 to create a run configuration and run it.TeXiFy should have created a LaTeX run configuration which is linked to a BibTeX run configuration, so you should see output windows for both LaTeX and BibTeX, and the references appear correctly in the pdf.
Troubleshooting
If the references do not appear correctly and no bibliography section is shown, read on to debug the problem.
On Linux, make sure you have the 'Separate output files from source' checkbox disabled.
Make sure that a BibTeX run configuration was created, after running you should see multiple tabs in the Run window at the bottom of your screen, like
main
,main bibliography
,main
,main
. If not, you have multiple options.Switch to a different compiler which handles BibTeX automatically for you. You can for example use latexmk, see latexmk on how to install it, then switch to it. An other compiler which can do this is Tectonic.
Create a BibTeX run configuration manually:
Click the dropdown list with the name of your run configuration (probably the name of your main file)
Click Edit Configurations
Click the Plus icon to create a new one
Select BibTeX
Select the right compiler
Go to your LaTeX run configuration and click Bibliography: Disabled
Click on the edit icon and choose the BibTeX run configuration you just created
Now run your main run configuration (not the BibTeX one) and you should see it first runs LaTeX, then BibTeX then LaTeX twice.
If the exit code of any run is not 0, check the log for any error message.
Code completion
When using BibTeX autocompletion in TeXiFy version 0.6.8 or later, besides using the bibtex id you can also type parts of the author or title of the bibtex entry for it to appear in the suggestions list. The suggestions list will show title and (to the right) the bibtex id. If you press Ctrl + Q when having an item selected you can also view the authors. When you select it, the bibtex id will be inserted. You can also use autocompletion for BibTeX entries stored in Mendeley, Zotero or any other local file, see the Remote Libraries tool window.
String variables
TeXiFy supports the use of @string
variables in bibtex files, including syntax highlighting, autocompletion and 'go to source' navigation (Ctrl + B by default).
A usage example is the following.
Code folding
Just as with LaTeX you can fold BibTeX entries. Folding actions can be found at
.Chapterbib support
Since b0.6.9
chapterbib is a package which allows you to have a separate bibliography per chapter. This means you have in your main file \include
commands to include chapters, and each chapter file includes its own bibliography (this can be different per chapter). TeXiFy will recognise this and automatically create the necessary BibTeX run configurations for each chapter, and run them. For more information, see https://ctan.org/pkg/chapterbib?lang=en
Example:
main.tex
introduction.tex
discrete_shape.tex
references.bib
Quick documentation
Ctrl + Q on a bibtex reference will show a popup with title and authors from the bibtex entry.