> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/more-topics/26-how-to-write-a-latex-class-file-and-design-your-own-cv-part-2.md).

# How to write a LaTeX class file and design your own CV (Part 2)

[Part 1](/latex/more-topics/25-how-to-write-a-latex-class-file-and-design-your-own-cv-part-1.md) | Part 2

**Author: Cody Herring (June 2013)**

This is a continuation of [How to write a LaTeX class file and design your own CV (Part 1)](/latex/more-topics/25-how-to-write-a-latex-class-file-and-design-your-own-cv-part-1.md), going over more options for creating a CV, and using class files to do so.

In the last post, we had 2 files created: `cv.tex` and `my_cv.cls`. The conten file, `cv.tex`, contained the following:

```latex
\documentclass{my_cv}
\begin{document}
\section{Education}
\datedsubsection{University of Nowhere}{2004-2008}
\section{Work}
\datedsubsection{ABC Limited}{2008-Now}
\end{document}
```

`my_cv.cls` contained some formatting defaults, as well as some commands to use:

```latex
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{my_cv}[6/6/2013 custom CV class]
\LoadClass{article}
\RequirePackage{titlesec}
\titleformat{\section}       % Customise the \section command
{\Large\scshape\raggedright} % Make the \section headers large (\Large),
                             % small capitals (\scshape) and left aligned (\raggedright)
  {}{0em}            % Can be used to give a prefix to all sections, like 'Section ...'
  {}                 % Can be used to insert code before the heading
  [\titlerule]       % Inserts a horizontal line after the heading
  \titleformat{\subsection}
  {\large\scshape\raggedright}
  {}{0em}
  {}
\newcommand{\datedsection}[2]{%
  \section[#1]{#1 \hfill #2}%
}
\newcommand{\datedsubsection}[2]{%
  \subsection[#1]{#1 \hfill #2}%
}
```

This generates the following document:

![Figure 1.png](/files/CW5B9fjwjXrG0BhQRAuv)

The `#1` and `#2` refer to the first and second argument or parameter that are being passed into the command. In the first line of a `\newcommand`, the section in brackets e.g. `[2]` refers to the number of parameters being passed in to the function. The function can then call these parameters by using `#1`, `#2`, and so on, depending on how many parameters were required by the function. Functions with more parameters will be shown later in the article.

We'll continue by adding a name and contact section, as well as continuing with the experience and other sections.

### Name and contact information

In a CV, the name is typically at the top, with contact information to call for jobs. This will be accomplished by adding new functions to our class file. The name can be added using a simple function:

```latex
\newcommand{\name}[1]{%
  \centerline{\Huge{#1}}
}
```

This produces a centered, large font name wherever it is used. This can be called like so:

```latex
\name{John Smith}
```

Now, for contact information. Add the following to the class file:

```latex
\newcommand\contact[5]{%
    \centerline{%
        \makebox[0pt][c]{%
            #1 {\large\textperiodcentered} #2 {\large\textperiodcentered} #3
            \ #4 \ \ #5%
        }%
    }%
}
```

Then call the function from the document:

```latex
\contact{123 Broadway}{London}{UK 12345}{john@smith.com}{(000)-111-1111}
```

All of this displays nicely, with the name and contact information like so:

![Figure 2.png](/files/5WGDaTrjZ8xoWlKC8Yd0)

This displays contact information nicely formatted with a bullet break in between. This can be adjusted for longer addresses if necessary by adding a second function:

```latex
\newcommand{\longcontact}[5]{%
    \noindent
    #1\hfill {\large\textperiodcentered}\hfill #2\hfill
    {\large\textperiodcentered}\hfill #3\\
    #4\hfill #5%
}
```

![Screenshot3.png](/files/2WDl1TFTzX6LweOXB2ou)

This looks a bit strange with the short information, but if an address is particularly long, it is more flexible to use. The best part of this is that the TeX document requires minimal changes:

```latex
\longcontact{123 Broadway}{London}{UK 12345}{john@smith.com}{(000)-111-1111}
```

This is the main point of using class files. Allowing for minimal changes in the content of the document, and controlling the presentation (how the content is shown) externally.

### Expanding the Experience section

A CV should have more than just a listing of jobs. Some description of what was done in the jobs should be added under each item. 3 bullet points per job is a good balance of detail and description. This can easily be adjusted by adding or removing nodes. Add the following to the class file:

```latex
\newcommand{\workitems}[3]{%
    \begin{itemize}
    \item #1
    \item #2
    \item #3
    \end{itemize}%
}
```

Add the following to the `.tex` file:

```latex
\workitems
{Developed new product}
{Improved productivity by 20\%}
{Decreased costs by \$10,000}
```

Now the experience section is looking a bit more full:

![Figure 4.png](/files/EiBBDpqaYp1nRlk8EmfA)

Adding a skills section rounds out the resume. This was done without a class function, as it didn't shorten the LaTeX code much:

```latex
\section{Skills}

\begin{tabular}{l l l l}
C\# & T-SQL & Javascript & HTML \\
XML & JSON & SOAP & REST
\end{tabular}
```

This results in the following:

![Figure 5.png](/files/uOcVnGIRlU7Ozt57cmQj)

### Conclusion

This two-part article should have left you with a very basic CV template, ready to expand and add new sections.

The entire class file is as follows:

```latex
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{my_cv}[6/6/2013 custom CV class]
\LoadClass{article}
\RequirePackage{titlesec}

\titleformat{\section}
  {\Large\scshape\raggedright}
  {}{0em}
  {}
  [\titlerule]

  \titleformat{\subsection}
  {\large\scshape\raggedright}
  {}{0em}
  {}

\newcommand{\datedsection}[2]{%
  \section[#1]{#1 \hfill #2}%
}
\newcommand{\datedsubsection}[2]{%
  \subsection[#1]{#1 \hfill #2}%
}

\newcommand{\name}[1]{%
  \centerline{\Huge{#1}}%
}

\newcommand\contact[5]{%
    \centerline{%
        \makebox[0pt][c]{%
            #1 {\large\textperiodcentered} #2 {\large\textperiodcentered} #3
            \ #4 \ \ #5%
        }%
    }%
}

\newcommand{\longcontact}[5]{%
    \noindent
    #1\hfill {\large\textperiodcentered}\hfill #2\hfill
    {\large\textperiodcentered}\hfill #3\\
    #4\hfill #5%
}

\newcommand{\workitems}[3]{%
    \begin{itemize}
    \item #1
    \item #2
    \item #3
    \end{itemize}%
}
```

The `.tex` file is as follows:

```latex
\documentclass{my_cv}
\begin{document}
\name{John Smith}
\contact{123 Broadway}{London}{UK 12345}{john@smith.com}{(000)-111-1111}
\section{Education}
\datedsubsection{University of Nowhere}{2004-2008}
\section{Work}
\datedsubsection{ABC Limited}{2008-Now}
\workitems
{Developed new product}
{Improved productivity by 20\%}
{Decreased costs by \$10,000}

\section{Skills}
\begin{tabular}{l l l l}
C\# & T-SQL & Javascript & HTML \\
XML & JSON & SOAP & REST
\end{tabular}

\end{document}
```

This results in the following document:

![Figure 6.png](/files/IKzAsAwUzzcQJmbiE0f6)

This tutorial should give a great starting point for a CV, with room for expansion.

[Part 1](/latex/more-topics/25-how-to-write-a-latex-class-file-and-design-your-own-cv-part-1.md) | Part 2


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/more-topics/26-how-to-write-a-latex-class-file-and-design-your-own-cv-part-2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
