% \iffalse meta-comment
%
% Copyright (C) 2007 by Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
% -------------------------------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.2 or later is part of all distributions of LaTeX
% version 1999/12/01 or later.
%
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{simplecv.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<class>\ProvidesClass{simplecv}
%<*class>
    [2014/11/07 v1.6a simple curriculum vitae]
%</class>
%
%<*driver>
\documentclass{ltxdoc}
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{simplecv.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \makeatletter
% \def\SpecialOptionIndex#1{\@bsphack
%     \index{#1\actualchar{\protect\ttfamily#1}
%            (option)\encapchar usage}%
%     \index{options:\levelchar{\protect\ttfamily#1}\encapchar
%            usage}\@esphack}
% \def\DescribeOption{\leavevmode\@bsphack\begingroup\MakePrivateLetters
%   \Describe@Option}
% \def\Describe@Option#1{\endgroup
%               \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
%               \SpecialOptionIndex{#1}\@esphack\ignorespaces}
% \providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}
% \makeatother
%
% \GetFileInfo{simplecv.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \changes{1.0}{1998/03/23}{First public release}
% \changes{1.1}{1998/11/06}{Better documentation, in order to release it for
%   \LyX}
% \changes{1.2}{1998/12/01}{Changed the justification of items labels
%   (with help from Amir Karger)}
% \changes{1.2}{1998/12/01}{Changed the semantics of \cs{topicfont} and
%   \cs{itemfont}}
% \changes{1.3}{1999/02/09}{Added class options sf and plain}
% \changes{1.4}{2001/05/04}{Added notopicbreak class option}
% \changes{1.5}{2001/06/18}{Added hebrew support (from Dekel Tsur)}
% \changes{1.5}{2001/06/18}{Added contbibnum class option}
% \changes{1.5}{2001/06/18}{Added titleabove class option}
% \changes{1.5}{2001/06/18}{Some variables renaming and cleanups}
% \changes{1.6}{2007/04/22}{New option topictitle and associated
%   \cs{topcilabelfont}}
% \changes{1.6}{2007/04/22}{Renamed class to simplecv}
% \changes{1.6}{2007/04/22}{Convert to use docstrip}
% \changes{1.6a}{2014/11/07}{Fix incompatibility with \texttt{array} package}
%
% \title{The \textsf{simplecv} class\thanks{This document
%   corresponds to \textsf{simplecv}~\fileversion, dated \filedate.}}
% \author{Jean-Marc Lasgouttes\\ \texttt{Jean-Marc.Lasgouttes@inria.fr}}
%
% \maketitle
%
% \section{Introduction}
%
% The |simplecv| document class is intended to provide a simple
% yet elegant way to write your curriculum vitae (resume). This is a
% repackaging of the |cv| class that has been available with \LyX{} for a
% long time. The change of name has been made necessary by the
% existence of another |cv| class on CTAN.
%
% Before I delve into the details, I would like to thank Amir Karger,
% Reuben Thomas and Dekel Tsur for their help and tips.
%
% \section{Basic Usage}

% \subsection{Class options}

%  The document class accepts some options (along with the usual
%  |article| class ones). The first set allows to select a style (a set
%  of fonts):
%
% \begin{description}
%   \item[|sf|] \DescribeOption{sf} (default) produce title and
%   headers in sans serif fonts;
%   \item[|plain|] \DescribeOption{plain}produce all output with roman fonts.
% \end{description}
% The rest of the options may be useful according to one's tastes.
%
% \begin{description}
%   \item[|notopicbreak|] \DescribeOption{notopicbreak}do not add a
%   line break after long topic labels;
%   \item[|contbibnum|] \DescribeOption{contbibnum}let the numbering
%   of bibliography items be ontinuous when there are several
%   thebibliography environments;
%   \item[|titleabove|] \DescribeOption{titleabove}output the title
%   above the left and right headers, not below;
%   \item[|topictitle|] \DescribeOption{topictitle}let the first
%   paragraph after each \cs{item} have font \cs{topictitlefont}, and 
%   therefore act as a kind of title.
% \end{description}
%
% \subsection{The header of the CV}
% The macros below can be used to typeset the top of the CV.
%
% \DescribeMacro\leftheader
% \cs{leftheader}\oarg{pos}\marg{text}
%  defines what should appear in the upper left of the first page.
%  \meta{text} may contain |\\| to break lines. \meta{pos} can be |l|,
%  |r| or |c| and specifies the horizontal alignment (default is |l|).
%
% \DescribeMacro\rightheader
% \cs{rightheader}\oarg{pos}\marg{text} is like \cs{leftheader}, but for
% the upper right of the first page.
%
% \DescribeMacro\title
% \cs{title}\marg{text} defines a title, that will appear centered below the
%                headers (or above, if the |titleabove| option is
%                used).
% \DescribeMacro\maketitle
% \cs{maketitle} actually typesets the header.
%
% \subsection{Topics}
% The CV is divided in topics (and in some cases subtopics). In order
% to introduce these, the \cs{section} and \cs{subsection} macros are
% reused.
%
% \DescribeMacro\section
% \DescribeMacro\subsection
% \cs{section}\marg{text} gives a title for a new topic of the CV and
% \cs{subsection}\marg{text} does the same for a sub-topic. There are no
% other sectionning levels.
%
% \DescribeEnv{topic}
% The |topic| environment begins an itemize-like environment where the
%   argument of \cs{item[]} is typeset in font \cs{topiclabelfont}. A
%   line break is automatically inserted if the label is too long to
%   fit in the margin (this can be controlled by option |notopicbreak|).
%
% \subsection{Miscellaneous}
% \DescribeEnv{thebibliography}
% The |simplecv| document class also has some support for bibliography.
% You can use the |thebibliography| environment as usual, in
% particular wih BibTeX . The output is similar to the |topic|
% environment. If you separate your bibliography into several
% sections, you may want to use the |contbibnum| document class
% option.
%
% Note that this class also has support for right-to-left languages,
% such as hebrew (courtesy Dekel Tsur).
%
% \section{Customization}
%
% You can modify directly the fonts used in the document by using the
%   following macros. They take one parameter which is the font changing
%   command.
%
% \begin{description}
% \item \cs{headerfont} \DescribeMacro\headerfont the font used in
%    both headers. Defaults to sans serif.
% \item \cs{titlefont}  \DescribeMacro\titlefont the font used for the title.
%    Defaults to LARGE sans-serif semi bold condensed.
% \item \cs{sectionfont} \DescribeMacro\sectionfont the font used by
% \cs{section} when beginning a new topic. Defaults to sans-serif semi
%    bold condensed.
% \item \cs{subsectionfont} \DescribeMacro\subsectionfont the font
%    used by \cs{subsection} when beginning a new topic.
%    Defaults to sans-serif semi bold condensed.
% \item \cs{topiclabelfont}  \DescribeMacro\topiclabelfont the font used for
%    the items' labels. Defaults to sans-serif slanted.
% \item \cs{topictitlefont}  \DescribeMacro\topictitlefont the font used for
%    the items' titles (with option |topictitle|). Defaults to
%    sans-serif slanted.
% \end{description}
%
%  You can modify the following parameter using \cs{renewcommand}
% \begin{description}
% \item \cs{topicmargin} \DescribeMacro\topicmargin the left margin
%    inside topics. Defaults to $20\%$ of the column width
%    (|0.20\columnwidth|).
% \end{description}
%
% \StopEventually{\PrintChanges\PrintIndex}
%
% \section{The Implementation}
%
% The fonts used in the layout
% \begin{macro}{\sectionfont}
% \begin{macro}{\subsectionfont}
% \begin{macro}{\topiclabelfont}
% \changes{1.6}{2007/04/22}{renamed from \cs{itemfont}; the old name
% is kept as an alias for compatibility}
% \begin{macro}{\topictitlefont}
% \begin{macro}{\headerfont}
% \begin{macro}{\titlefont}
% \changes{1.2}{1998/12/01}{added, together with \cs{headerfont}}
%    \begin{macrocode}
%<*class>
\newcommand{\sectionfont}[1]{\def\cv@sec@fnt{#1}}
\newcommand{\subsectionfont}[1]{\def\cv@ssec@fnt{#1}}
\newcommand{\topiclabelfont}[1]{\def\cv@tlab@fnt{#1}}
\newcommand{\topictitlefont}[1]{\def\cv@ttit@fnt{#1}}
\newcommand{\headerfont}[1]{\def\cv@hd@fnt{#1}}
\newcommand{\titlefont}[1]{\def\cv@tit@fnt{#1}}
%    \end{macrocode}
% for compatibility
%    \begin{macrocode}
\let\itemfont=\topiclabelfont
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% Some document class options.
%    \begin{macrocode}
\DeclareOption{sf}{
  \sectionfont{\sffamily\fontseries{sbc}\selectfont}
  \subsectionfont{\sffamily\fontseries{sbc}\selectfont}
  \topiclabelfont{\sffamily\slshape}
  \topictitlefont{\sffamily\slshape}
  \headerfont{\sffamily}
  \titlefont{\sffamily\fontseries{sbc}\selectfont\LARGE}
}
\DeclareOption{plain}{
  \sectionfont{\bfseries}
  \subsectionfont{\bfseries}
  \topiclabelfont{\itshape}
  \topictitlefont{\itshape}
  \headerfont{}
  \titlefont{\bfseries\LARGE}
}
\newif\if@cv@topic@title \@cv@topic@titlefalse
\DeclareOption{topictitle}{
  \@cv@topic@titletrue
}
\newif\if@cv@topic@break \@cv@topic@breaktrue
\DeclareOption{notopicbreak}{
  \@cv@topic@breakfalse
}
\newif\if@cv@cont@bib@num \@cv@cont@bib@numfalse
\DeclareOption{contbibnum}{
  \@cv@cont@bib@numtrue
  \newcounter{cv@save@bib@num}
}
\newif\if@cv@title@above \@cv@title@abovefalse
\DeclareOption{titleabove}{
  \@cv@title@abovetrue
}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ExecuteOptions{sf,letterpaper,10pt,oneside,onecolumn,final}
\ProcessOptions
\LoadClass{article}
%    \end{macrocode}
% Support for RTL (Hebrew). This will be defined and set by babel for
% RtL languages, but we define it here for the benefit of others.
%    \begin{macrocode}
\newif\if@rl
%    \end{macrocode}
% \begin{macro}{\leftheader}
% \begin{macro}{\rightheader}
% The left and right headers. These are just saved in macros for use
% by \cs{maketitle}.
% \changes{1.2}{1998/12/01}{remove  optional
%   \meta{width} argument (with help from Amir Karger)}
% \changes{1.6}{2007/04/22}{Added optional argument for horizontal alignment}
%    \begin{macrocode}
\newcommand{\leftheader}[2][l]{\def\cv@lh@lr{#1}\def\cv@lh{#2}}
\newcommand{\rightheader}[2][l]{\def\cv@rh@lr{#1}\def\cv@rh{#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\title}
% The title (like ``Curriculum Vitae'' or the name of the author).It
% is just saved in a macro for use by \cs{maketitle}.
% \changes{1.2}{1998/12/01}{new command}
%    \begin{macrocode}
\renewcommand{\title}[1]{\def\cv@tit{#1}}
%    \end{macrocode}
% \end{macro}
% Default to empty.
%    \begin{macrocode}
\leftheader{}\rightheader{}\title{}
%    \end{macrocode}
% \begin{macro}{\maketitle}
% And now a command to actually show the headers
% \changes{1.6a}{2014/11/07}{Fix incompatibility with \texttt{array} package}
%    \begin{macrocode}
\newcommand{\cv@header}[2]{%
          \if@rl%
            \begin{tabular}[t]{@{\cv@hd@fnt\beginR}#1@{\endR}}%
          \else%
            \begin{tabular}[t]{@{\cv@hd@fnt}#1@{}}%
          \fi%
              #2%
          \end{tabular}}
\newcommand{\cv@do@title}{\par\bigskip
        \begin{center} \cv@tit@fnt\cv@tit\end{center}}
\renewcommand{\maketitle}{%
        \if@cv@title@above\cv@do@title\fi
        \par\noindent%
        \begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}l@{}}
        \expandafter\cv@header\cv@lh@lr\cv@lh%
           &\expandafter\cv@header\cv@rh@lr\cv@rh
        \end{tabular*}
        \par
        \if@cv@title@above\else\cv@do@title\fi
        \bigskip\par}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\section}
% Redefine \cs{section} to use \cs{cv@sec@fnt}
%    \begin{macrocode}
\renewcommand{\section}{
  \@startsection{section}{1}{\z@}
       {-3.5ex \@plus -1ex \@minus -.2ex}
       {2.3ex \@plus .2ex}{\cv@sec@fnt}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\subsection}
% Now the subsection
% \changes{1.3}{1999/02/09}{added (with
%   associated font command \cs{subsectionfont})}
%    \begin{macrocode}
\renewcommand{\subsection}{
  \@startsection{subsection}{1}{3em}
       {-3.5ex \@plus -1ex \@minus -.2ex}
       {2.3ex \@plus .2ex}{\cv@ssec@fnt}}
%    \end{macrocode}
% \end{macro}
% the other ones do not exist.
% \changes{1.1}{1998/11/06}{disable all sectionning commands other that
%   \cs{section}}
%    \begin{macrocode}
\let\subsubsection=\relax
\let\paragraph=\relax  \let\subparagraph=\relax
%    \end{macrocode}
% we do not want any numbering
% \changes{1.1}{1998/11/06}{disabled numbering of sections}
%    \begin{macrocode}
\setcounter{secnumdepth}{0}
%    \end{macrocode}
% \begin{macro}{\topicmargin}
% \changes{1.5}{2001/06/18}{now a macro that defaults to $20\%$ of text width}
% \changes{1.6}{2007/04/22}{Change default value to
%   $0.2$\cs{columnwidth}, to improve layout in two-columns mode}
% The left margin for topics
%    \begin{macrocode}
\newcommand{\topicmargin}{0.20\columnwidth}
\newlength{\t@picmargin}
%    \end{macrocode}
% \end{macro}
% \begin{environment}{topic}
% Define the topic environment.
%
% First the macros that typeset the label.
%    \begin{macrocode}
\newcommand{\@topic@makelabel}[1]{\cv@tlab@fnt #1\hfill}
\let\@topic@old@item=\@item
\newlength{\topic@label@length}
\def\@topic@item[#1]{%
        \@topic@old@item[#1]%
        \if@cv@topic@break%
                \settowidth{\topic@label@length}{#1}%
                \ifdim\topic@label@length>\labelwidth\mbox{}\\*\fi%
        \fi%
        \if@cv@topic@title%
          \mbox{}\cv@ttit@fnt%
          \everypar\expandafter{\the\everypar \normalfont}%
        \fi%
}
\newcommand{\@topic@setup}{%
        \setlength{\t@picmargin}{\topicmargin}
        \if@rl%
          \setlength{\leftmargin}{0cm}%
          \setlength{\rightmargin}{\t@picmargin}%
        \else%
          \setlength{\leftmargin}{\t@picmargin}%
          \setlength{\rightmargin}{0cm}%
        \fi%
        \setlength{\labelwidth}{0.8\t@picmargin}%
        \let\makelabel=\@topic@makelabel%
}
\newenvironment{topic}
        {\list{}
              {\@topic@setup%
               \let\@item=\@topic@item}}
        {\endlist}
%    \end{macrocode}
% \end{environment}
% \begin{environment}{thebibliography}
% \changes{1.1}{1998/11/06}{added \cs{refname}}
% \changes{1.3}{1999/02/09}{does not add a section by itself anymore;
%       remove \cs{refname}}
% Redefine the thebibliography environment to look like the topic
% environment. The argument of thebibliography is ignored.
% In older versions, the environment produced its own \cs{section}
% command, but this was removed in version 1.3 (following an idea of
% Reuben Thomas).
%    \begin{macrocode}
\renewenvironment{thebibliography}[1]
 {\list{\@biblabel{\theenumiv}}{%
        \@topic@setup%
        \@openbib@code%
        \usecounter{enumiv}%
        \let\p@enumiv\@empty%
        \renewcommand\theenumiv{\@arabic\c@enumiv}}%
        \if@cv@cont@bib@num%
          \setcounter{enumiv}{\value{cv@save@bib@num}}%
        \fi%
  \sloppy \clubpenalty 4000 \widowpenalty 4000 \sfcode`\.=\@m}%
 {\endlist%
  \if@cv@cont@bib@num%
    \setcounter{cv@save@bib@num}{\value{enumiv}}%
  \fi}
%</class>
%    \end{macrocode}
% \end{environment}
% \Finale

\endinput
