Category Archives: Bibtex

Writing a CV in LaTeX

Writing my curriculum in LaTeX was a task that has been on my TODO-list for quite a while. I liked the style of my Word-written CV and I believed it would take hours to come up with a reasonable CV in LaTeX. Nevertheless, I recently sat down, began writing, and after not too long, I came up with a presentable result that I would like to share.

A complete minimal example can be found at the end of this post.

The Title

In order to even spacing all around, we change the page margins to 3cm using the geometry package. We further make use of the standard article maketitle command, printing the person’s name (title field) and e-mail address (author field).

\documentclass[10pt]{article}
\usepackage[margin=3cm]{geometry}
\title{\bfseries\Huge Tom T. Thurnherr}
\author{texblog+cv@gmail.com}
\date{}
\begin{document}
\maketitle
\end{document}

In case you prefer to add a photo to your CV, try the following slightly more complex code, using minipage:

\documentclass[10pt]{article}
\usepackage[margin=3cm]{geometry}
\title{\bfseries\Huge Tom T. Texblog}
\author{texblog+cv@gmail.com}
\date{}
\begin{document}
\begin{minipage}{0.65\textwidth}
\begingroup
\let\center\flushleft
\let\endcenter\endflushleft
\maketitle
\endgroup
\end{minipage}
\begin{minipage}{0.3\textwidth}
\flushright{\rule{3.5cm}{4.5cm}}
\end{minipage}
\end{document}

Address and Personal Information

We use minipage again to split the page into two parts, one for the address and the second for some personal information if that’s required. Straight forward.

\begin{minipage}[ht]{0.48\textwidth}
Main Road 25\\
City 12345\\
State of Sabotage
\end{minipage}
\begin{minipage}[ht]{0.48\textwidth}
Nonlandian\\
January 3rd, 2020\\
+12 34 56 789
\end{minipage}

The space between the title and the address is just about right. To add more space, use:

\vspace{2em}

The Content

After the cosmetics, we now add the actual content. We use the standard article section with a star to omit numbering. Sections may include: Objective (of the CV), Professional Experience, Education, Languages, Publications, Programming Languages, etc. We will show a few examples here, the structure is always the same.

Let’s first prepare the content with some code in the preamble. We use the tabular environment to divide the page into two columns, a small column for the year/title and a wide column for the description. In order to minimize typing, we define two new columntypes in the preamble, “L” and “R” as well as a thin light-gray line in between, \VRule.

\usepackage{array, xcolor}
\definecolor{lightgray}{gray}{0.8}
\newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}
\newcolumntype{R}{p{0.8\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}

Now we can start creating content sections using the tabular environment as follows:

\section*{Heading}
\begin{tabular}{L!{\VRule}R}
2012&Some text\vspace{5pt}\\
2011&Some other text\\
\end{tabular}

For better readability, we add small vertical spaces between rows in the tabular.

Education

Let’s start by looking at the example with education. We highlighted the parts in bold which are most recent or most important.

\section*{Education}
\begin{tabular}{L!{\VRule}R}
2005--2007&{\bf MSc in Computer Science, Great University, Country.}\vspace{5pt}\\
2001--2005&BSc in Life Science, Great University, Country.\\
\end{tabular}

Languages

Here, we use the left column for the language and the right column for the level of proficiency.

\section*{Languages}
\begin{tabular}{L!{\VRule}R}
Klingon&Mother tongue\\
{\bf English}&{\bf Fluent}\\
French&Fluent (DELF 2010)\\
Japanese&Fair\\
\end{tabular}

Professional Experience

\usepackage{lipsum}
...
\section*{Professional Experience}
\begin{tabular}{L!{\VRule}R}
2011--today&{\bf Work at company XY.}\\
&\lipsum[66]\vspace{5pt}\\
2008--2010&{\bf Trainee at company ZY.}\\
&\lipsum[66]\\
\end{tabular}


Publications

We use the bibentry package to generate an inline list of publications. The references are stored in a bibtex file.

\usepackage{bibentry}
...
\bibliographystyle{plain}
\nobibliography{publication.bib}
\section*{Publications}
\begin{tabular}{L!{\VRule}R}
2006&\bibentry{knuth2006art}\vspace{5pt}\\
1968&\bibentry{lamport1986latex}\\
\end{tabular}

Minimal Example CV

\documentclass[10pt]{article}
\usepackage{array, xcolor, lipsum, bibentry}
\usepackage[margin=3cm]{geometry}

\title{\bfseries\Huge Tom T. Texblog}
\author{texblog+cv@gmail.com}
\date{}

\definecolor{lightgray}{gray}{0.8}
\newcolumntype{L}{>{\raggedleft}p{0.14\textwidth}}
\newcolumntype{R}{p{0.8\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}

\begin{filecontents}{publication.bib}
@article{lamport1986latex,
  title={LaTEX: User's Guide \& Reference Manual},
  author={Lamport, L.},
  year={1986},
  publisher={Addison-Wesley}
}
@book{knuth2006art,
  title={The art of computer programming: Generating all trees: history of combinatorial generation},
  author={Knuth, D.E.},
  volume={4},
  year={2006},
  publisher={addison-Wesley}
}
\end{filecontents}

\begin{document}
\maketitle
\vspace{1em}
\begin{minipage}[ht]{0.48\textwidth}
Main Road 25\\
City 12345\\
State of Sabotage
\end{minipage}
\begin{minipage}[ht]{0.48\textwidth}
Nonlandian\\
January 3rd, 2020\\
+12 34 56 789
\end{minipage}
\vspace{20pt}

\section*{Objective}
Find a job.

\section*{Professional Experience}
\begin{tabular}{L!{\VRule}R}
2011--today&{\bf Work at company XY.}\\
&\lipsum[66]\\
\end{tabular}

\section*{Education}
\begin{tabular}{L!{\VRule}R}
2005--2007&{\bf MSc in Computer Science, Great University, Country.}\vspace{5pt}\\
2001--2005&BSc in Life Science, Great University, Country.\\
\end{tabular}

\section*{Languages}
\begin{tabular}{L!{\VRule}R}
Klingon&Mother tongue\\
{\bf English}&{\bf Fluent}\\
French&Fluent (DELF 2010)\\
Japanese&Fair\\
\end{tabular}

\bibliographystyle{plain}
\nobibliography{publication.bib}

\section*{Publications}
\begin{tabular}{L!{\VRule}R}
2006&\bibentry{knuth2006art}\vspace{5pt}\\
1986&\bibentry{lamport1986latex}\\
\end{tabular}
{\vspace{20pt}\newline\newline
\vspace{20pt}
\scriptsize\hfill Created by http://texblog.org}

\end{document}

Additional Resources

Drop me a comment if you know of other resources and I will add them to the list.

Update

A few days after publishing this post, a vivid discussion took place with lots of interesting CV examples on hackerne.ws.


bib2tex: Converting bibtex to bibitems

A friend asked me today to help him convert a bibtex-file to a \LaTeX bibliography (\bibitem{}), since the journal he submits his paper to doesn’t accept bibtex-files (*.bib). So what we were trying to do is to convert a set of bibtex-references of the following form (from cell):

@article{bartel2009,
	Author = {Bartel, David P. },
	Date = {2009/01/23},
	Journal = {Cell},
	Month = {01},
	Number = {2},
	Pages = {215--233},
	Title = {Micro{RNA}s: Target Recognition and Regulatory Functions},
	Volume = {136},
	Year = {2009}}

to a format that \LaTeX understands, e.g.:

\bibitem[Bartel(2009)]{bartel2009}
David~P. Bartel.
\newblock Micro{RNA}s: Target recognition and regulatory functions.
\newblock \emph{Cell}, 136\penalty0 (2):\penalty0 215--233, 01 2009.

There is an easy way of converting references by making use of the bibtex-command. It does exactly what we needed in the background. Typesetting the document once (latex) and generating the references with the bibtex-command will create a metafile called “document.bbl”, containing all the referenced bibitems in \LaTeX-format.

tom@texblog:~$ latex document
tom@texblog:~$ bibtex document

Finally, just copy and paste the content of the *.bbl file into the \LaTeX document, overwriting \bibliography{<document>}.

Note: The bibitem above was created using:

\usepackage[numbers, square, comma, sort&compress]{natbib}

Source: fundamentalthinking.


Natbib: Multiple reference citation

Natbib is a reimplementation of the \cite command, providing both, author-year and numerical citations.You can get the distribution as well as the documentation from CTAN.Apparently, my previous post on this topic was not providing sufficient information in order to automatically create lists for multiple citations, e.g. [1,2,3, 5] -> [1-3, 5].Here is how it definitely works using “natbib”: First you include the package into your document with whatever options you prefer:

\usepackage[square, comma, sort&compress]{natbib}

Here, “sort&compress” provides the effect we are looking for, i.e. comma separation and hyphenation of multiple citations. By default, natbib uses round parentheses and colons, hence I changed them to square brackets and commas.Use

\citet{wikiEn}

for textual and

\citep{wikiEn}

for parenthetical citation, instead of \cite. The following example shows how Natbib replaces more than two consecutive citations by a hypen:

\documentclass{article}
\usepackage[square, comma, sort&compress]{natbib}
\begin{document}
\section{Comma separated citations}
Most popular search engines include Google and Yahoo, \citep{google, yahoo}.
\section{Citation list}
The most popular free online encyclopaedia is available in different languages, \citep{wikiEn, wikiDe, wikiFr}.
\bibliographystyle{plainnat}
\begin{thebibliography}{99}
\bibitem{google}http://www.google.com. Google Inc. search engine, 2008.
\bibitem{yahoo}http://www.yahoo.com. Yahoo! Inc. search engine, 2008.
\bibitem{wikiEn}http://en.wikipedia.org. Wikipedia in English, 2008.
\bibitem{wikiDe}http://de.wikipedia.org. Wikipedia in German, 2008.
\bibitem{wikiFr}http://fr.wikipedia.org. Wikipedia in French, 2008.
\end{thebibliography}
\end{document}

My apologies, I got something wrong here in the first place. Natbib is not a bibliography-style, but a package providing  author-year and numerical citation. Natbib is supported by the following three styles:

plainnat.bst, abbrvnat.bst and unsrtnat.bst

which replace the standard bst-files.

(Source: http://merkel.zoneo.net/Latex/natbib.php)


How to use Bibtex as a reference library for Latex

Having all your references in a BibTeX-file (*.bib) is more convenient for reusage than typing or copy the whole list of references everytime you are writing a new book, report or article. Therefore, it is worth to learn how to use BibTeX from the beginning, it will save you a lot of time…

BibTeX offers a whole list of entry fields, entry types and different bibliography styles.
Entry fields (standard):

  • address: Publisher’s address (usually just the city, but can be the full address for lesser-known publishers)
  • annote: An annotation for annotated bibliography styles (not typical)
  • author: The name(s) of the author(s) (in the case of more than one author, separated by and)
  • booktitle: The title of the book, if only part of it is being cited
  • chapter: The chapter number
  • crossref: The key of the cross-referenced entry
  • edition: The edition of a book, long form (such as “first” or “second”)
  • editor: The name(s) of the editor(s)
  • eprint: A specification of an electronic publication, often a preprint or a technical report
  • howpublished: How it was published, if the publishing method is nonstandard
  • institution: The institution that was involved in the publishing, but not necessarily the publisher
  • journal: The journal or magazine the work was published in
  • key: A hidden field used for specifying or overriding the alphabetical order of entries (when the “author” and “editor” fields are missing). Note that this is very different from the key (mentioned just after this list) that is used to cite or cross-reference the entry.
  • month: The month of publication (or, if unpublished, the month of creation)
  • note: Miscellaneous extra information
  • number: The “number” of a journal, magazine, or tech-report, if applicable. (Most publications have a “volume”, but no “number” field.)
  • organization: The conference sponsor
  • pages: Page numbers, separated either by commas or double-hyphens
  • publisher: The publisher’s name
  • school: The school where the thesis was written
  • series: The series of books the book was published in (e.g. “The Hardy Boys”)
  • title: The title of the work
  • type: The type of tech-report, for example, “Research Note”
  • url: The WWW address
  • volume: The volume of a journal or multi-volume book
  • year: The year of publication (or, if unpublished, the year of creation)

Entry fields (non-standard):

  • affiliation: The authors affiliation.
  • abstract: An abstract of the work.
  • contents: A Table of Contents
  • copyright: Copyright information.
  • ISBN: The International Standard Book Number.
  • ISSN: The International Standard Serial Number. Used to identify a journal.
  • keywords: Key words used for searching or possibly for annotation.
  • language: The language the document is in.
  • location: A location associated with the entry, such as the city in which a conference took place.
  • LCCN: The Library of Congress Call Number.
  • mrnumber: The Mathematical Reviews number.

In addition, each entry contains a key that is used to cite or cross-reference the entry. This key is the first item in a BibTeX entry, and is not part of any field.

Entry types:

  • @article

An article from a journal or magazine.
Required fields: author, title, journal, year
Optional fields: volume, number, pages, month, note, key

  • @book

A book with an explicit publisher.
Required fields: author/editor, title, publisher, year
Optional fields: volume, series, address, edition, month, note, key

  • @booklet

A work that is printed and bound, but without a named publisher or sponsoring institution.
Required fields: title
Optional fields: author, howpublished, address, month, year, note, key

  • @conference

The same as inproceedings, included for Scribe (markup language) compatibility.
Required fields: author, title, booktitle, year
Optional fields: editor, pages, organization, publisher, address, month, note, key

  • @inbook

A part of a book, which may be a chapter (or section or whatever) and/or a range of pages.
Required fields: author/editor, title, chapter/pages, publisher, year
Optional fields: volume, series, address, edition, month, note, key

  • @incollection

A part of a book having its own title.
Required fields: author, title, booktitle, year
Optional fields: editor, pages, organization, publisher, address, month, note, key

  • @inproceedings

An article in a conference proceedings.
Required fields: author, title, booktitle, year
Optional fields: editor, pages, organization, publisher, address, month, note, key

  • @manual

Technical documentation.
Required fields: title
Optional fields: author, organization, address, edition, month, year, note, key

  • @mastersthesis

A Master’s thesis.
Required fields: author, title, school, year
Optional fields: address, month, note, key

  • @misc

For use when nothing else fits.
Required fields: none
Optional fields: author, title, howpublished, month, year, note, key

  • @phdthesis

A Ph.D. thesis.
Required fields: author, title, school, year
Optional fields: address, month, note, key

  • @proceedings

The proceedings of a conference.
Required fields: title, year
Optional fields: editor, publisher, organization, address, month, note, key

  • @techreport

A report published by a school or other institution, usually numbered within a series.
Required fields: author, title, institution, year
Optional fields: type, number, address, month, note, key

  • @unpublished

A document having an author and title, but not formally published.
Required fields: author, title, note
Optional fields: month, year, key

[Source: http://en.wikipedia.org/wiki/BibTeX]

Example bibliography entry in bib-file:

@article{zhou2005ada,
title = {Adaptive Successive Erosion-based Cell Image Segmentation for p53 Immunohistochemistry in Bladder Inverted Papilloma.},
author={Zhou, H. and Mao, K.},
journal={Conf Proc IEEE Eng Med Biol Soc},
volume={6},
year={2005},
}

Cross-referencing:

It is possible to cross-reference different entries by using the crossreference field, e.g. crossref = {zhou2005ada},

Usage in Latex:

Using your BibTeX-file in Latex is done by specifying a style: \bibliographystyle{style} as well as the bib-file \bibliography{filename1, filename2} (without the bib-extension, just the name). The most commonly used styles are: plain, acm, ieeetr, alpha, abbrv, siam.

Many other styles are available, see here for an extensive list.

PDF generation:

Generating your PDF is a bit of a hassle, as you have to run Latex several times, you need to run the following series of commands:

  1. latex input-file : complains about undefined citations
  2. bibtex input-file : generates a bbl-file
  3. latex input-file : complains about undefined citations
  4. latex input-file

You will have to repeat the procedure every time you add or remove citations, as they will imply changes in the bbl-file.

Note:

  • If you have been using Endnotes so far and want to switch to LaTeX/BibTeX, you won’t need to retype you whole references-database again. It is possible to create a BibTeX-references file from your library in Endnotes.
  • Always look for bibtex-entries on the web. You can sometimes find them in article libraries or on the web page of the authors. They are complete and will save you a lot of time searching and typing the data.

Mulitple reference citation

Recently, I was wondering how to cite multiple references at once, e.g. [1, 5, 9] or even [1-3, 6, 8]. It took me quite some time to find a solution on the web, which is one of the reasons I am posting this article here.

The solution is astonishingly easy. If you want to cite multiple references within the same brackets, you just need to separate the labels with a comma. In addition, cite will automatically check if your labels are part of an ordered list and reduce the list by replacing all the “in-betweens” with a hyphen.


Follow

Get every new post delivered to your Inbox.

Join 316 other followers