Developer's Diary
Software development, with Terry Ebdon
|
Doxygen allows citations via the \cite command. For this to work you need BibTeX bib files. The .bib files can be created in a text editor or, optionally, exported from Zotero.
This is described in Doxygen's documentation, but the description is quite terse. Let's go through it in detail.
This is how it hangs together:
You'll need Latex and BibTeX software. I use TexLive, which includes both. From now on I'll assume you're also using TeX Live.
Start in a clean folder, with Doxygen on the path:
Enter doxygen -g
to generate a configuration file. This will be named Doxyfile.
Fire up a text editor and create index.md:
# Hello World {#mainpage} Groovy in Action is an excellent book. \cite gina2e
Note how I've included a citation. For this to work Doxygen will need a BibTeX file.
Create a test BibTeX file, test.bib, with your favourite editor. I'll cover using Zotero for this later.
@book{ gina2e, author = "Dierk König and Paul King", title = "Groovy in Action, Second Edition", ISBN = "9781935182443", year = "2015", publisher = "Manning Publications Co.", address = "New York" }
You need to point Doxygen at the BibTeX file you just created. To do this open Doxyfile, in a text editor, and search for CITE_BIB_FILES
, it's probably at line 100:
CITE_BIB_FILES =
Add the BibTeX file name after the equals sign and save the file:
CITE_BIB_FILES = test.bib
CITE_BIB_FILES
line.By default Doxygen will generate HTML output, but not Latex. (Citations work in both output formats.)
Search for 'GENERATE_HTML':
#--------------------------------------------------------------------------- # Configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES
I tend to create both HTML and Latex, so I leave the GENERATE_HTML
line as is, but I change the GENERATE_LATEX
line to YES:
#--------------------------------------------------------------------------- # Configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = YES
This is the easy bit: just type in doxygen
and hit enter. You'll see a screen of output ending with the line "finished..."
Doxygen has created two output folders, one for HTML and another for Latex, assuming you enabled both:
E:\test>dir/b Doxyfile index.md html latex test.bib E:\test>
Use a browser to open the html/index.html file. You should see something like this:
Note the "[1]" replacing the "\cite gina2e" you typed into the markdown file. Click this and you'll be taken to the bibliography:
The latex folder contains everything you need for a latex document, including two make files; one for Window and another for Linux / OS X:
E:\test>cd latex E:\test\latex>dir/b Makefile make.bat doxygen.sty refman.tex index.tex bibTmpFile_1.bib citelist.tex E:\test\latex>
Run the make file, that's appropriate for your OS, and refman.pdf will be created.
The generated PDF works in exactly the same way as the HTML page.
There's a page with the content, with a hyperlinked "1" to take you to the bibliography.
At the end of the PDF you'll find the bibliography:
The next step is to use a BibTeX file exported from Zotero. I'll cover that tomorrow.
Zotero can export to BibTeX. Then point Doxygen at the BibTeX bib files and tell it to create latex output. Use \cite in your markdown.
– Tweet via @terry_ebdon
Find me coding on GitHub, networking on LinkedIn, answering questions on Stack Exchange and hanging out on twitter.