summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mycv/mycv.cls
blob: 0df161ff8df30497d2faa7f524210c4087360d11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
% -------------------------------------------------------
% start of file 'mycv.cls'.
% Copyright 2012 Ghersi Andrea (ghanhawk@gmail.com).
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version
% 1.3c, available at 'http://www.latex-project.org/lppl'.
% -------------------------------------------------------

% ===============================================================================
% -------------------------------------------------------------------------     %
% Why a class file? (from document: LaTeX 2ε for class and package writers)     %
% -------------------------------------------------------------------------     %
%                                                                               %
% The first thing to do when you want to put some new LaTEX commands in a file  %
% is to decide whether it should be a document class or a package. The rule of  %
% thumb is:                                                                     %
%                                                                               %
%   If the commands could be used with any document class, then make them a     %
%   package; if not, then make them a class.                                    %
% ===============================================================================

\NeedsTeXFormat{LaTeX2e}
\def\myversionstr{v1.5.2}
\ProvidesClass{mycv}[2012/04/13 \myversionstr My Curriculum Vitae Class]

% ========
% Packages
% ========

\RequirePackage{kvoptions} % see the comment above
\RequirePackage{etextools} % for lists and other useful tools
\RequirePackage{ifthen}    % for <\ifthenelse> command
\RequirePackage{pifont}    % 'ding' style for item of itemize env
\RequirePackage{xstring}   % string utilities

% =============
% Class Options
% =============

\DeclareBoolOption{withDec}

\DeclareDefaultOption{%
   \PassOptionsToClass{\CurrentOption}{article}}

\DeclareStringOption[english]{language}
\DeclareStringOption[Contents]{cntdir}
\DeclareStringOption[mycv_default_style]{style}
\DeclareStringOption[]{mdlname}
\ProcessKeyvalOptions*

% -----------------------------------------------------------
% The value of an option declared with <\DeclareStringOption>
% is stored in the macro \<class (or package) name>@<option>
% -----------------------------------------------------------

\PassOptionsToPackage{\mycv@language}{babel}
\RequirePackage{babel}

\LoadClass{article}

\def\cvcontentsdir{\mycv@cntdir}

% ===============
% File inclusions
% ===============

\input{mycv_base}
\input{mycv_misc}
\ifthenelse{\equal{\mycv@style}{none}}%
   {\relax}% file style is not wanted
   {\input{\mycv@style}}

% ----------------------
% use decorations or not
% ----------------------
\ifthenelse{\boolean{mycv@withDec}}%
   {\input{mycv_dec}}%
   {\relax}

\DeclareRobustCommand{\ifmodel}[1]{%
   \begingroup
   \def\@mdlname{#1}
   \ifx\mycv@mdlname\@mdlname
      \endgroup
      \expandafter\@firstoftwo
   \else
      \endgroup
      \expandafter\@secondoftwo
   \fi
}

% -----------------------------------------------
% <\ifoption{optionname}{then block}{else block}>
% -----------------------------------------------

\DeclareRobustCommand{\ifoption}[1]{%
   \begingroup
   \ifthenelse{\boolean{mycv@#1}}
      {\endgroup\expandafter\@firstoftwo}
      {\endgroup\expandafter\@secondoftwo}%
}