Tag Archives: article

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.


Add your logo to the title page using thispagestyle

Adding your company’s logo or brand to the title page of an product description, general terms and conditions or news announcement makes it look more professional. This quick post shows an easy way how to do this using Latex.

We define a simple fancy header for the title page, adding the logo to the right-hand side of the header:
\fancyhead[L]{}
\fancyhead[R]{ \includegraphics[width=4cm]{company-logo.pdf} }
\renewcommand{\headrulewidth}{0pt}

Next, we set the page style of the article to be plain:
\pagestyle{plain}

Finally, we add the title and set the page style of the title page to fancy:
\thispagestyle{fancy}

Complete code example:
\documentclass[12pt]{article}
\usepackage{fancyhdr, graphicx}
\renewcommand{\headrulewidth}{0pt}
\fancyhead[L]{}
\fancyhead[R]{
\includegraphics[width=4cm]{company-logo.pdf}
}
\pagestyle{plain}
\title{\flushleft{My Product Description}}
\date{}
\begin{document}
\maketitle
\thispagestyle{fancy}
\section{Overview}
...
\end{document}


Save the planet using Latex, print 2in1!

I just found this very cool package which lets you easily print two pages in one. I have only tested it for articles and reports and it works perfectly for articles. Using the document-class report, the content is perfectly structured, but not the table of contents, which still takes the entire page. The package also messes up with the page numbers whenever you start a new chapter. So it basically only works with sections, but not chapters.

First tell Latex to turn the page to landscape:

\documentclass[a4paper, landscape]{article}

Next include the necessary packages:

\usepackage{2in1, lscape}

The latter is needed, as you not only want the paper layout, but also the content to be in “landscape-mode”.

Now add your document content and have fun printing (and saving the planet ;-) )!

The standard distributions have this package included, but just in case you can get it from here.


Create small TOCs/LOFs/LOTs using \minitoc

In large documents, it is helpful to add a “mini-table-of-contents” at the beginning of every chapter in order to get a better overview of the chapter. The minitoc-package provides a nice, easy-to-use and customizable layout for TOCs on a chapter level.

How to crate a minitoc:

\usepackage{minitoc}

Any minitoc can only be created if you have a “global” table-of-contents, its content is used for generation. So in your document, you first have to notify Latex you want to use minitoc and then create the overall table of contents:

\dominitoc
\tableofcontents

Now you can add minitocs at the beginning of your chapters:

\chapter{...}
\minitoc
\section{...}

Minilofs and minilots:

Similarly, \minilof and minilot will create list-of-figures and list-of-tables for your chapters.

Remarks:

Obviously, this only makes sense in books and reports, as in articles there are no chapters available. Here the minitoc-package provides additional commands for articles:

\secttoc
\sectlof
\sectlot

and to partition books:

\parttoc
\partlof
\partlot

The package documentation can be found at CTAN


Define your own “list of …”

I got this very interesting question lately, how to define a custom list of examples, similar to the list of figures. But as this is not only applicable to examples, but to all sorts of things (e.g. questions, theorems, proofs, lemmas, answers, etc.) and hence might be useful for other people, I decided publish a new post on that issue.

As usual, you will need to import a package.

\usepackage{tocloft}

The package lets you customise your table of contents, list of figures or list of tables (which is basically what the name stands for).

In addition, the package also lets you define your custom lists easily and hence is exactly what we were looking for.

In order to keep this as general as possible, I will use “X” instead of “example”, “proof”, etc. At the end, I will post a complete example, showing how to create a “list of examples”, which you can simply copy-paste and adapt for your needs.

After having added the package, we want to define the name that appears as a title of our list:

\newcommand{\listXname}{List of Xs}

Next we use the command provided by tocloft to define a new list of whatever:

\newlistof{X}{ex}{\listXname}

Now we define the actual X-command (similar to figure or table), which has a counter that is increased by one every time an X is used:

\newcommand{\X}[1]{%
\refstepcounter{X}
\par\noindent\textbf{X \theexample. #1}
\addcontentsline{exp}{example}
{\protect\numberline{\thechapter.\theexample}#1}\par}

By using the X-command (\X{Your text}), Latex will print the following:

X 1 Your text

The last line will add all your typed Xs to the list of Xs.

That’s it for the definition. The command “\listofX” will create a list of all your defined Xs similar to the ToC, LoF and LoT.

\begin{document}
\tableofcontents
\newpage
\listofX
\newpage
...
\end{document}

You can also add references to the different Xs, by adding a label just after the X-command (see example below):

Example: List of Examples

\documentclass{report}
\usepackage{tocloft}
\usepackage[english]{babel}
\newcommand{\listexamplename}{List of Examples}
\newlistof{example}{exp}{\listexamplename}
\newcommand{\example}[1]{%
\refstepcounter{example}
\par\noindent\textbf{Example \theexample. #1}
\addcontentsline{exp}{example}
{\protect\numberline{\thechapter.\theexample}#1}\par}
\begin{document}
\tableofcontents
\newpage
\listofexample
\chapter{Two examples}
\example{Your first example}
\label{1st_ex}
\example{Your second example}
\label{2nd_ex}
\chapter{One example}
\example{Your third example. (See example \ref{1st_ex} and \ref{2nd_ex})}
\end{document}

If you want to reset your example counter for new chapters, you would need to add the following lines before the beginning of your document:

\makeatletter
\@addtoreset{example}{chapter}
\makeatother

Click here for the complete tocloft documentation as well as the package.


Of theorems, lemmas and proofs

Different packages of Latex provide nice and easy-to-use environments for theorems, lemmas, proofs, etc. The following post will show you the mostly used layouts and how to change numbering. 
Theorem styles: For theorems, corollaries and lemmas, you need the following package:

\usepackage{amsthm}

which allows you to define new environments using either:

\newtheorem{env_name}{caption}[within]

or

\newtheorem{env_name}[numbered_like]{caption}

 where

  •  env_name: Environment name
  • caption: Text printed before the number, e.g. Theorem, Lemma, etc.
  • within: The name of a defined counter
  • numberered_like: Name of a defined theorem-like environment

Note: The command may at most have one optional argument. Let me give an example: First we define a new theorem “Theorem”, which takes the numbering of the section plus a consecutive number:

\newtheorem{thm}{Theorem}[section] 

For your theorems you can now use the defined environment:

\begin{thm}...\end{thm}

 For lemmas which have the same numbering as the previous thm-environment, we need to define a new theorem type:

\newtheorem{lem}[thm]{Lemma}

 Note: Environments different from thm, lem or cor need to be defined previously, having a different counter which starts from zero:

\theoremstyle{remark} 
\newtheorem{rem}{Remark}
\begin{rem}This is a remark.\end{rem}

Note: To omit the numbering, you can use the star as for chapters, sections, etc.:

\newtheorem*{lem}[thm]{Lemma}

Proof: A proof usually comes without a numbering as it follows a numbered theorem, corollary, etc. For a proof, you need the following package:

\usepackage{amsthm}

and then you can directly use the proof-environment:

\begin{proof}...\end{proof}

The closing statement automatically prints a qed-sign (square box) on an empty line after the last statement, terminating the proof.Note: If you want to place the qed-sign on the last line, i.e. if your proof ends with an equation, you can use the command:

\qedhere

inside the equation-environment (before the \end{equation}).


Add (Hyper-)Links to PDFs

Adding links to PDFs , both internal and external, certainly only makes sense for digital copies of the file. Nevertheless, they still come in handy, for example for actual WWW-addresses or as direct reference inside a document.

Local references

As usual, you first need the package which handles the links:

\usepackage{hyperref}

This does the job for the moment. The package “hyperref” will automatically insert links wherever you place a citation or reference (\cite{}, \ref{}).

Global references

Referencing to URLs or local files can be done as follows:

\href{url}{text}

Try this:

\href{http://texblog.wordpress.com}{\bf{Blog on Latex Matters}}

Colour references

So far, the references were marked by a colour rectangle around them, which is not very appealing (unless you are using Apple Preview). Here is how you remove the border and if you wish define your own colours for references.

Either add this optional argument to the previous package:

\usepackage[colorlinks]{hyperref}

or use a new line and set the colour:

\usepackage{hyperref}
\hypersetup{colorlinks}

If you want to define your own colours, you will have to use the latter, as the colours are part of the argument of “hypersetup”. But in order to do so, you first need to define colours, which is why you will need the colour-package:

\usepackage{color}

Then you can define different colours you may want to use for your references, e.g.:

\definecolor{darkred}{rgb}{0.5,0,0}
\definecolor{darkgreen}{rgb}{0,0.5,0}
\definecolor{darkblue}{rgb}{0,0,0.5}

Latex uses the standard RGB (red/green/blue) colour model. The three values define the intensity for each channel within the interval I=[0,1] (just because Latex looks nicer:-).

Now you are ready to use the defined colours, by extending the previously used command:

\hypersetup{ colorlinks,
linkcolor=darkblue,
filecolor=darkgreen,
urlcolor=darkred,
citecolor=darkblue }

Note: If your tex-distribution does not contain the hyperref-package, you can download it here (hyperref.zip), including the complete documentation.


Header/Footer in Latex with Fancyhdr

Creating headers and footers in Latex can be done by using the package “fancyhdr”. This is a short introduction, showing the most important features of the package. If you know “fancyhdr” and are looking for something particular, refer to the fancyhdr-documentation.

First of all, you need to tell Latex to use the package:

\usepackage{fancyhdr}

and change the style from “plain” to “fancy”:

\pagestyle{fancy}

You will now the get the default fancy pagestyle which adds a line at the top of every page, except for some exceptions (title-page, abstract, new chapter in report).

Default fancyhdr page style:

Above the line, Latex will print headings:

Book/report

Left-hand side: section
Right-hand side: chapter
Note: if you use the optional documentclass argument “twoside”, Latex will alter the position of the section and chapter. (e.g. \documentclass[twoside]{report}, also introducing non-symmetric margins).

Article

For acticles, Latex will print the section only (chapters cannot be used with articles).
The footer only includes the page number which is centered by default.

Custom fancyhdr page style:

Even though fancyhdr has a default page style, you are free to define headers/footers yourself , which is not too difficult after all.

First you need to clear the default layout:

\fancyhead{}
\fancyfoot{}

There are seven letters you need to know before you can define your own header/footer:

E: Even page
O: Odd page
L: Left field
C: Center field
R: Right field
H: Header
F: Footer

Now it’s time to start defining your own layout. The definitions are added to the preamble:

\fancyhead[CO,CE]{---Draft---}
\fancyfoot[C]{Confidential}
\fancyfoot[RO, LE] {\thepage}

The decorative lines can be changed by increasing/decreasing their thickness (0pt means no line):

\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

Note: According to the fancyhdr-documentation, the default layout is produced by the following commands:

\fancyhead[LE,RO]{\slshape \rightmark}
\fancyhead[LO,RE]{\slshape \leftmark}
\fancyfoot[C]{\thepage}
\headrulewidth 0.4pt
\footrulewidth 0 pt


Flush figure before end of page

Usually figures are placed wherever there is enough space, e.g. for “begin{figure}[ht]” at the beginning of the next page. What if you want to place the figure within the text, because you have other figures which you do not want to place only at the beginning of the second next page…

There is a little trick, which lets Latex place figures before the end of a section by using an exclamation mark (\begin{figure}[h!t]), as long as there is enough space on that page.
The exclamation mark let’s you place figures more precisely in the text and is more often useful than not. It can be used to the same extend for tables.


Problem with label for tables having small text-size

I recently had the following problem, I was using a label to reference a table where I placed the “tabular”- environment into the “small”- environment to decrease its size. The number indicated by the reference was not the table index, but rather the number of the section/subsection within which I placed the table. The problems seems to exist in both, Miktex and MacTex…

A table ususally has the following structure (for an introduction to tables click here) with the “small”- environment added to slightly decrease its size:

\begin{table}[htdp]
\caption{default}
\begin{small}
\begin{center}
\begin{tabular}{|c|c|}
\end{tabular}
\end{center}
\end{small}
\label{default}
\end{table}

Placing the label inside both, “small”- and “center”- environment solves the problem.
Hence:

\begin{table}[htdp]
\caption{default}
\begin{small}
\begin{center}
\begin{tabular}{|c|c|}
\end{tabular}
\label{default}
\end{center}
\end{small}
\end{table}

I actually don’t know why Latex does not translate the reference correctly, as the label is still within the “table”-environment, at least the problem can be solved that way.


Follow

Get every new post delivered to your Inbox.

Join 316 other followers