% \iffalse meta-comment
%
% resumecls.dtx
% Copyright (C) 2012-2020 by huxuan <i@huxuan.org>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% 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.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is huxuan <i@huxuan.org>.
%
% This work consists of the files resumecls.dtx and resumecls.ins
% and the derived file resumecls.cls.
%
% \fi

% \iffalse
%<*driver>
\ProvidesFile{\jobname.dtx}
%</driver>
%<class>\NeedsTeXFormat{LaTeX2e}
%<class>\ProvidesClass{resumecls}
%<*class>
    [2020/04/20 v0.4.1 Minor fix with enhanced examples]
%</class>
%
%<*driver>
\documentclass{ltxdoc}

\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

\usepackage[xetex,unicode,colorlinks]{hyperref}

\usepackage{listings}
\lstset{
    backgroundcolor=\color{white},
    basicstyle=\ttfamily,
    columns=flexible,
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    frame=single,
    numbers=left,
    numbersep=5pt,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    stepnumber=1,
    rulecolor=\color{black},
    tabsize=2,
    texcl=true,
    title=\lstname,
    escapeinside={(*}{*)},
    extendedchars=false,
    mathescape=true,
    xleftmargin=3em,
    xrightmargin=3em,
    numberstyle=\color{gray},
    keywordstyle=\color{blue},
    commentstyle=\color{dkgreen},
    stringstyle=\color{mauve},
    language={[LaTeX]TeX},
    morekeywords={setmainfont,setCJKmainfont},
}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%\OnlyDescription
\begin{document}
    \DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{123}
%
% \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         \~}
%
% \changes{v0.1}{2012/12/19}{Initial version with dtx}
% \changes{v0.1.1}{2012/12/19}{Minor bug fix}
% \changes{v0.1.2}{2012/12/19}{Customization part in documentation}
% \changes{v0.1.3}{2012/12/19}{Add reference settings}
% \changes{v0.1.4}{2012/12/20}{Use bfseries for better English support}
% \changes{v0.2}{2013/03/07}{First try to upload to CTAN}
% \changes{v0.2.1}{2013/03/17}{Celebrate for being included in CTAN}
% \changes{v0.3}{2013/06/17}{Long time no see, resumecls}
% \changes{v0.3.1}{2015/09/20}{Compatible with TeXLive 2015 now}
% \changes{v0.3.2}{2015/09/21}{Welcome, contributors}
% \changes{v0.4.0}{2020/04/16}{Hello 2020}
% \changes{v0.4.1}{2020/04/20}{Minor fix with enhanced examples}
%
% \GetFileInfo{\jobname.dtx}
%
% \DoNotIndex{\\,\begin,\bfseries,\bibliographystyle,\bibsep,\colorbox}
% \DoNotIndex{\CurrentOption,\DeclareOption,\def,\definecolor,\else,\end}
% \DoNotIndex{\fancyfoot,\fancyhf,\fi,\footnotesize,\footrulewidth}
% \DoNotIndex{\headrulewidth,\heiti,\href,\hspace,\hypersetup,\ifrclscolor}
% \DoNotIndex{\LoadClass,\maketitle,\newcommand,\newif,\pagestyle,\parbox}
% \DoNotIndex{\PassOptionsToClass,\ProcessOptions,\rclsaddress,\rclscolorfalse}
% \DoNotIndex{\rclscolortrue,\rclshomepage,\rclsleftfooter,\rclsmail}
% \DoNotIndex{\rclsmobile,\rclsname,\rclsorganization,\rclsrightfooter}
% \DoNotIndex{\rightfooter,\refname,\relax,\renewcommand,\RequirePackage}
% \DoNotIndex{\setlength,\textwidth,\url,\zihao}
% \DoNotIndex{}
%
% \def\resumecls{\textsf{resumecls}\ }
%
% \title{The \resumecls package\thanks{This document
% corresponds to \resumecls\fileversion,
% dated~\filedate.}}
% \author{huxuan \\ \texttt{i@huxuan.org}}
% \date{\filedate}
%
% \maketitle
%
% \begin{abstract}
% \resumecls is a document class to typeset a resume or cv both in English and
% Chinese with more ease and flexibility.
% \end{abstract}
%
% \section{Introduction}
%
% There do exist many resume document classes already. But from my experience,
% most of them are a little bit complicated or lack of flexibility.
%
% \resumecls make all contents consists of heading/entry based on tabularx.
% You can easily design the style and some recommended patterns are also listed
% in the example.
%
% What's more, \resumecls has CTeX intergated which means it support Chinese
% natively. The example tex files for both English and Chinese are almost the
% same except for the actual content. You can just focus on the content and
% have your resume both in English and Chinese with no more work.
%
% \section{Usage}
%
% \DescribeMacro{\heading}
% The heading part for each section.
%
% \DescribeMacro{\entry}
% All entry-like contents except for the heading.
%
% \DescribeMacro{\name}
% Your Name.
%
% \DescribeMacro{\organization}
% Your unit, shcool or organization.
%
% \DescribeMacro{\address}
% Your address and possibily with zip code.
%
% \DescribeMacro{\mobile}
% Your phone number.
%
% \DescribeMacro{\mail}
% Your email address.
%
% \DescribeMacro{\homepage}
% Your homepage.
%
% \DescribeMacro{\leftfooter}
% The content you want to put at left footer. Feel free to leave it empty.
%
% \DescribeMacro{\rightrfooter}
% The content you want to put at right footer. Feel free to leave it empty.
%
% \StopEventually{\PrintChanges\PrintIndex}
%
% \section{Implementation}
%
% \subsection{Options}
%    \begin{macrocode}
\newif\ifrclscolor\rclscolorfalse
\DeclareOption{color}{\rclscolortrue}
%    \end{macrocode}
%
% \subsection{Import article class}
%    \begin{macrocode}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexart}}
\ProcessOptions\relax
\LoadClass[a4paper,12pt]{ctexart}
%    \end{macrocode}
%
% \subsection{Import packages}
%    \begin{macrocode}
\RequirePackage[top=.5in,bottom=.5in,left=.5in,right=.5in]{geometry}
\RequirePackage[xetex,unicode]{hyperref}
\RequirePackage{tabularx}
\RequirePackage{color}
\RequirePackage{fancyhdr}
%    \end{macrocode}
%
% \subsection{Color Settings}
%
% \subsubsection{Background color for heading}
%    \begin{macrocode}
\definecolor{heading}{gray}{0.85}
%    \end{macrocode}
%
% \subsubsection{Color for hyperlink}
%    \begin{macrocode}
\ifrclscolor
    \hypersetup{colorlinks}
\else
    \hypersetup{hidelinks}
\fi
%    \end{macrocode}
%
% \subsection{Reference Settings}
%
%    \begin{macrocode}
\RequirePackage[sort&compress]{natbib}
\bibliographystyle{unsrt}
\setlength{\bibsep}{0pt}
%    \end{macrocode}
%
% \subsection{Content Variable}
%
% \begin{macro}{\name}
%    \begin{macrocode}
\def\rclsname{}
\newcommand\name[1]{\def\rclsname{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\organization}
%    \begin{macrocode}
\def\rclsorganization{}
\newcommand\organization[1]{\def\rclsorganization{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\address}
%    \begin{macrocode}
\def\rclsaddress{}
\newcommand\address[1]{\def\rclsaddress{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mobile}
%    \begin{macrocode}
\def\rclsmobile{}
\newcommand\mobile[1]{\def\rclsmobile{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\mail}
%    \begin{macrocode}
\def\rclsmail{}
\newcommand\mail[1]{\def\rclsmail{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\homepage}
%    \begin{macrocode}
\def\rclshomepage{}
\newcommand\homepage[1]{\def\rclshomepage{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\leftfooter}
%    \begin{macrocode}
\def\rclsleftfooter{}
\newcommand\leftfooter[1]{\def\rclsleftfooter{#1}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\rightfooter}
%    \begin{macrocode}
\def\rclsrightfooter{}
\newcommand\rightfooter[1]{\def\rclsrightfooter{#1}}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Custom commands}
%
% \begin{macro}{\heading}
%    \begin{macrocode}
\newcommand{\heading}[1]{%
    \colorbox{heading}{%
        \parbox{.98\textwidth}{%
            \bfseries\zihao{4}#1
        }
    } \\
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\entry}
%    \begin{macrocode}
\newcommand{\entry}[3]{%
    \begin{tabularx}{\textwidth}{@{\hspace{#1}}#2}
        #3
    \end{tabularx}
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Style settings}
%
% \subsubsection{Redefine maketitle}
%    \begin{macrocode}
\renewcommand{\maketitle}{%
    \entry{0em}{Xr}{%
        \bfseries\zihao{4}\rclsname & \rclsmobile \\
        \rclsorganization & \href{mailto:\rclsmail}{\rclsmail} \\
        \rclsaddress & \url{\rclshomepage} \\
    }
}
%    \end{macrocode}
%
% \subsubsection{Header and footer settings}
%    \begin{macrocode}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[L]{\footnotesize \rclsleftfooter}
\fancyfoot[R]{\footnotesize \rclsrightfooter}
%    \end{macrocode}
%
% \subsubsection{Empty refname}
%
%    \begin{macrocode}
\renewcommand{\refname}{}
%    \end{macrocode}
%
% \subsection{Customization}
%
% \subsubsection{Font settings}
%
% Since we use Xe\LaTeX{} and CTeX, everything should be fine with no extra
% configuration. But if you dedicated to, you can change the font as you like
% only if Xe\LaTeX{} or CTeX supported.
%
% \subsubsection{Multiple pages}
%
% Since the document generated from \resumecls is just a bunch of tables, it is
% prettey straightfoward to enclose the contents in multiple table environments
% and use |\clearpage| to split them into multiple pages. A minimal example
% looks like the following:
%
% \iffalse
%<*lst>
% \fi
\begin{lstlisting}
\begin{table}
Contents for Page 1
\end{table}
\clearpage
\begin{table}
Contents for Page 2
\end{table}
\end{lstlisting}
% \iffalse
%</lst>
% \fi
%
% \section{Contributors}
%
% Please refer to
% \href{https://github.com/huxuan/resumecls/graphs/contributors}{Contributors}.
%
% \Finale
\endinput
