The first thing to do before coding a new class is to determine whether you really need a new class or not. It's recommended to search on CTAN (Comprehensive TEX Archive Network) and see if someone already created something similar to the document class you need
All class files should start with two lines similar to the following
The \NeedsTeXFormat commands tells the compiler which version of LaTeX the package is for. The current version of LaTeX is LaTeX2e and almost all distributions use this.
The \ProvidesClass command gives the compiler some information about your package. The first argument should match the filename of your class file and tells LaTeX what your package is called. The second argument is optional and provides a description of your class which will appear in the log and other places. The description must begin with a date in exactly the format above and it should be the date the package was last modified. This can be used when including the class to check that you have a recent enough version of it. For example if you include it via \documentclass{my_cv}[2012/01/01] with a date which is newer than the date in the class description then a warning will be shown saying that the class is outdated.
The standard article section headings don't really suit a CV so we'd like to replace them with something neater. To do this, we can redefine the \section command to output a custom header
Fortunately there is already an excellent package called titlesec which provides an easy way to customise our header styles. Include this in your class file with:
\RequirePackage{titlesec
The titlesec package provides the command \titleformat which lets us customise our section headings.
You should try out some of the formatting options available to see what you like:
\bfseries, \itshape: make the heading bold or italic;
\scshape:small capitals;
\small, \normalsize, \large, \Large, \LARGE, \huge, \Huge: set the font size;
\rmfamily, \sffamily, \ttfamily: set the font type to serifed, sans serifed or typewriter respectively.
We can define some new commands which let us include dates in our section headings. Include the following in your class file
\newcommand{\datedsection}[2]{%
\section[#1]{#1 \hfill #2}%
}
\newcommand{\datedsubsection}[2]{%
\subsection[#1]{#1 \hfill #2}%
}
This defines two new commands \datedsection and \datedsubsection which take two arguments: the section name as before, and a date which will be typeset on the right-hand side of the page. The \hfill command tells LaTeX to fill as much space as possible and so pushes the second argument (#2) to the right of the page. Modify cv.tex to use these commands:
\documentclass{my_cv} \begin{document} \section{Education} \datedsubsection{University of Nowhere}{2004--2008} I attended the University of Nowhere from 2004 to 2008. \section{Work} \datedsubsection{ABC Limited.}{2008--Now} I have worked at ABC Limited from 2008 onwards. \end{document}
\documentclass{my_cv} \begin{document} \section{Education} \datedsubsection{University of Nowhere}{2004--2008} I attended the University of Nowhere from 2004 to 2008. \section{Work} \datedsubsection{ABC Limited.}{2008--Now} I have worked at ABC Limited from 2008 onwards. \end{document}