Debian Codegraph @

texmf-dist/doc/latex/mycv/Doc/mycv.tex

raw
1 % ----------------------------------------------------------
2 % ** This file was automatically generated by <DoPackage.sh>
3 % ** with option(s) 'ctan'.
4 % ** Date: Sun May 20 21:31:48 CEST 2012::1337542308
5 % ----------------------------------------------------------
6 % -------------------------------------------------------
7 % Copyright 2012 Ghersi Andrea ([email protected]).
8 %
9 % This work may be distributed and/or modified under the
10 % conditions of the LaTeX Project Public License version
11 % 1.3c, available at 'http://www.latex-project.org/lppl'.
12 % -------------------------------------------------------
13 \def\version{1.5.6}
14 \newif\ifdraft
15
16 \newif\ifparchment
17 \parchmenttrue
18
19 \documentclass[
20 10pt,
21 a4paper,oneside,openany,
22 titlepage,
23 fleqn,
24 headinclude,footinclude,
25 BCOR5mm,
26 numbers=noenddot,
27 cleardoublepage=empty,
28 captions=tableheading
29 \ifdraft
30 ,draft
31 \else
32 \fi
33 ]{scrreprt}
34
35 \usepackage[backref]{classicthesis-ldpkg}
36 \usepackage[
37 eulerchapternumbers,
38 subfig,
39 beramono,
40 eulermath,
41 pdfspacing,
42 dottedtoc
43 ]{classicthesis}
44
45 \usepackage[english]{arsclassica}
46
47 \usepackage[utf8x]{inputenc}
48
49 \usepackage[english]{babel}
50
51 \usepackage{textcomp}
52
53 \usepackage{empheq}
54
55 \usepackage{calligra}
56
57 \usepackage{todonotes}
58
59 \setlength{\parindent}{0pt}
60
61 \usepackage{comment}
62
63 \usepackage{listings}
64
65
66 \ifdraft
67 \overfullrule=5pt
68 \fi
69
70 \hypersetup{citecolor=webgreen}
71 \hypersetup{pdfstartpage=1}
72
73 \hypersetup{%
74 pdfstartpage = 1,
75 pdfauthor = Andrea Ghersi,
76 pdftitle = MyCV,
77 pdfsubject = MyCV class documentation,
78 pdfproducer = \LaTeX{},
79 pdfkeywords = {},
80 pdfcreator = \LaTeX{} with 'arsclassica'
81 }
82
83 \newcommand{\myTitle}{MyCV\xspace}
84 \newcommand{\myName}{Andrea Ghersi\xspace}
85 \newcommand{\myMail}{[email protected]}
86
87 \areaset{412pt}{749pt}
88
89 \titleformat{\section}%
90 {\color{red}\normalfont\Large\bfseries\bf}%
91 {\color{red}\MakeTextLowercase{\thesection}}{1em}{\spacedlowsmallcaps}
92
93 \titleformat{\subsection}%
94 {\color{orange}\normalfont\bfseries\bf}
95 {\textsc{\MakeTextLowercase{\thesubsection}}}{1em}{\normalsize}
96
97 \titleformat{\subsubsection}%
98 {\color{cyan}\normalfont\bfseries\bf}
99 {\textsc{\MakeTextLowercase{\thesubsection}}}{1em}{\small}
100
101 \renewcommand*\cftchapfont{\color{red}\bfseries}
102 \renewcommand*\cftsecfont{\color{gray}\bfseries}
103
104 \def\chapterautorefname{chapter}
105 \def\sectionautorefname{section}
106 \def\subsectionautorefname{subsection}
107
108 \def\myitemsep{5pt}
109
110 \newcommand{\squishlist}[1][\myitemsep]{%
111 \begin{list}{$\triangleright$}%
112 {
113 \setlength{\parskip}{5pt}%
114 \setlength{\itemsep}{#1}%
115 \setlength{\parsep}{5pt}%
116 \setlength{\topsep}{5pt}%
117 \setlength{\partopsep}{0pt}%
118 \setlength{\leftmargin}{2.5em}%
119 \setlength{\labelwidth}{1em}%
120 \setlength{\labelsep}{0.5em}%
121 }}
122
123 \newcommand{\squishend}{%
124 \end{list}}
125
126 \newcommand{\quotes}[3][0]{%
127 \definecolor{authorcolor}{RGB}{51, 153, 51}
128 \definecolor{datecolor} {RGB}{51, 153, 51}
129 %
130 \noindent\makebox[0.90\textwidth]{%
131 \begin{minipage}[t]{0.50\textwidth}%
132 \hfill%
133 \end{minipage}%
134 \begin{minipage}[t]{0.50\textwidth}%
135 {\small\ignorespaces\slshape #2}\\[0.5em]%
136 \medskip%
137 \hfill\texttt{---} {{\color{authorcolor}{#3}}}%
138 \ifnum#1>0%
139 \xspace[{\color{datecolor}{#1}}]%
140 \fi%
141 \end{minipage}%
142 }}
143
144 \newcommand{\myref}[1]{{\color{blue}(\autoref{#1})}\xspace}
145 \newcommand{\myreftwo}[1]{{\color{blue}(see~\autoref{#1})}\xspace}
146
147 \newcommand{\keyword}[1]{{\footnotesize\textbf{#1}}\xspace}
148
149 \newcommand{\argvsep}{\\[5pt]}
150 \newcommand{\arghsep}{\;\;}
151 \newcommand{\cmdvsep}{\\[5pt]}
152 \newcommand{\cmdhsep}{\;\;}
153 \newcommand{\cmddsep}{\par\medskip}
154 \newcommand{\optvsep}{\\[5pt]}
155 \newcommand{\opthsep}{\;\;}
156 \newcommand{\optdsep}{\par}
157 \newcommand{\sep}{\medskip}
158 \newcommand{\argname}[2][black]{{\color{#1}{$\langle$\textit{#2}$\rangle$}}}
159 \newcommand{\cmdname}[2][brown]{{\color{#1}{\textbf{\textbackslash#2}}}}
160 \newcommand{\optname}[2][brown]{{\color{#1}{\textbf{#2}}}}
161 \newcommand{\classname}{{\color{blue}{\textit{MyCV}}}\xspace}
162 \newcommand{\codeskip}{\medskip}
163 \newcommand{\DPL}{\keyword{DPL}}
164 \newcommand{\SPL}{\keyword{SPL}}
165 \newcommand{\CV}{\keyword{CV}}
166
167 \newcommand{\marg}[1]{%
168 \fbox{%
169 {\color{red}\textbf{\{}}$\langle$%
170 \textit{#1}%
171 $\rangle${\color{red}\textbf{\}}}}%
172 }
173
174 \newcommand{\dargone}[2]{%
175 \fbox{%
176 {\color{cyan}\textbf{[}}$\langle$%
177 \textit{#1}%
178 $\rangle${\color{cyan}\textbf{]}}%
179 }\;$\longrightarrow$\;{\color{blue}\textbf{[}\textit{#2}\textbf{]}}}
180
181 \newcommand{\dargtwo}[2]{%
182 \fbox{%
183 {\color{cyan}\textbf{<}}$\langle$%
184 \textit{#1}%
185 $\rangle${\color{cyan}\textbf{>}}%
186 }\;$\longrightarrow$\;{\color{blue}\textbf{<}\textit{#2}\textbf{>}}}
187
188 \newenvironment{myindent}[1][0.2in]%
189 { \begin{list}{}{%
190 \setlength{\topsep}{0pt}%
191 \setlength{\leftmargin}{#1}%
192 \setlength{\partopsep}{0pt}%
193 \setlength{\parsep}{\parskip}}\item[]%
194 }
195 {\end{list}}
196
197 \newcommand{\ctext}[2][red]{{\color{#1}{#2}}}
198
199 \newcommand{\omissis}{[\dots\negthinspace]}
200
201 \definecolor{lightergray}{gray}{0.99}
202
203 \lstnewenvironment{latexcode}[1][]{%
204 \small
205 \lstset{language=[LaTeX]Tex,
206 keywordstyle=\color{RoyalBlue},
207 basicstyle=\normalfont\ttfamily,
208 commentstyle=\color{Emerald}\ttfamily,
209 stringstyle=\rmfamily,
210 numbers=none,
211 numberstyle=\scriptsize\color{gray},
212 stepnumber=1,
213 numbersep=8pt,
214 showstringspaces=false,
215 breaklines=true,
216 frameround=ftff,
217 frame=lines,
218 moredelim=[is][\color{orange}]{|}{|},
219 moredelim=[is][\color{brown}]{$}{$},
220 moredelim=[is][\color{red}]{&}{&},
221 moredelim=[is][\textbf]{||}{||},
222 backgroundcolor=\color{lightergray},
223 #1
224 }
225 \lstset{
226 morekeywords=%
227 {%
228 RequirePackage,newboolean,DeclareOption,setboolean,%
229 ProcessOptions,PackageError,ifthenelse,boolean,%
230 MakeTextLowercase,@ifpackageloaded,undefined,%
231 DeclareRobustCommand,MakeTextUppercase,conditionalblock,%
232 color,titlerule,titlespacing,ifmodel,ifoption,mypdftitle,%
233 labelitemi,hypersetup,setlength,mydecorationsSetLineWidth,
234 mydecorationsPathmorphing,mycfoot,myrenderlayout,cvdec,%
235 definecolor,includegraphics,ifdefined,mcbegin,mcend,%
236 ProvidesPackage,PackageInfo,PackageWarningNoLine,%
237 @ifclassloaded,ExecuteOptions,PackageWarning,textcolor%
238 },%
239 commentstyle=\color{Emerald}\ttfamily,%
240 frame=lines%
241 }
242 }{\codeskip}
243
244 \ifparchment
245
246 \usepackage{framed}
247 \usetikzlibrary{decorations.pathmorphing,decorations.shapes,calc}
248 \pgfmathsetseed{1}
249 \pgfdeclarelayer{background}
250 \pgfsetlayers{background,main}
251
252 \tikzset{
253 normal border/.style={lightgray!12,
254 decorate, decoration={shape, segment length=0.5cm, amplitude=.7mm}},
255 torn border/.style={orange!30!black!5, decorate,
256 decoration={random steps, segment length=.5cm, amplitude=1.7mm}}}
257
258 \def\parchmentframe#1{
259 \tikz{
260 \node[inner sep=2em] (A) {#1};
261 \begin{pgfonlayer}{background}
262 \fill[normal border]
263 (A.south east) -- (A.south west) --
264 (A.north west) -- (A.north east) -- cycle;
265 \end{pgfonlayer}}}
266
267 \def\parchmentframetop#1{
268 \tikz{
269 \node[inner sep=2em] (A) {#1};
270 \begin{pgfonlayer}{background}
271 \fill[normal border]
272 (A.south east) -- (A.south west) --
273 (A.north west) -- (A.north east) -- cycle;
274 \fill[torn border]
275 ($(A.south east)-(0,.2)$) -- ($(A.south west)-(0,.2)$) --
276 ($(A.south west)+(0,.2)$) -- ($(A.south east)+(0,.2)$) -- cycle;
277 \end{pgfonlayer}}}
278
279 \def\parchmentframebottom#1{
280 \tikz{
281 \node[inner sep=2em] (A) {#1};
282 \begin{pgfonlayer}{background}
283 \fill[normal border]
284 (A.south east) -- (A.south west) --
285 (A.north west) -- (A.north east) -- cycle;
286 \fill[torn border]
287 ($(A.north east)-(0,.2)$) -- ($(A.north west)-(0,.2)$) --
288 ($(A.north west)+(0,.2)$) -- ($(A.north east)+(0,.2)$) -- cycle;
289 \end{pgfonlayer}}}
290
291 \def\parchmentframemiddle#1{
292 \tikz{
293 \node[inner sep=2em] (A) {#1};
294 \begin{pgfonlayer}{background}
295 \fill[normal border]
296 (A.south east) -- (A.south west) --
297 (A.north west) -- (A.north east) -- cycle;
298 \fill[torn border]
299 ($(A.south east)-(0,.2)$) -- ($(A.south west)-(0,.2)$) --
300 ($(A.south west)+(0,.2)$) -- ($(A.south east)+(0,.2)$) -- cycle;
301 \fill[torn border]
302 ($(A.north east)-(0,.2)$) -- ($(A.north west)-(0,.2)$) --
303 ($(A.north west)+(0,.2)$) -- ($(A.north east)+(0,.2)$) -- cycle;
304 \end{pgfonlayer}}}
305
306 \newenvironment{parchment}{%[1][Example]{%
307 \def\FrameCommand{\parchmentframe}%
308 \def\FirstFrameCommand{\parchmentframetop}%
309 \def\LastFrameCommand{\parchmentframebottom}%
310 \def\MidFrameCommand{\parchmentframemiddle}%
311 \vskip\baselineskip
312 \MakeFramed {\FrameRestore}}
313 {\endMakeFramed}
314 \fi
315
316 \begin{document}
317 \pagestyle{useheadings}
318 \pagestyle{plain}
319
320 \pagenumbering{roman}
321
322 \begin{titlepage}
323 \begin{center}
324
325 \renewcommand{\thefootnote}{\fnsymbol{footnote}}
326 \newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
327
328 \def\versionMsg{This file has version number \version{} \texttt{---} %
329 documentation dated April 13, 2012 \texttt{---} %
330 last revised \today}
331
332 \textsc{\large\color{gray}\today}\\[0.5cm]
333
334 \HRule\\[0.4cm]%
335 {\huge\medskip\bfseries\myTitle\footnote{\versionMsg}}\\[0.4cm]%
336 \HRule\\[1.5cm]
337
338 \large\emph{Author:}\\
339 \href{mailto:\myMail}{\textsc{\myName}}
340
341 \vspace{20pt}
342 \includegraphics[width=0.30\textwidth]{Images/logo-1.png}\\[1cm]
343
344 \vspace{10pt}
345 \textbf{\textit{Abstract}}\normalsize\par\bigskip
346 \begin{minipage}{0.75\textwidth}
347 \noindent
348 This \LaTeX{} class provides a set of functionality for writing \textit{curriculum vit\ae{}}
349 with different layouts. To achieve this goal, it adopts a different approach with respect
350 to the other c.v. classes or packages.
351
352 Basically, the idea is that a user can write some custom configuration directives, by means of which
353 is possible both to produce different c.v. layouts and quickly switch among them.
354
355 In order to process such directives, this class uses a set of lists, provided by the package
356 \textit{etextools}. A basic support for \textit{TikZ} decorations is also provided.
357
358 \end{minipage}
359
360 \renewcommand{\thefootnote}{\arabic{footnote}}\setcounter{footnote}{0}
361
362 \end{center}
363 \end{titlepage}
364 \pagestyle{scrheadings}
365
366 \pdfbookmark{\contentsname}{tableofcontents}
367 \setcounter{tocdepth}{2}
368 \tableofcontents
369 \cleardoublepage
370
371 \pagenumbering{arabic}
372 \chapter{Fundamentals}
373 \quotes[1973]{
374 ``Computer programming is an art, because it applies
375 accumulated knowledge to the world, because it
376 requires skill and ingenuity, and especially because
377 it produces objects of beauty''
378 }{Knuth}
379 \ifparchment\begin{parchment}\fi
380 \section{Introduction}
381
382 The main goal of this class (\classname) is to give support for creating \textit{curriculum
383 vit\ae{}} (\CV) with different layouts, allowing easy switching among them.
384 The class also provides basic support for using the \textit{TikZ} decorations and defines a bunch
385 of commands for managing the contents of a \CV, though that is not its primary goal.
386 On \keyword{CTAN} archives, there are available various \CV packages more
387 \textit{contents-oriented}, as it were, and they may be used together with this class.
388 Before starting to describe the class more in details, it goes without saying that any advice or
389 constructive criticism is greatly appreciated.
390
391 \section{Class files}
392 The class \classname is composed by six files. A short brief of each one is given here:
393 \squishlist
394 \item \ctext{mycv.cls}
395 \begin{myindent}
396 it is the main file and, basically, handles the class options~\myref{sec:class-options} as
397 well as the inclusion of all other files, except for \textit{mycv\_version.def};
398 \end{myindent}
399 \item \ctext{mycv\_base.def}
400 \begin{myindent}
401 it contains all the commands and definitions dealing with the layout components of a
402 \CV~\myref{sec:layout-components}: it is the core file;
403 \end{myindent}
404 \item \ctext{mycv\_style.sty}
405 \begin{myindent}
406 it contains the default style commands~\myref{sub:style-commands} provided by the class: if
407 the default style is not used,
408 this file will not be included by \textit{mycv.cls};
409 \end{myindent}
410 \item \ctext{mycv\_dec.sty}
411 \begin{myindent}
412 it contains the decoration commands~\myref{sub:decoration-commands} provided by the class: if
413 decorations are not enabled%
414 , this file will not be included by \textit{mycv.cls};
415 \end{myindent}
416 \item \ctext{mycv\_misc.def}\hspace{5pt}and\hspace{5pt}\ctext{mycv\_version.def}
417 \begin{myindent}
418 they respectively contain some miscellaneous commands and the version string.
419 \end{myindent}
420 \squishend
421
422 \section {Layout components}
423 \label{sec:layout-components}
424
425 This class considers a \textit{curriculum vit\ae{}} as logically divided into three main components:
426 \textit{header}, \textit{body} and \textit{footer}.
427 To each of these ones, a list, that basically contains some sub-components, is associated; files
428 with the \CV contents are also considered sub-components.
429 For these reasons, we can actually say that \classname uses a sort of \textit{list-driven} approach.
430
431 \subsection{Main components}
432
433 \classname recognizes the following three lists that, for all intends and purposes, are a concrete
434 representation of the main logical components:
435
436 \bigskip
437 \begin{myindent}
438 \textbf{headerlayoutlist},\hspace{5pt}\textbf{bodylayoutlist},\hspace{5pt}\textbf{footerlayoutlist}.
439 \end{myindent}
440
441 \bigskip
442 It is mandatory, for the correct behavior of the class, to not change the above list's names. In
443 the case a component is not required, the relative list may be omitted: for example, if a \CV does
444 not have a footer component, the list \textit{footerlayoutlist} is not strictly necessary.\\
445 What follows is an example of a list definition:\codeskip
446 \begin{latexcode}[numbers=none]
447 \def\headerlayoutlist{sub-component1,sub-component2,[...]}
448 \end{latexcode}
449
450 \subsection{Sub-components}
451
452 We previously said that \classname is based on three main components (\textit{header},
453 \textit{body} and \textit{footer}) and that each of these ones are represented by a list. A list
454 (therefore a main component), in turn, may have one or more sub-component, separated by
455 a comma, which are identified as follows:
456
457 \squishlist[0pt]
458 \item \texttt{\ctext{Main}[Header|Body|Footer]\ctext{PageBegin}};
459 \item \texttt{\ctext{Main}[Header|Body|Footer]\ctext{PageEnd}};
460 \item \texttt{\ctext[blue]{Sub}[Header|Body|Footer]\ctext[blue]{PageBegin}};
461 \item \texttt{\ctext[blue]{Sub}[Header|Body|Footer]\ctext[blue]{PageEnd}};
462 \item \texttt{\ctext[orange]{filename}} with the (partial) \CV contents.
463 \squishend\sep
464
465 Both ``\verb|Main[...]PageBegin|'' and ``\verb|Sub[...]PageBegin|'' are \textit{minipages}; the
466 difference is that the former have a default width of $100\%$ of the \textit{textwidth}
467 macro, while that value is $44\text{-}45\%$ for the latter (it depends on the components type).
468
469 A \textit{filename} sub-component may either be the name of a file or a macro with it:
470 depending on the case, the syntax slightly changes.%~\myreftwo{subsub:component-options}.
471
472 \subsubsection{Sub-components options}
473 \label{subsub:component-options}
474
475 Each sub-component, \textit{filename} included, may have associated options, with colons
476 as separators, so that the syntax is something like:\codeskip
477 \begin{latexcode}[numbers=none]
478 $sub-component$:option1:option2:[...]
479 \end{latexcode}
480
481 If truth be told, each option already has its own separator, so colons are not strictly necessary
482 and, as a separator, any other symbol may be used. If wanted, it is also possible to not have any
483 separator at all, but this is not recommended if only for a matter of clarity.
484
485 \medskip
486 Options for a sub-component are of different types, as listed below:
487
488 \def\tmpcolor{gray}
489 \squishlist
490 \item <\optname{[pre\textbar post]cmd}\verb|:command1:command2:[...]|>\optdsep
491 a sequence of commands is executed \textit{before}/\textit{after} the
492 beginning or ending of a sub-component (\textit{filename} included).
493 A command may have a sequence of arguments, separated by ``='',
494 each of which can either be \textit{optional} or \textit{mandatory}.
495 In total, the class recognizes four types of arguments:
496 \squishlist[0pt]
497 \item \ctext[blue]{arg} (mandatory argument equivalent to \{arg\});
498 \item \ctext[blue]{@arg} (optional argument equivalent to [arg]);
499 \item \ctext[blue]{!arg} (optional argument equivalent to <arg>);
500 \item \ctext[blue]{*} (optional argument equivalent to *).
501 \squishend
502 \item /\optname{m[l\textbar r]}\verb|<value>|/\hfill\opthsep{\small($1$)}\optvsep
503 /\optname{endm[l\textbar r]}/\hfill\opthsep{\small($2$)}\optdsep
504 changes the \textit{left}/\textit{right} margin of a text portion of a document, between
505 option {\small($1$)} and option {\small($2$)}; in a typical usage, these options are
506 associated with different sub-components, such as \verb|*PageBegin| and \verb|*PageEnd|.
507 Each time the option {\small($1$)} is used, the option {\small($2$)} is also required
508 for ending the margin modification, except for the \textit{filename}
509 sub-component that automatically does that. Example (it moves the left margin to the
510 right of $0.2$in):
511 \begin{myindent}
512 \texttt{%
513 \ctext[\tmpcolor]{%
514 SubBodyPageBegin:</ml0.2in/>\\
515 \omissis\\
516 SubBodyPageEnd:</endml>}%
517 }.
518 \end{myindent}
519 \item \verb|<width-value>|\optdsep
520 sets the width of a sub-component in terms of \textit{textwidth} percentage.
521 This option only exists for ``\verb|*PageBegin|`` sub-components. Example:
522 \ctext[\tmpcolor]{\texttt{SubBodyPageBegin:<0.48>}}.
523 \item /\optname{pagesize}\verb|<value>|/\optdsep
524 sets the width of a sub-component, as the option above, but in terms of absolute reference
525 (instead of \textit{textwidth} percentage). Also this option only exists for
526 ``\verb|*PageBegin|`` sub-components. Example:
527 \ctext[\tmpcolor]{\texttt{SubBodyPageBegin:/pagesize5.5in/}}.
528 \item /\optname{pagebreak}/\optdsep
529 permits to break two contiguous sub-components, aligning them one above the other, instead
530 of side by side (that is the default behavior). This option only exists for
531 ``\verb|*PageEnd|'' sub-components.
532 Example: \ctext[\tmpcolor]{\texttt{SubBodyPageEnd:/pagebreak/}}.
533 \item \optname{*}macroname\optvsep
534 filename\optname{@}\optdsep
535 \argname{macroname} is a macro expanding to the name of a file (with the \CV contents),
536 while \argname{filename} is directly the name itself (the only \textit{non-alphanumeric}
537 characters allowed there are ``\_'' and ``-'').
538 Example: \ctext[\tmpcolor]{\texttt{*headerfile}}, where the macro \textit{headerfile}
539 is somewhere defined.
540 \squishend
541 \ifparchment\end{parchment}\fi
542 \chapter{Usage}
543 \quotes{%
544 “There are two ways to write error-free programs; only the third one works”%
545 }{Alan J. Perlis}
546 \ifparchment\begin{parchment}\fi
547 \section{Requirements}
548 When \textit{decorations} are not enabled and the \textit{default style} is not used, \classname
549 has
550 the following requirements:\codeskip
551 \begin{latexcode}[numbers=none]
552 \RequirePackage{kvoptions} % for class options with key-value format
553 \RequirePackage{etextools} % for lists and other useful tools
554 \RequirePackage{ifthen} % for the \ifthenelse command
555 \RequirePackage{xstring} % for string utilities
556 \RequirePackage{svn-prov} % for file info extracted from SVN
557 \RequirePackage{hyperref} % for hypertext links and other stuff
558 \end{latexcode}
559
560 If the default style is used, by means of the class option
561 ``\textit{style}''~\myref{sec:class-options}, this class requires (in addiction to
562 \textit{hyperref} and \textit{svn-prov}):\codeskip
563 \begin{latexcode}[numbers=none]
564 \RequirePackage{xparse} % for commands with multiple default arguments
565 \RequirePackage{pifont} % for the 'ding' style (itemize environment)
566 \RequirePackage{titlesec} % for title format and spacing
567 \RequirePackage{fancyhdr} % for custom headers and footers
568 \RequirePackage{xcolor} % for colors
569 \RequirePackage{calligra} % for the calligra font
570 \RequirePackage{times} % for the times font
571 \RequirePackage{marvosym} % symbols - phone
572 \RequirePackage{amssymb} % symbols - email
573 \end{latexcode}
574
575 Finally, if decorations are enabled, by using the class
576 option ``\textit{withDec}``~\myref{sec:class-options}, this class also requires (in addiction
577 to \textit{svn-prov}, \textit{xparse} and \textit{xstring}):\codeskip
578 \begin{latexcode}[firstnumber=1,numbers=none]
579 \RequirePackage{tikz} % for graphics
580 \end{latexcode}
581
582 \section{Class options}
583 \label{sec:class-options}
584
585 \classname can use any option supported by the \textit{article} class, on which is based. In
586 addiction, it provides the following options:
587 \def\tmpcolor{brown}
588 \squishlist
589 \item {\color{red}language=<\argname[\tmpcolor]{string}>}
590 \begin{myindent}
591 string language to pass to the \textit{babel} package for the document (\CV) language;
592 \end{myindent}
593 \item {\color{red}cntdir=<\argname[\tmpcolor]{dirname}>}
594 \begin{myindent}
595 sets the directory name where \classname will search for files with the \CV contents.\\
596 The default one is ``Contents'';
597 \end{myindent}
598 \item {\color{red}style=<\argname[\tmpcolor]{filemane}>}
599 \begin{myindent}
600 specifies the file name (with or without the extension ``.sty'') containing the style commands.
601 By default, the file \textit{mycv\_style.sty}, provided by the class itself, is that used.
602 It is also possible to not use any style file by specifying the value ``none'' as file name;
603 \end{myindent}
604 \item {\color{red}mdlname=<\argname[\tmpcolor]{name}>}
605 \begin{myindent}
606 registers a name for the layout (model) intended to be used: in this way is possible, for
607 example, to select the appropriate layout configuration file or a layout-specific portion of
608 code;
609 \end{myindent}
610 \item {\color{red}withDec}
611 \begin{myindent}
612 enables support for decorations (provided by the \textit{TikZ} package).
613 \end{myindent}
614 \squishend
615
616 \section{Class commands}
617
618 Here follows the complete list of the commands provided by \classname. The style commands
619 are only available if the class option ``\textit{style}'' was used;
620 the same goes for the decoration commands,
621 which need the class option ``\textit{withDec}''.\\
622 In the following text of this section, when present, the form {\color{blue}\omissis} (or
623 {\color{blue}<...>}) indicates the default choice for an optional argument of a command.
624
625 \subsection{Conditionals}
626
627 \squishlist
628 \item \cmdname{ifoption}
629 \marg{option}\arghsep
630 \marg{true}\arghsep\marg{false}\argvsep
631 \cmdname{ifmodel}
632 \marg{mdlname}\arghsep
633 \marg{true}\arghsep\marg{false}\cmddsep
634 \textit{ifoption} checks whether \argname{option} was used,
635 while \textit{ifmodel} checks whether \argname{mdlname} was registered in the class; then both
636 commands use the appropriate \argname{true} or \argname{false} block of code.
637 \squishend
638
639 \subsection{Default style}
640 \label{sub:style-commands}
641
642 \squishlist
643 \item \cmdname{mysectionTitleFormat}
644 \begin{myindent}
645 \dargone{titlerule-color-above}{myheadingscolor}\argvsep
646 \dargone{titlerule-color-below}{myheadingscolor}
647 \end{myindent}\cmddsep
648 \argname{titlerule-color-above} is the color for the rule above a section name, while
649 \argname{titlerule-color-below} is for the one below. \textit{myheadingscolor} is the default
650 color.
651 \item \cmdname{mysectionTitleSpacing}
652 \begin{myindent}
653 \dargone{left}{$0\text{pt}$}\arghsep
654 \dargone{beforesep}{$0\text{pt}$}\arghsep
655 \dargone{aftersep}{$5\text{pt}$}
656 \end{myindent}\cmddsep
657 this command is just an alias for
658 \textit{\textbackslash{titlespacing}\{\textbackslash{section}\}\{\argname{left}\}%
659 \{\argname{beforesep}\}\{\argname{aftersep}\}}. See the \textit{titlesec} package for further
660 information.
661 \item \cmdname{mycfoot}
662 \marg{text}\cmddsep
663 adds \argname{text} to the page footer. It may be useful, for example, to show information
664 about the last update of the document.
665 \item \cmdname{myitemize}
666 \cmddsep
667 a list environment that uses the \textit{ding} style.
668 \squishend
669
670 \subsection{Decorations}
671 \label{sub:decoration-commands}
672
673 \classname provides some commands for \textit{TikZ} decorations. The support
674 provided is not complete at all (on the other hand \textit{TikZ} has a huge amount of
675 functionality), but it is enough for this class purposes. The only \textit{TikZ} path supported is
676 \textit{rectangle}.
677
678 \squishlist
679 \item \cmdname{mydecorationsPathmorphing}[*]
680 \begin{myindent}
681 \dargone{show-decoration}{$1$}\argvsep
682 \marg{decoration-type}\argvsep
683 \dargone{decoration-color}{gray}\argvsep
684 \dargtwo{shading-type}{radial}\argvsep
685 \dargtwo{background-color}{white}%
686 \end{myindent}\cmddsep
687 \argname{show-decoration}, if equals $1$, shows the decoration \argname{decoration-type},
688 while if $0$ does not.
689 The \textit{starred} version of the command uses the shading technique and the last argument is
690 the background shading color.\\
691 The \textit{not starred} version does not consider the argument \argname{shading-type}
692 (just for a matter of clarity, a ``none'' value may be used) and the last argument is simply the
693 background color.\\
694 \argname{decoration-type} was tested with the following values: ``shape'', ``straight'',
695 ``zigzag``, ``random steps``, ``saw``, ``bent``, ``bumps``, ``coil``, ``snake'' and
696 ``Koch snowflake``.\\
697 \argname{shading-type} was tested with ``radial'' and ``ball'' shadings.
698 \item \cmdname{mydecorationsShape}
699 \begin{myindent}
700 \dargone{show-decoration}{$1$}\arghsep
701 \marg{decoration-type}\arghsep
702 \dargone{decoration-color}{gray}
703 \end{myindent}\cmddsep
704 \argname{show-decoration}, if equals $1$, shows the decoration \argname{decoration-type},
705 while if $0$ does not.\\
706 \argname{decoration-type} was tested with the following decorations: ``dart'', ``diamond'',
707 ``rectangle'' and ``star''.
708 \item \cmdname{mydecorationsFading}
709 \begin{myindent}
710 \dargone{path-fading}{north}\argvsep
711 \marg{primary-color}\argvsep
712 \dargone{color-gradient}{$80$}\argvsep
713 \dargone{secondary-color}{black}\argvsep
714 \dargtwo{opacity}{$1.0$}%
715 \end{myindent}\cmddsep
716 the resulting fill color is given by \argname{primary-color}, \argname{color-gradient}
717 and \argname{secondary-color}, which are composed as follows:
718 \argname{primary-color}!\argname{color-gradient}!\argname{secondary-color}.
719 \item \cmdname{mydecorationsSetPos[XTL|YTL|XBR|YBR]}
720 \begin{myindent}
721 \dargone{coordinate-value}{$1\text{cm}\mid-1\text{cm}\mid-1\text{cm}\mid1\text{cm}$}
722 \end{myindent}\cmddsep
723 sets the position for the decoration in use. Since the decoration path is \textit{rectangle}, it
724 is sufficient to have the $(x,y)$ coordinates of two points: the top-left and bottom-right.
725 \textit{XTL} stands for ``\texttt{X-Top-Left}'', \textit{XBR} for ``\texttt{X-Bottom-Right}''
726 and so on.
727 \item
728 \cmdname{mydecorationsSetLineWidth}[*]
729 \dargone{line-width}{tikz value}\cmdvsep
730 \cmdname{mydecorationsSetSegmentAmplitude}[*]
731 \dargone{segment-amplitude}{tikz value}\cmdvsep
732 \cmdname{mydecorationsSetSegmentLength}[*]
733 \dargone{segment-length}{tikz value}\cmddsep
734 these commands may respectively be used for modifying the properties \argname{line-width},
735 \argname{segment-amplitude} and \argname{segment-length} for the decoration in use.
736 \textit{Starred} versions do not require any argument and reinitialize the properties to their
737 default values.
738 \squishend
739
740 \subsection{Miscellaneous}
741
742 \squishlist
743 \item
744 \cmdname{mypdfauthor}
745 \marg{author}\cmdvsep
746 \cmdname{mypdftitle}
747 \marg{title}\cmdvsep
748 \cmdname{mypdfsubject}
749 \marg{subject}\cmddsep
750 these commands do nothing but register \argname{author}, \argname{title} and \argname{subject}
751 information in the document properties of the pdf is being produced.
752
753 \item \cmdname{mylang}
754 \marg{text}\arghsep
755 \dargone{language}{english}\cmddsep
756 temporarily changes the language in use (\textit{babel} package) to \argname{language} for
757 \argname{text}.
758
759 \item \cmdname{mychangemargin}
760 \marg{left-margin}\arghsep
761 \marg{right-margin}\cmddsep
762 \textit{mychangemargin} environment changes the left and right margin of a portion of
763 text. The environments \textit{mychangemarginLeft} and \textit{mychangemarginRight}, whose
764 meaning is straight forward, are also available.
765
766 \item \cmdname{myrenderlayout}
767 \dargone{component}{a}\cmddsep
768 processes and draws the layout component(s). The option value ``h'' is for the header component,
769 ``b'' and ``f'', respectively, for the body and footer ones, while ``a'' is for all components.
770 \squishend
771
772 \section{Some examples}
773
774 This section gives some \textit{minimal} examples and does some considerations about the use of
775 \classname (the class permits to do much better with a little patience). This is done by creating
776 two \textit{curriculum vit\ae{}} with the same contents, but different layouts: one \CV will use a
777 double page layout (abbreviated \DPL from here forward), while the other will use a single page
778 layout (\SPL).
779
780 The sample code presented here can be found in the ``Examples'' directory shipped with the
781 \textit{mycv} bundle, which this document is part of, and that also contains files with the \CV
782 contents: these files are not listed in the present document, as they do not contain anything worth
783 being mentioned for the purpose of these notes.
784
785 First and foremost, to keep the code organized, we need a file containing the layout components
786 for the \DPL and \SPL (\textit{model-layouts.tex}). We opt to share the \textit{header} and
787 \textit{footer} components, so we also create a second file named \textit{model-common.tex},
788 such as in listing~\ref{lst:model-common}.
789 \begin{latexcode}[firstnumber=1,caption=model-common.tex,label=lst:model-common]
790 % ----------------------
791 % the shared header list
792 % ----------------------
793 \def\headerlayoutlist{%
794 &MainHeaderPageBegin&:<postcmd:vspace=10pt>,
795 % --------------------------------- left header
796 |SubHeaderPageBegin|:<precmd:hfill>,
797 % header file (1)
798 $header_title@$,
799 |SubHeaderPageEnd|:<postcmd:hfill>,
800 % --------------------------------- right header
801 |SubHeaderPageBegin|,
802 % header file (2)
803 $header_contacts@$,
804 |SubHeaderPageEnd|,
805 &MainHeaderPageEnd&%
806 }
807
808 % ----------------------
809 % the shared footer list
810 % ----------------------
811 \def\footerlayoutlist{footer_sign@}
812 \end{latexcode}
813
814 \subsection{Double page layout}
815
816 Here we deal with the layout components specific for the \DPL, as showed in
817 listing~\ref{lst:dplmodel}.
818 \begin{latexcode}[firstnumber=1,caption=DPL model (part of 'model-layouts.tex'),label=lst:dplmodel]
819 \def\bodylayoutlist{% the DPL's body list
820 % ---------------------------------------------------------
821 % moves the right margin to the left (text and title rules)
822 % ---------------------------------------------------------
823 &MainBodyPageBegin&:<0.96>,
824 % ---------------------------------------------------------
825 % the 2 directives below are just used as a trick to do the
826 % same thing for the left margin (it is moved to the right)
827 % ---------------------------------------------------------
828 |SubBodyPageBegin|,
829 |SubBodyPageEnd|,
830 % -----------------------------------------
831 % left page (0.48 of textwidth)
832 % -----------------------------------------
833 |SubBodyPageBegin|:<0.48>,
834 $contents_partA@$:<precmd:vspace=10pt:sectionnumber=1>,
835 $contents_partB@$:<precmd:vspace=10pt:sectionnumber=2>,
836 $contents_partC@$:<precmd:vspace=10pt:sectionnumber=3>,
837 |SubBodyPageEnd|:<postcmd:hfill>,
838 % -----------------------------------------
839 % right page (0.48 of textwidth)
840 % -----------------------------------------
841 |SubBodyPageBegin|:<0.48>,
842 $contents_partA@$:<precmd:vspace=10pt:sectionnumber=4>,
843 $contents_partB@$:<precmd:vspace=10pt:sectionnumber=5>,
844 |SubBodyPageEnd|,
845 % -----------------------------------------
846 &MainBodyPageEnd&%
847 }
848 \end{latexcode}
849
850 \subsection{Single page layout}
851
852 As far as the \SPL, we do not need to use the \verb|*PageBegin| components, but it is sufficient to
853 directly include the files with the contents. The resulting code is showed
854 in listing~\ref{lst:splmodel}.
855 \begin{latexcode}[firstnumber=1,caption=SPL model (part of
856 'model-layouts.tex'),label=lst:splmodel]
857 \def\bodylayoutlist{% the SPL's body list
858 % ---------------------------------------------------
859 $contents_partA@$:<precmd:vspace=10pt:sectionnumber=1>,
860 $contents_partB@$:<precmd:vspace=10pt:sectionnumber=2>,
861 $contents_partC@$:<precmd:vspace=10pt:sectionnumber=3>,
862 $contents_partA@$:<precmd:vspace=10pt:sectionnumber=4>,
863 $contents_partB@$:<precmd:vspace=10pt:sectionnumber=5>
864 % ---------------------------------------------------
865 }
866 \end{latexcode}
867
868 \subsection{Main file}
869
870 Since we both have the components for the double and single page layouts, we can proceed writing the
871 main file (\textit{mycv-example-main.tex}) that picks and use them.\\
872 We start by setting up some options for the
873 class, such as those related to the decorations and language support, as well as the name of the
874 model (layout) we mean to register.
875 Besides, we opt to store the \CV contents files in the current directory (that is not the default one
876 where the class searches for the contents files), so there is need to specify its path with
877 the option ``\textit{cntdir}''.
878
879 In listing~\ref{lst:mycv-example-main} we take the \DPL as an example, but switching to the
880 \SPL would just be a matter of changing the ``\textit{mdlname}'' option from \keyword{verDPL} to
881 \keyword{verSPL}.
882 \begin{latexcode}[firstnumber=1,label=lst:mycv-example-main,caption=mycv-example-main.tex]
883 \documentclass[10pt,mdlname=verDPL,withDec,cntdir=.,language=english]{mycv}
884 \input{mycv-example-common}
885 \begin{document}
886 \cvdec\myrenderlayout\mycfoot{Last update: \today}
887 \end{document}
888 \end{latexcode}
889
890 The file \textit{mycv-example-common[.tex]}, showed in listing~\ref{lst:example-common},
891 selects the appropriate layout components (listings~\ref{lst:dplmodel} or \ref{lst:splmodel}) to be
892 included and, subsequently, processed by \textit{\textbackslash{}myrenderlayout}.
893 In addiction, the file \textit{mycv-example-common.tex} contains some decoration commands, which
894 need to be used only if the option ``\textit{withDec}' was given to the class; this is the
895 reason of the conditional command \textit{\textbackslash{}ifoption}.
896 \begin{latexcode}[firstnumber=1,caption=mcv-example-common.tex,label=lst:example-common]
897 [...]
898 \ifoption{withDec}{%
899 \newcommand{\cvdec}{
900 \mydecorationsSetLineWidth[0.3mm]%
901 \mydecorationsPathmorphing*{coil}<radial><lightgray>
902 }
903 [...]
904 }{\newcommand{\cvdec}{}}
905
906 % include layouts components
907 \input{model-layouts}
908 [...]
909 \end{latexcode}
910
911 \subsection{Layout notes}
912
913 When a double layout page is used, it may occur, for example, that a section is too long for a
914 page: this would not be a problem with a single page layout, since \LaTeX{} would automatically
915 break the section contents. Unfortunately, with a double page layout the behavior is substantially
916 different: this is because the class uses a \textit{minipage-based mechanism} and a minipage is by
917 itself not breakable. Thus, what happens is that part of the section contents comes out from the
918 page margins.
919
920 When a problem such as this occurs, a possible workaround is to manually break the section contents.
921 This can be done by using a counter that keeps track of the number of times a same file is included:
922 when the counter is equal $1$, a part of the section contents is included in the left page,
923 otherwise is the remaining one to be included in the right page.
924 Listing~\ref{lst:split-contents-example} shows a practical example of what just discussed.
925 \begin{latexcode}[firstnumber=1,label=lst:split-contents-example,
926 caption=workaround example]
927 % ---------------------------------------------------------
928 % file with the section contents: i.e. <section_skills.tex>
929 % ---------------------------------------------------------
930 % increases the counter 'cnt': it's defined outside this file
931 \stepcounter{cnt}
932
933 % selects the appropriate part of the file contents
934 \newcommand{\condblock}[2]{\ifthenelse{\value{cnt}<2}{#1}{#2}}
935
936 \condblock{skills section contents part A}%
937 {skills section contents part B (the remaining part)}
938
939 % ------------------------------------------------------
940 % file with the DPL components: i.e. <model-layouts.tex>
941 % ------------------------------------------------------
942 \def\bodylayoutlist{%
943 |SubBodyPageBegin|:<0.48>, % left page
944 % include part A in the left page
945 $section_skills@$,
946 [...]
947 |SubBodyPageEnd|,
948 |SubBodyPageBegin|:<0.48>, % right page
949 % include part B in the right page
950 $section_skills@$,
951 [...]
952 |SubBodyPageEnd|
953 }
954 \end{latexcode}
955
956 Of course the proposed workaround is not the best we could wish for, since it requires manual
957 operations.
958 As an alternative, it is possible to not use the \verb|*PageBegin| and \verb|*PageEnd| mechanism,
959 delegating the double page layout to an external package (i.e. \textit{multicols}).
960 This kind of approach is showed in listings~\ref{lst:model-dpl2}.
961 \begin{latexcode}[firstnumber=1,caption=DPL$2$ model (part of
962 'model-layouts.tex'),label=lst:model-dpl2]
963 \newcommand{\mcbegin}{\begin{multicols}{2}}
964 \newcommand{\mcend}{\end{multicols}}
965
966 \def\bodylayoutlist{%
967 $contents_partA@$:<precmd:vspace=10pt:mcbegin:sectionnumber=1>,%
968 [...]
969 $contents_partB@$:<precmd:vspace=10pt:sectionnumber=6>:<postcmd:mcend>,%
970 }
971 \end{latexcode}
972
973 Notice the usage of the commands \textit{\textbackslash{mcbegin}} and
974 \textit{\textbackslash{mcend}}, which act as a wrapper for the \textit{multicols} environment.
975
976 \section{Split file contents}
977
978 This class uses a file based approach as far as the contents of a \CV, that is to say it needs that
979 the contents be into separated file/s (at least one) with respect to the main file.
980
981 As the class works, having the contents in just one single file is not as good as would be with
982 multiple files (ideally a file for each section of the document), since multiple files allow to
983 more easily customize the \CV layout without directly acting on the contents.
984 On the other hand, a multiple file approach may compel to use several files and not be
985 convenient.\\
986 For these reasons, this class provides a \keyword{PERL} script named
987 \textit{mycv\_split\_contents.pl} (for a list of all the options provided, type
988 \textit{mycv\_split\_contents.pl -h} inside a shell environment)
989 that can process a file and, according to what specified by the
990 directives in the file itself, split its contents into several files (which will be those
991 effectively used by the class). In this way is possible to directly manage one single file for the
992 contents.
993
994 If requested, the script can also create a basic model file with the layout components:
995 it has to be considered just as a skeleton and probably needs to be edited by hand afterward.
996
997 The directives that may be used inside a contents file have the following form:\codeskip
998 \begin{latexcode}[numbers=none]
999 ###::|filename|:$component$:&commands&
1000 \end{latexcode}
1001
1002 {\color{orange}\textit{filemane}} is the name of the file to create,
1003 {\color{brown}\textit{component}} is the main component (\textit{header}, \textit{body} or
1004 \textit{footer}) that the file represents, while {\color{red}\textit{commands}} are the relative
1005 commands associated to the component.
1006 Both \textit{component} and \textit{commands} are not mandatory, but may be useful, especially
1007 \textit{component}, when is requested to generate a basic model file.\\
1008 The script \textit{mycv\_split\_contents.pl} may be called inside the main file as showed in
1009 listing~\ref{lst:mycv-example-main2}.
1010
1011 \begin{latexcode}[firstnumber=1,caption=Split contents example,label=lst:mycv-example-main2]
1012 % -------------------------------------------------------------------
1013 % To compile this file is necessary to use the option '-shell-escape'
1014 % to enable the 'write18' construct.
1015 % -------------------------------------------------------------------
1016 \documentclass[10pt,mdlname=verSPL,withDec,language=english]{mycv}
1017 \immediate\write18{<dirpath>/mycv_split_contents.pl -i cv-contents.tex}
1018 [...]
1019 \end{latexcode}
1020
1021 When the file \textit{cv-contents.tex} (listing~\ref{lst:cv-contents}) is processed by the script,
1022 the files \textit{*.tex} are created in the directory ''Contents`` (the default one).
1023 \begin{latexcode}[firstnumber=1,caption=cv-contents.tex,label=lst:cv-contents]
1024 % -----------------------------
1025 % ###::header_title.tex::header
1026 % -----------------------------
1027 [...]
1028 % -------------------------------------------------------------------
1029 % ###::contents_partA.tex::body::<precmd:vspace=10pt:sectionnumber=1>
1030 % -------------------------------------------------------------------
1031 [...]
1032 % -------------------------------------------------------------------
1033 % ###::contents_partB.tex::body::<precmd:vspace=10pt:sectionnumber=2>
1034 % -------------------------------------------------------------------
1035 [...]
1036 % ----------------------------
1037 % ###::footer_sign.tex::footer
1038 % ----------------------------
1039 [...]
1040 \end{latexcode}
1041
1042 \bigskip
1043 \fbox{That's all, {\color{brown}happy \LaTeX{}ing!}}
1044 \hfill\Large\calligra{AndreaGhersi}
1045 \ifparchment\end{parchment}\fi
1046
1047 \end{document}