Debian Codegraph @

texmf-dist/source/xelatex/resumecls/resumecls.dtx

raw
1 % \iffalse meta-comment
2 %
3 % resumecls.dtx
4 % Copyright (C) 2012-2020 by huxuan <[email protected]>
5 %
6 % This work may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in
10 % http://www.latex-project.org/lppl.txt
11 % and version 1.3 or later is part of all distributions of LaTeX
12 % version 2005/12/01 or later.
13 %
14 % This work has the LPPL maintenance status `maintained'.
15 %
16 % The Current Maintainer of this work is huxuan <[email protected]>.
17 %
18 % This work consists of the files resumecls.dtx and resumecls.ins
19 % and the derived file resumecls.cls.
20 %
21 % \fi
22
23 % \iffalse
24 %<*driver>
25 \ProvidesFile{\jobname.dtx}
26 %</driver>
27 %<class>\NeedsTeXFormat{LaTeX2e}
28 %<class>\ProvidesClass{resumecls}
29 %<*class>
30 [2020/04/20 v0.4.1 Minor fix with enhanced examples]
31 %</class>
32 %
33 %<*driver>
34 \documentclass{ltxdoc}
35
36 \usepackage{color}
37 \definecolor{dkgreen}{rgb}{0,0.6,0}
38 \definecolor{gray}{rgb}{0.5,0.5,0.5}
39 \definecolor{mauve}{rgb}{0.58,0,0.82}
40
41 \usepackage[xetex,unicode,colorlinks]{hyperref}
42
43 \usepackage{listings}
44 \lstset{
45 backgroundcolor=\color{white},
46 basicstyle=\ttfamily,
47 columns=flexible,
48 breakatwhitespace=false,
49 breaklines=true,
50 captionpos=b,
51 frame=single,
52 numbers=left,
53 numbersep=5pt,
54 showspaces=false,
55 showstringspaces=false,
56 showtabs=false,
57 stepnumber=1,
58 rulecolor=\color{black},
59 tabsize=2,
60 texcl=true,
61 title=\lstname,
62 escapeinside={(*}{*)},
63 extendedchars=false,
64 mathescape=true,
65 xleftmargin=3em,
66 xrightmargin=3em,
67 numberstyle=\color{gray},
68 keywordstyle=\color{blue},
69 commentstyle=\color{dkgreen},
70 stringstyle=\color{mauve},
71 language={[LaTeX]TeX},
72 morekeywords={setmainfont,setCJKmainfont},
73 }
74 \EnableCrossrefs
75 \CodelineIndex
76 \RecordChanges
77 %\OnlyDescription
78 \begin{document}
79 \DocInput{\jobname.dtx}
80 \end{document}
81 %</driver>
82 % \fi
83 %
84 % \CheckSum{123}
85 %
86 % \CharacterTable
87 % {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
88 % 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
89 % Digits \0\1\2\3\4\5\6\7\8\9
90 % Exclamation \! Double quote \" Hash (number) \#
91 % Dollar \$ Percent \% Ampersand \&
92 % Acute accent \' Left paren \( Right paren \)
93 % Asterisk \* Plus \+ Comma \,
94 % Minus \- Point \. Solidus \/
95 % Colon \: Semicolon \; Less than \<
96 % Equals \= Greater than \> Question mark \?
97 % Commercial at \@ Left bracket \[ Backslash \\
98 % Right bracket \] Circumflex \^ Underscore \_
99 % Grave accent \` Left brace \{ Vertical bar \|
100 % Right brace \} Tilde \~}
101 %
102 % \changes{v0.1}{2012/12/19}{Initial version with dtx}
103 % \changes{v0.1.1}{2012/12/19}{Minor bug fix}
104 % \changes{v0.1.2}{2012/12/19}{Customization part in documentation}
105 % \changes{v0.1.3}{2012/12/19}{Add reference settings}
106 % \changes{v0.1.4}{2012/12/20}{Use bfseries for better English support}
107 % \changes{v0.2}{2013/03/07}{First try to upload to CTAN}
108 % \changes{v0.2.1}{2013/03/17}{Celebrate for being included in CTAN}
109 % \changes{v0.3}{2013/06/17}{Long time no see, resumecls}
110 % \changes{v0.3.1}{2015/09/20}{Compatible with TeXLive 2015 now}
111 % \changes{v0.3.2}{2015/09/21}{Welcome, contributors}
112 % \changes{v0.4.0}{2020/04/16}{Hello 2020}
113 % \changes{v0.4.1}{2020/04/20}{Minor fix with enhanced examples}
114 %
115 % \GetFileInfo{\jobname.dtx}
116 %
117 % \DoNotIndex{\\,\begin,\bfseries,\bibliographystyle,\bibsep,\colorbox}
118 % \DoNotIndex{\CurrentOption,\DeclareOption,\def,\definecolor,\else,\end}
119 % \DoNotIndex{\fancyfoot,\fancyhf,\fi,\footnotesize,\footrulewidth}
120 % \DoNotIndex{\headrulewidth,\heiti,\href,\hspace,\hypersetup,\ifrclscolor}
121 % \DoNotIndex{\LoadClass,\maketitle,\newcommand,\newif,\pagestyle,\parbox}
122 % \DoNotIndex{\PassOptionsToClass,\ProcessOptions,\rclsaddress,\rclscolorfalse}
123 % \DoNotIndex{\rclscolortrue,\rclshomepage,\rclsleftfooter,\rclsmail}
124 % \DoNotIndex{\rclsmobile,\rclsname,\rclsorganization,\rclsrightfooter}
125 % \DoNotIndex{\rightfooter,\refname,\relax,\renewcommand,\RequirePackage}
126 % \DoNotIndex{\setlength,\textwidth,\url,\zihao}
127 % \DoNotIndex{}
128 %
129 % \def\resumecls{\textsf{resumecls}\ }
130 %
131 % \title{The \resumecls package\thanks{This document
132 % corresponds to \resumecls\fileversion,
133 % dated~\filedate.}}
134 % \author{huxuan \\ \texttt{[email protected]}}
135 % \date{\filedate}
136 %
137 % \maketitle
138 %
139 % \begin{abstract}
140 % \resumecls is a document class to typeset a resume or cv both in English and
141 % Chinese with more ease and flexibility.
142 % \end{abstract}
143 %
144 % \section{Introduction}
145 %
146 % There do exist many resume document classes already. But from my experience,
147 % most of them are a little bit complicated or lack of flexibility.
148 %
149 % \resumecls make all contents consists of heading/entry based on tabularx.
150 % You can easily design the style and some recommended patterns are also listed
151 % in the example.
152 %
153 % What's more, \resumecls has CTeX intergated which means it support Chinese
154 % natively. The example tex files for both English and Chinese are almost the
155 % same except for the actual content. You can just focus on the content and
156 % have your resume both in English and Chinese with no more work.
157 %
158 % \section{Usage}
159 %
160 % \DescribeMacro{\heading}
161 % The heading part for each section.
162 %
163 % \DescribeMacro{\entry}
164 % All entry-like contents except for the heading.
165 %
166 % \DescribeMacro{\name}
167 % Your Name.
168 %
169 % \DescribeMacro{\organization}
170 % Your unit, shcool or organization.
171 %
172 % \DescribeMacro{\address}
173 % Your address and possibily with zip code.
174 %
175 % \DescribeMacro{\mobile}
176 % Your phone number.
177 %
178 % \DescribeMacro{\mail}
179 % Your email address.
180 %
181 % \DescribeMacro{\homepage}
182 % Your homepage.
183 %
184 % \DescribeMacro{\leftfooter}
185 % The content you want to put at left footer. Feel free to leave it empty.
186 %
187 % \DescribeMacro{\rightrfooter}
188 % The content you want to put at right footer. Feel free to leave it empty.
189 %
190 % \StopEventually{\PrintChanges\PrintIndex}
191 %
192 % \section{Implementation}
193 %
194 % \subsection{Options}
195 % \begin{macrocode}
196 \newif\ifrclscolor\rclscolorfalse
197 \DeclareOption{color}{\rclscolortrue}
198 % \end{macrocode}
199 %
200 % \subsection{Import article class}
201 % \begin{macrocode}
202 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexart}}
203 \ProcessOptions\relax
204 \LoadClass[a4paper,12pt]{ctexart}
205 % \end{macrocode}
206 %
207 % \subsection{Import packages}
208 % \begin{macrocode}
209 \RequirePackage[top=.5in,bottom=.5in,left=.5in,right=.5in]{geometry}
210 \RequirePackage[xetex,unicode]{hyperref}
211 \RequirePackage{tabularx}
212 \RequirePackage{color}
213 \RequirePackage{fancyhdr}
214 % \end{macrocode}
215 %
216 % \subsection{Color Settings}
217 %
218 % \subsubsection{Background color for heading}
219 % \begin{macrocode}
220 \definecolor{heading}{gray}{0.85}
221 % \end{macrocode}
222 %
223 % \subsubsection{Color for hyperlink}
224 % \begin{macrocode}
225 \ifrclscolor
226 \hypersetup{colorlinks}
227 \else
228 \hypersetup{hidelinks}
229 \fi
230 % \end{macrocode}
231 %
232 % \subsection{Reference Settings}
233 %
234 % \begin{macrocode}
235 \RequirePackage[sort&compress]{natbib}
236 \bibliographystyle{unsrt}
237 \setlength{\bibsep}{0pt}
238 % \end{macrocode}
239 %
240 % \subsection{Content Variable}
241 %
242 % \begin{macro}{\name}
243 % \begin{macrocode}
244 \def\rclsname{}
245 \newcommand\name[1]{\def\rclsname{#1}}
246 % \end{macrocode}
247 % \end{macro}
248 %
249 % \begin{macro}{\organization}
250 % \begin{macrocode}
251 \def\rclsorganization{}
252 \newcommand\organization[1]{\def\rclsorganization{#1}}
253 % \end{macrocode}
254 % \end{macro}
255 %
256 % \begin{macro}{\address}
257 % \begin{macrocode}
258 \def\rclsaddress{}
259 \newcommand\address[1]{\def\rclsaddress{#1}}
260 % \end{macrocode}
261 % \end{macro}
262 %
263 % \begin{macro}{\mobile}
264 % \begin{macrocode}
265 \def\rclsmobile{}
266 \newcommand\mobile[1]{\def\rclsmobile{#1}}
267 % \end{macrocode}
268 % \end{macro}
269 %
270 % \begin{macro}{\mail}
271 % \begin{macrocode}
272 \def\rclsmail{}
273 \newcommand\mail[1]{\def\rclsmail{#1}}
274 % \end{macrocode}
275 % \end{macro}
276 %
277 % \begin{macro}{\homepage}
278 % \begin{macrocode}
279 \def\rclshomepage{}
280 \newcommand\homepage[1]{\def\rclshomepage{#1}}
281 % \end{macrocode}
282 % \end{macro}
283 %
284 % \begin{macro}{\leftfooter}
285 % \begin{macrocode}
286 \def\rclsleftfooter{}
287 \newcommand\leftfooter[1]{\def\rclsleftfooter{#1}}
288 % \end{macrocode}
289 % \end{macro}
290 %
291 % \begin{macro}{\rightfooter}
292 % \begin{macrocode}
293 \def\rclsrightfooter{}
294 \newcommand\rightfooter[1]{\def\rclsrightfooter{#1}}
295 % \end{macrocode}
296 % \end{macro}
297 %
298 % \subsection{Custom commands}
299 %
300 % \begin{macro}{\heading}
301 % \begin{macrocode}
302 \newcommand{\heading}[1]{%
303 \colorbox{heading}{%
304 \parbox{.98\textwidth}{%
305 \bfseries\zihao{4}#1
306 }
307 } \\
308 }
309 % \end{macrocode}
310 % \end{macro}
311 %
312 % \begin{macro}{\entry}
313 % \begin{macrocode}
314 \newcommand{\entry}[3]{%
315 \begin{tabularx}{\textwidth}{@{\hspace{#1}}#2}
316 #3
317 \end{tabularx}
318 }
319 % \end{macrocode}
320 % \end{macro}
321 %
322 % \subsection{Style settings}
323 %
324 % \subsubsection{Redefine maketitle}
325 % \begin{macrocode}
326 \renewcommand{\maketitle}{%
327 \entry{0em}{Xr}{%
328 \bfseries\zihao{4}\rclsname & \rclsmobile \\
329 \rclsorganization & \href{mailto:\rclsmail}{\rclsmail} \\
330 \rclsaddress & \url{\rclshomepage} \\
331 }
332 }
333 % \end{macrocode}
334 %
335 % \subsubsection{Header and footer settings}
336 % \begin{macrocode}
337 \pagestyle{fancy}
338 \fancyhf{}
339 \renewcommand{\headrulewidth}{0pt}
340 \renewcommand{\footrulewidth}{0pt}
341 \fancyfoot[L]{\footnotesize \rclsleftfooter}
342 \fancyfoot[R]{\footnotesize \rclsrightfooter}
343 % \end{macrocode}
344 %
345 % \subsubsection{Empty refname}
346 %
347 % \begin{macrocode}
348 \renewcommand{\refname}{}
349 % \end{macrocode}
350 %
351 % \subsection{Customization}
352 %
353 % \subsubsection{Font settings}
354 %
355 % Since we use Xe\LaTeX{} and CTeX, everything should be fine with no extra
356 % configuration. But if you dedicated to, you can change the font as you like
357 % only if Xe\LaTeX{} or CTeX supported.
358 %
359 % \subsubsection{Multiple pages}
360 %
361 % Since the document generated from \resumecls is just a bunch of tables, it is
362 % prettey straightfoward to enclose the contents in multiple table environments
363 % and use |\clearpage| to split them into multiple pages. A minimal example
364 % looks like the following:
365 %
366 % \iffalse
367 %<*lst>
368 % \fi
369 \begin{lstlisting}
370 \begin{table}
371 Contents for Page 1
372 \end{table}
373 \clearpage
374 \begin{table}
375 Contents for Page 2
376 \end{table}
377 \end{lstlisting}
378 % \iffalse
379 %</lst>
380 % \fi
381 %
382 % \section{Contributors}
383 %
384 % Please refer to
385 % \href{https://github.com/huxuan/resumecls/graphs/contributors}{Contributors}.
386 %
387 % \Finale
388 \endinput