| 1 |
% \iffalse meta-comment |
| 2 |
% mycv : a curriculum vitae class allowing TikZ decorations |
| 3 |
% (v1.5.6 - Sun May 20 21:31:37 CEST 2012) |
| 4 |
% |
| 5 |
% This work may be distributed and/or modified under the |
| 6 |
% conditions of the LaTeX Project Public License version |
| 7 |
% 1.3c, available at 'http://www.latex-project.org/lppl'. |
| 8 |
% |
| 9 |
% This work consists of the main source file 'mycv.dtx' |
| 10 |
% and the derived files: |
| 11 |
% |
| 12 |
% mycv.ins, |
| 13 |
% mycv.cls, |
| 14 |
% mycv_base.def, mycv_misc.def, mycv_version.def |
| 15 |
% mycv_style.sty, mycv_dec.sty, |
| 16 |
% mycv_split_contents.pl |
| 17 |
% mycv.pdf |
| 18 |
% |
| 19 |
% Moreover, it also consists of the files 'README', |
| 20 |
% 'CHANGELOG', 'checksum.pl' and folders <Examples> |
| 21 |
% and <Doc>. |
| 22 |
% |
| 23 |
% Unpacking the class files: |
| 24 |
% |
| 25 |
% (pdf)latex mycv.dtx |
| 26 |
% |
| 27 |
% Generating the documentation: |
| 28 |
% |
| 29 |
% the documentation has to be produced separately as it |
| 30 |
% uses the package 'arsclassica', that seems to be not |
| 31 |
% fully compatible with the 'doc' package (that should |
| 32 |
% be used in the driver file for producing the document). |
| 33 |
% To produce the documentation, move to the folder 'Doc' |
| 34 |
% and type: |
| 35 |
% |
| 36 |
% pdflatex mycv.tex |
| 37 |
% |
| 38 |
% Generating the examples: |
| 39 |
% |
| 40 |
% see the file 'Exampes/Notes.txt'. |
| 41 |
% |
| 42 |
% ---------------------------------------------------------- |
| 43 |
% ** This file was automatically generated by <DoPackage.sh> |
| 44 |
% ** with option(s) 'ctan'. |
| 45 |
% ** Date: Sun May 20 21:31:37 CEST 2012::1337542297 |
| 46 |
% ---------------------------------------------------------- |
| 47 |
% \fi |
| 48 |
%<*install> |
| 49 |
\input docstrip.tex |
| 50 |
|
| 51 |
\preamble |
| 52 |
-------------------------------------------------------- |
| 53 |
Author: Andrea Ghersi |
| 54 |
Copyright 2012 Ghersi Andrea ([email protected]). |
| 55 |
|
| 56 |
This work may be distributed and/or modified under the |
| 57 |
conditions of the LaTeX Project Public License version |
| 58 |
1.3c, available at 'http://www.latex-project.org/lppl'. |
| 59 |
|
| 60 |
This work has the LPPL maintenance status "maintained". |
| 61 |
The Current Maintainer of this work is Andrea Ghersi. |
| 62 |
|
| 63 |
This work consists of the files listed in the README |
| 64 |
file. |
| 65 |
-------------------------------------------------------- |
| 66 |
\endpreamble |
| 67 |
|
| 68 |
\keepsilent |
| 69 |
\askforoverwritefalse |
| 70 |
\usedir{tex/latex/mycv} |
| 71 |
|
| 72 |
\generate{% |
| 73 |
\file{mycv.ins}{\from{mycv.dtx}{install}}% |
| 74 |
\file{mycv.cls}{\from{mycv.dtx}{mycv.cls}}% |
| 75 |
\file{mycv_base.def}{\from{mycv.dtx}{mycv-base.def}}% |
| 76 |
\file{mycv_misc.def}{\from{mycv.dtx}{mycv-misc.def}}% |
| 77 |
\file{mycv_dec.sty}{\from{mycv.dtx}{mycv-dec.sty}}% |
| 78 |
\file{mycv_style.sty}{\from{mycv.dtx}{mycv-style.sty}}% |
| 79 |
\file{mycv_version.def}{\from{mycv.dtx}{mycv-version.def}}% |
| 80 |
} |
| 81 |
|
| 82 |
\generate{% |
| 83 |
\file{mycv_split_contents.pl}% |
| 84 |
{\nopreamble\nopostamble\from{mycv.dtx}{mycv-split-contents.pl}}% |
| 85 |
} |
| 86 |
|
| 87 |
\obeyspaces |
| 88 |
\Msg{**************************************************************} |
| 89 |
\Msg{* *} |
| 90 |
\Msg{* To finish the installation you have to move the following *} |
| 91 |
\Msg{* files into a directory searched by (La)TeX: *} |
| 92 |
\Msg{* *} |
| 93 |
\Msg{* mycv.cls, mycv*.def, mycv*.sty *} |
| 94 |
\Msg{* *} |
| 95 |
\Msg{* and copy the script 'mycv-split-contents.pl' into a folder *} |
| 96 |
\Msg{* that is in your PATH environment variable. *} |
| 97 |
\Msg{* On Unix-like operating systems, make the script executable *} |
| 98 |
\Msg{* (i.e. chmod +x mycv-split-contents.pl). *} |
| 99 |
\Msg{* *} |
| 100 |
\Msg{* To produce the documentation, move to the folder <Doc> and *} |
| 101 |
\Msg{* run the file 'mycv.tex' twice through LaTeX. *} |
| 102 |
\Msg{* *} |
| 103 |
\Msg{* See the file 'Exampes/Notes.txt' for information on how to *} |
| 104 |
\Msg{* produce pdf files with examples. *} |
| 105 |
\Msg{* *} |
| 106 |
\Msg{* If you want to verify the integrity of the main files, you *} |
| 107 |
\Msg{* can run the script 'checksum.pl' (on Unix-like operating *} |
| 108 |
\Msg{* systems, make it executable -- i.e. chmod +x checksum.pl). *} |
| 109 |
\Msg{* *} |
| 110 |
\Msg{* Happy (La)TeXing! *} |
| 111 |
\Msg{* *} |
| 112 |
\Msg{**************************************************************} |
| 113 |
|
| 114 |
\endbatchfile |
| 115 |
%</install> |
| 116 |
% \StopEventually{} |
| 117 |
% |
| 118 |
% |
| 119 |
% \iffalse |
| 120 |
%<*mycv-base.def> |
| 121 |
% \fi |
| 122 |
|
| 123 |
\ProvidesFileSVN |
| 124 |
{$Id: mycv_base.def 87 2012-05-17 00:40:11Z ghangenit $} |
| 125 |
[v\@versionstr][Base system core] |
| 126 |
|
| 127 |
%% for lists and other useful tools |
| 128 |
\RequirePackage{etextools} |
| 129 |
|
| 130 |
%%%%%%%%%%%%%%%%%%% |
| 131 |
%% % |
| 132 |
%% Default values % |
| 133 |
%% % |
| 134 |
%%%%%%%%%%%%%%%%%%% |
| 135 |
|
| 136 |
\def\@mainbodypagesize{1.00} |
| 137 |
\def\@subbodypagesize{0.45} |
| 138 |
|
| 139 |
\def\@mainheaderpagesize{1.00} |
| 140 |
\def\@subheaderpagesize{0.44} |
| 141 |
|
| 142 |
\def\@mainfooterpagesize{1.00} |
| 143 |
\def\@subfooterpagesize{0.44} |
| 144 |
|
| 145 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 146 |
%% % |
| 147 |
%% Layout components (parser) % |
| 148 |
%% % |
| 149 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 150 |
|
| 151 |
\def\@cmdsListSep{:} |
| 152 |
\def\@argsListSep{=} |
| 153 |
|
| 154 |
\expandaftercmds{\DeclareCmdListParser\MyParserCmds}{\@cmdsListSep} |
| 155 |
\expandaftercmds{\DeclareCmdListParser\MyParserArgs}{\@argsListSep} |
| 156 |
|
| 157 |
%% ----------------------------------- |
| 158 |
%% setup file components: header pages |
| 159 |
%% ----------------------------------- |
| 160 |
|
| 161 |
\def\@MainHeaderPageBegin{MainHeaderPageBegin} |
| 162 |
\def\@SubHeaderPageBegin{SubHeaderPageBegin} |
| 163 |
\def\@MainHeaderPageEnd{MainHeaderPageEnd} |
| 164 |
\def\@SubHeaderPageEnd{SubHeaderPageEnd} |
| 165 |
|
| 166 |
%% --------------------------------- |
| 167 |
%% setup file components: body pages |
| 168 |
%% --------------------------------- |
| 169 |
|
| 170 |
\def\@MainBodyPageBegin{MainBodyPageBegin} |
| 171 |
\def\@MainBodyPageEnd{MainBodyPageEnd} |
| 172 |
\def\@SubBodyPageBegin{SubBodyPageBegin} |
| 173 |
\def\@SubBodyPageEnd{SubBodyPageEnd} |
| 174 |
|
| 175 |
\def\@MainFooterPageBegin{MainFooterPageBegin} |
| 176 |
\def\@SubFooterPageBegin{SubFooterPageBegin} |
| 177 |
\def\@MainFooterPageEnd{MainFooterPageEnd} |
| 178 |
\def\@SubFooterPageEnd{SubFooterPageEnd} |
| 179 |
|
| 180 |
%% ------------------- |
| 181 |
%% regular expressions |
| 182 |
%% ------------------- |
| 183 |
|
| 184 |
\def\@regexPreCmd{<precmd:([-!*@.0-9A-Za-z \@cmdsListSep\@argsListSep]+)>} |
| 185 |
\def\@regexPostCmd{<postcmd:([-!*@.0-9A-Za-z \@cmdsListSep\@argsListSep]+)>} |
| 186 |
\def\@regexArgsList{\@argsListSep([-!*@.0-9A-Za-z \@argsListSep]+)} |
| 187 |
|
| 188 |
\def\@regexMarginLB{/ml([0-9.-]+.{2})} |
| 189 |
\def\@regexMarginRB{/mr([0-9.-]+.{2})} |
| 190 |
\def\@regexPageSizeAbs{/pagesize([0-9.]+.{2})/} |
| 191 |
\def\@regexPagebreak{/pagebreak/} |
| 192 |
\def\@regexPageSize{<([0-9.]+)>} |
| 193 |
\def\@regexMarginLE{/endml/} |
| 194 |
\def\@regexMarginRE{/endmr/} |
| 195 |
\def\@regexFileName{^([_\-a-zA-Z0-9]+)@} |
| 196 |
\def\@regexCmdName{([a-zA-Z]+)} |
| 197 |
\def\@regexFileVar{^.{1}([A-Za-z]+)} |
| 198 |
\def\@regexParamTypeA{^[@]} |
| 199 |
\def\@regexParamTypeB{^[!]} |
| 200 |
\def\@regexParamTypeC{^[*]} |
| 201 |
|
| 202 |
%% ================== |
| 203 |
%% Auxiliary commands |
| 204 |
%% ================== |
| 205 |
|
| 206 |
\newcommand{\@concatCommandArg}[1]{% |
| 207 |
\ifnum\pdfmatch{\@regexParamTypeA}{#1}=1 |
| 208 |
\StrGobbleLeft{#1}{1}[\arg] |
| 209 |
\expandafter\g@addto@macro\expandafter\args% |
| 210 |
\expandafter{\expandafter[\arg]} |
| 211 |
\else |
| 212 |
\ifnum\pdfmatch{\@regexParamTypeB}{#1}=1 |
| 213 |
\StrGobbleLeft{#1}{1}[\arg] |
| 214 |
\expandafter\g@addto@macro\expandafter\args% |
| 215 |
\expandafter{\expandafter<\arg>} |
| 216 |
\else |
| 217 |
\ifnum\pdfmatch{\@regexParamTypeC}{#1}=1 |
| 218 |
\g@addto@macro\args{*} |
| 219 |
\else |
| 220 |
\g@addto@macro\args{{#1}} |
| 221 |
\fi |
| 222 |
\fi |
| 223 |
\fi% |
| 224 |
} |
| 225 |
|
| 226 |
\newcommand{\@execCommand}[1]{% |
| 227 |
\let\args\@empty |
| 228 |
\ifnum\pdfmatch{\@regexArgsList}{#1}=1 |
| 229 |
\@getRegexResult{\argslist} |
| 230 |
\ifnum\pdfmatch{\@regexCmdName}{#1}=1 |
| 231 |
\@getRegexResult{\cmd} |
| 232 |
\fi |
| 233 |
\MyParserArgs[\@concatCommandArg]\argslist |
| 234 |
\expandaftercmds{\csuse\cmd}{\args} |
| 235 |
\else |
| 236 |
\csuse{#1} |
| 237 |
\fi% |
| 238 |
} |
| 239 |
|
| 240 |
\newcommand{\@getRegexResult}[1]{% |
| 241 |
\StrPosition{\pdflastmatch 1}{>}[\n] |
| 242 |
\StrGobbleLeft{\pdflastmatch 1}{\n}[#1]% |
| 243 |
} |
| 244 |
|
| 245 |
\newcommand{\@executeCommandList}[2]{% |
| 246 |
\ifnum\pdfmatch{#2}{#1}=1% |
| 247 |
\StrPosition{\pdflastmatch 1}{>}[\n] |
| 248 |
\StrGobbleLeft{\pdflastmatch 1}{\n}[\cmdlist] |
| 249 |
\MyParserCmds[\@execCommand]\cmdlist |
| 250 |
\fi% |
| 251 |
} |
| 252 |
|
| 253 |
\newcommand{\@parsePageBegin}[2]{% |
| 254 |
\let\pagewidth#2 |
| 255 |
\ifnum\pdfmatch{\@regexPageSize}{#1}=1 |
| 256 |
\@getRegexResult{\pagewidth} |
| 257 |
\fi |
| 258 |
\@executeCommandList{#1}{\@regexPreCmd} |
| 259 |
\ifnum\pdfmatch{\@regexPageSizeAbs}{#1}=1 |
| 260 |
\@getRegexResult{\pagewidth} |
| 261 |
\noindent\begin{minipage}[t]{\pagewidth} |
| 262 |
\else |
| 263 |
\noindent\begin{minipage}[t]{\pagewidth\textwidth} |
| 264 |
\fi |
| 265 |
\@executeCommandList{#1}{\@regexPostCmd} |
| 266 |
\ifnum\pdfmatch{\@regexMarginLB}{#1}=1 |
| 267 |
\@getRegexResult{\marginsize} |
| 268 |
\begin{mychangemarginLeft}{\marginsize} |
| 269 |
\fi |
| 270 |
\ifnum\pdfmatch{\@regexMarginRB}{#1}=1 |
| 271 |
\@getRegexResult{\marginsize} |
| 272 |
\begin{mychangemarginRight}{\marginsize} |
| 273 |
\fi% |
| 274 |
} |
| 275 |
|
| 276 |
\newcommand{\@parsePageEnd}[1]{% |
| 277 |
\ifnum\pdfmatch{\@regexMarginRE}{#1}=1 |
| 278 |
\end{mychangemarginRight} |
| 279 |
\fi |
| 280 |
\ifnum\pdfmatch{\@regexMarginLE}{#1}=1 |
| 281 |
\end{mychangemarginLeft} |
| 282 |
\fi |
| 283 |
\@executeCommandList{#1}{\@regexPreCmd} |
| 284 |
\ifnum\pdfmatch{\@regexPagebreak}{#1}=1 |
| 285 |
\end{minipage} |
| 286 |
|
| 287 |
\else |
| 288 |
\end{minipage} |
| 289 |
\fi |
| 290 |
\@executeCommandList{#1}{\@regexPostCmd} |
| 291 |
} |
| 292 |
|
| 293 |
\newcommand{\@parseFileName}[1]{% |
| 294 |
\let\marginsizeleft\relax |
| 295 |
\let\marginsizeright\relax |
| 296 |
\@executeCommandList{#1}{\@regexPreCmd} |
| 297 |
\ifnum\pdfmatch{\@regexMarginLB}{#1}=1 |
| 298 |
\@getRegexResult{\marginsizeleft} |
| 299 |
\begin{mychangemarginLeft}{\marginsizeleft} |
| 300 |
\fi |
| 301 |
\ifnum\pdfmatch{\@regexMarginRB}{#1}=1 |
| 302 |
\@getRegexResult{\marginsizeright} |
| 303 |
\begin{mychangemarginRight}{\marginsizeright} |
| 304 |
\fi |
| 305 |
\IfBeginWith{#1}{*}{% |
| 306 |
\ifnum\pdfmatch{\@regexFileVar}{\noexpand#1}=1 |
| 307 |
\@getRegexResult{\filename} |
| 308 |
\fi |
| 309 |
\input\cvcontentsdir/\csuse{\filename} |
| 310 |
}% |
| 311 |
{% |
| 312 |
\ifnum\pdfmatch{\@regexFileName}{#1}=1 |
| 313 |
\@getRegexResult{\filename} |
| 314 |
\fi |
| 315 |
\input\cvcontentsdir/\filename |
| 316 |
} |
| 317 |
\@executeCommandList{#1}{\@regexPostCmd} |
| 318 |
\ifx\marginsizeright\relax |
| 319 |
\relax |
| 320 |
\else |
| 321 |
\end{mychangemarginRight} |
| 322 |
\fi |
| 323 |
\ifx\marginsizeleft\relax |
| 324 |
\relax |
| 325 |
\else |
| 326 |
\end{mychangemarginLeft} |
| 327 |
\fi |
| 328 |
} |
| 329 |
|
| 330 |
%% ============= |
| 331 |
%% Main commands |
| 332 |
%% ============= |
| 333 |
|
| 334 |
\newcommand{\@bodylayoutlistentry}[1]{% |
| 335 |
\ifstrmatch{\@SubBodyPageBegin}{#1}{% |
| 336 |
\@parsePageBegin{#1}{\@subbodypagesize}% |
| 337 |
}% |
| 338 |
{% |
| 339 |
\ifstrmatch{\@SubBodyPageEnd}{#1}{% |
| 340 |
\@parsePageEnd{#1}% |
| 341 |
}% |
| 342 |
{%else |
| 343 |
\ifstrmatch{\@MainBodyPageBegin}{#1}{% |
| 344 |
\@parsePageBegin{#1}{\@mainbodypagesize}% |
| 345 |
}% |
| 346 |
{%else |
| 347 |
\ifstrmatch{\@MainBodyPageEnd}{#1}{% |
| 348 |
\@parsePageEnd{#1}% |
| 349 |
}% |
| 350 |
{%else |
| 351 |
\@parseFileName{#1}% |
| 352 |
}% |
| 353 |
}% |
| 354 |
}% |
| 355 |
}% |
| 356 |
} |
| 357 |
|
| 358 |
\newcommand{\@headerlayoutlistentry}[1]{% |
| 359 |
\ifstrmatch{\@MainHeaderPageBegin}{#1}{% |
| 360 |
\@parsePageBegin{#1}{\@mainheaderpagesize}% |
| 361 |
}% |
| 362 |
{%else |
| 363 |
\ifstrmatch{\@SubHeaderPageBegin}{#1}{% |
| 364 |
\@parsePageBegin{#1}{\@subheaderpagesize}% |
| 365 |
}% |
| 366 |
{%else |
| 367 |
\ifstrmatch{\@MainHeaderPageEnd}{#1}% |
| 368 |
{\@parsePageEnd{#1}}% |
| 369 |
{%else |
| 370 |
\ifstrmatch{\@SubHeaderPageEnd}{#1}{% |
| 371 |
\@parsePageEnd{#1}% |
| 372 |
}% |
| 373 |
{%else |
| 374 |
\@parseFileName{#1}% |
| 375 |
}% |
| 376 |
}% |
| 377 |
}% |
| 378 |
}% |
| 379 |
} |
| 380 |
|
| 381 |
\newcommand{\@footerlayoutlistentry}[1]{% |
| 382 |
\ifstrmatch{\@MainFooterPageBegin}{#1}{% |
| 383 |
\@parsePageBegin{#1}{\@mainfooterpagesize}% |
| 384 |
}% |
| 385 |
{%else |
| 386 |
\ifstrmatch{\@SubFooterPageBegin}{#1}{% |
| 387 |
\@parsePageBegin{#1}{\@subfooterpagesize}% |
| 388 |
}% |
| 389 |
{%else |
| 390 |
\ifstrmatch{\@MainFooterPageEnd}{#1}% |
| 391 |
{ \@parsePageEnd{#1}% |
| 392 |
}% |
| 393 |
{%else |
| 394 |
\ifstrmatch{\@SubFooterPageEnd}{#1}{% |
| 395 |
\@parsePageEnd{#1}% |
| 396 |
}% |
| 397 |
{%else |
| 398 |
\@parseFileName{#1}% |
| 399 |
}% |
| 400 |
}% |
| 401 |
}% |
| 402 |
}% |
| 403 |
} |
| 404 |
|
| 405 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 406 |
%% % |
| 407 |
%% Layout components (render) % |
| 408 |
%% % |
| 409 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 410 |
|
| 411 |
\newcommand{\@raisewarning}[1]{% |
| 412 |
\ClassWarning{mycv}{% |
| 413 |
WARNING! The list <#1> used by 'mycv' class is undefined. % |
| 414 |
Please, define it before using '\myrenderlayout' command. % |
| 415 |
}% |
| 416 |
} |
| 417 |
|
| 418 |
\DeclareRobustCommand{\myrenderlayout}[1][a]{% |
| 419 |
\begingroup |
| 420 |
\ifsinglechar{b}{#1}{% |
| 421 |
\@ifundefined{bodylayoutlist}% |
| 422 |
{\@raisewarning{bodylayoutlist}}% else |
| 423 |
{\csvloop[\@bodylayoutlistentry]{\bodylayoutlist}}% |
| 424 |
}% |
| 425 |
{%else |
| 426 |
\ifsinglechar{h}{#1}{% |
| 427 |
%% -------- |
| 428 |
%% HEADINGS |
| 429 |
%% -------- |
| 430 |
\@ifundefined{headerlayoutlist}% |
| 431 |
{\@raisewarning{headerlayoutlist}}% else |
| 432 |
{\csvloop[\@headerlayoutlistentry]\headerlayoutlist}% |
| 433 |
}% |
| 434 |
{%else |
| 435 |
%% ------------------------------------------------ |
| 436 |
%% FOOTINGS: sign and treatment of personal details |
| 437 |
%% ------------------------------------------------ |
| 438 |
\ifsinglechar{f}{#1}{% |
| 439 |
\@ifundefined{footerlayoutlist}% |
| 440 |
{\@raisewarning{footerlayoutlist}}% else |
| 441 |
{\csvloop[\@footerlayoutlistentry]\footerlayoutlist}% |
| 442 |
}% |
| 443 |
{%\else |
| 444 |
%% -------------- |
| 445 |
%% ALL COMPONENTS |
| 446 |
%% -------------- |
| 447 |
\@ifundefined{headerlayoutlist}% |
| 448 |
{\@raisewarning{headerlayoutlist}}% else |
| 449 |
{\csvloop[\@headerlayoutlistentry]\headerlayoutlist}% |
| 450 |
\@ifundefined{bodylayoutlist}% |
| 451 |
{\@raisewarning{bodylayoutlist}}% else |
| 452 |
{\csvloop[\@bodylayoutlistentry]\bodylayoutlist} |
| 453 |
\@ifundefined{footerlayoutlist}% |
| 454 |
{\@raisewarning{footerlayoutlist}}% else |
| 455 |
{\csvloop[\@footerlayoutlistentry]\footerlayoutlist}% |
| 456 |
}% |
| 457 |
}% |
| 458 |
}% |
| 459 |
\endgroup |
| 460 |
} |
| 461 |
% \iffalse |
| 462 |
%</mycv-base.def> |
| 463 |
% \fi |
| 464 |
% |
| 465 |
% |
| 466 |
% \iffalse |
| 467 |
%<*mycv-misc.def> |
| 468 |
% \fi |
| 469 |
%% ------------------------------------------------------- |
| 470 |
%% Copyright 2012 Ghersi Andrea ([email protected]). |
| 471 |
%% |
| 472 |
%% This work may be distributed and/or modified under the |
| 473 |
%% conditions of the LaTeX Project Public License version |
| 474 |
%% 1.3c, available at 'http://www.latex-project.org/lppl'. |
| 475 |
%% ------------------------------------------------------- |
| 476 |
|
| 477 |
\ProvidesFileSVN |
| 478 |
{$Id: mycv_misc.def 66 2012-04-28 14:38:41Z ghangenit $} |
| 479 |
[v\@versionstr][Miscellaneous commands] |
| 480 |
|
| 481 |
\RequirePackage{hyperref} |
| 482 |
|
| 483 |
%% ----------------------------------------------------- |
| 484 |
%% partial hyperref setup: the rest is set in style file |
| 485 |
%% ----------------------------------------------------- |
| 486 |
|
| 487 |
\hypersetup{% |
| 488 |
pdfstartpage = 1, |
| 489 |
pdfauthor = \@pdfauthor, |
| 490 |
pdftitle = \@pdftitle, |
| 491 |
pdfsubject = \@pdfsubject, |
| 492 |
pdfproducer = \LaTeX{}, |
| 493 |
pdfkeywords = cv curriculum vit\ae{}, |
| 494 |
pdfcreator = \LaTeX{} with 'mycv' (v\@versionstr) |
| 495 |
} |
| 496 |
|
| 497 |
%%%%%%%%%%%% |
| 498 |
%% % |
| 499 |
%% Margins % |
| 500 |
%% % |
| 501 |
%%%%%%%%%%%% |
| 502 |
|
| 503 |
\newenvironment{mychangemargin}[2] |
| 504 |
{\begin{list}{}{% |
| 505 |
\setlength{\topsep}{0pt}% |
| 506 |
\setlength{\leftmargin}{#1}% |
| 507 |
\setlength{\rightmargin}{#2}% |
| 508 |
\setlength{\partopsep}{0pt}% |
| 509 |
\setlength{\parsep}{\parskip}}\item[]% |
| 510 |
}% |
| 511 |
{\end{list}} |
| 512 |
|
| 513 |
\newenvironment{mychangemarginLeft}[1] |
| 514 |
{\begin{list}{}{% |
| 515 |
\setlength{\topsep}{0pt}% |
| 516 |
\setlength{\leftmargin}{#1}% |
| 517 |
\setlength{\partopsep}{0pt}% |
| 518 |
\setlength{\parsep}{\parskip}}\item[]% |
| 519 |
}% |
| 520 |
{\end{list}} |
| 521 |
|
| 522 |
\newenvironment{mychangemarginRight}[1] |
| 523 |
{\begin{list}{}{% |
| 524 |
\setlength{\topsep}{0pt}% |
| 525 |
\setlength{\rightmargin}{#1}% |
| 526 |
\setlength{\partopsep}{0pt}% |
| 527 |
\setlength{\parsep}{\parskip}}\item[]% |
| 528 |
}% |
| 529 |
{\end{list}} |
| 530 |
|
| 531 |
%%%%%%%%%%%%%%%% |
| 532 |
%% % |
| 533 |
%% Other stuff % |
| 534 |
%% % |
| 535 |
%%%%%%%%%%%%%%%% |
| 536 |
|
| 537 |
\DeclareRobustCommand{\mylang}[2][english]{% |
| 538 |
\foreignlanguage{#1}{{z#2}}} %{\color{blue}{#2}}} |
| 539 |
|
| 540 |
%% ------------ |
| 541 |
%% pdf metadata |
| 542 |
%% ------------ |
| 543 |
|
| 544 |
\DeclareRobustCommand{\mypdfsubject}[1]{\def\@pdfsubject{#1}} |
| 545 |
\DeclareRobustCommand{\mypdfauthor}[1]{\def\@pdfauthor{#1}} |
| 546 |
\DeclareRobustCommand{\mypdftitle}[1]{\def\@pdftitle{#1}} |
| 547 |
|
| 548 |
|
| 549 |
% \iffalse |
| 550 |
%</mycv-misc.def> |
| 551 |
% \fi |
| 552 |
% |
| 553 |
% |
| 554 |
% \iffalse |
| 555 |
%<*mycv-version.def> |
| 556 |
% \fi |
| 557 |
\def\@versionstr{1.5.6} |
| 558 |
% \iffalse |
| 559 |
%</mycv-version.def> |
| 560 |
% \fi |
| 561 |
% |
| 562 |
% |
| 563 |
% \iffalse |
| 564 |
%<*mycv.cls> |
| 565 |
% \fi |
| 566 |
|
| 567 |
\NeedsTeXFormat{LaTeX2e} |
| 568 |
|
| 569 |
\RequirePackage{svn-prov} |
| 570 |
\input{mycv_version.def} |
| 571 |
|
| 572 |
\ProvidesClassSVN |
| 573 |
{$Id: mycv.cls 87 2012-05-17 00:40:11Z ghangenit $} |
| 574 |
[v\@versionstr][My Curriculum Vitae class] |
| 575 |
|
| 576 |
%% ======== |
| 577 |
%% Packages |
| 578 |
%% ======== |
| 579 |
|
| 580 |
\RequirePackage{kvoptions} % for class options with key-value format |
| 581 |
\RequirePackage{xstring} % for string utilities |
| 582 |
\RequirePackage{ifthen} % for the <\ifthenelse> command |
| 583 |
|
| 584 |
%% ============= |
| 585 |
%% Class Options |
| 586 |
%% ============= |
| 587 |
|
| 588 |
\DeclareBoolOption{withDec} |
| 589 |
|
| 590 |
\DeclareDefaultOption{% |
| 591 |
\PassOptionsToClass{\CurrentOption}{article}} |
| 592 |
|
| 593 |
\DeclareStringOption[english]{language} |
| 594 |
\DeclareStringOption[Contents]{cntdir} |
| 595 |
\DeclareStringOption[mycv_style]{style} |
| 596 |
\DeclareStringOption[]{mdlname} |
| 597 |
\ProcessKeyvalOptions* |
| 598 |
|
| 599 |
%% ----------------------------------------------------------- |
| 600 |
%% The value of an option declared with <\DeclareStringOption> |
| 601 |
%% is stored in the macro \<class (or package) name>@<option> |
| 602 |
%% ----------------------------------------------------------- |
| 603 |
|
| 604 |
\PassOptionsToPackage{\mycv@language}{babel} |
| 605 |
\RequirePackage{babel} |
| 606 |
|
| 607 |
\LoadClass{article} |
| 608 |
|
| 609 |
\def\cvcontentsdir{\mycv@cntdir} |
| 610 |
|
| 611 |
%% =============== |
| 612 |
%% File inclusions |
| 613 |
%% =============== |
| 614 |
|
| 615 |
\input{mycv_base.def} |
| 616 |
\input{mycv_misc.def} |
| 617 |
|
| 618 |
%% ------------------------------------- |
| 619 |
%% use custom, default or any style file |
| 620 |
%% ------------------------------------- |
| 621 |
\ifthenelse{\equal{\mycv@style}{none}}% |
| 622 |
{\relax}% file style is not wanted |
| 623 |
{\RequirePackage{\mycv@style}} |
| 624 |
|
| 625 |
%% ---------------------- |
| 626 |
%% use decorations or not |
| 627 |
%% ---------------------- |
| 628 |
\ifthenelse{\boolean{mycv@withDec}}% |
| 629 |
{\RequirePackage{mycv_dec}}% |
| 630 |
{\relax} |
| 631 |
|
| 632 |
\DeclareRobustCommand{\ifmodel}[1]{% |
| 633 |
\begingroup |
| 634 |
\def\@mdlname{#1} |
| 635 |
\ifx\mycv@mdlname\@mdlname |
| 636 |
\endgroup |
| 637 |
\expandafter\@firstoftwo |
| 638 |
\else |
| 639 |
\endgroup |
| 640 |
\expandafter\@secondoftwo |
| 641 |
\fi |
| 642 |
} |
| 643 |
|
| 644 |
%% ----------------------------------------------- |
| 645 |
%% <\ifoption{optionname}{then block}{else block}> |
| 646 |
%% ----------------------------------------------- |
| 647 |
|
| 648 |
\DeclareRobustCommand{\ifoption}[1]{% |
| 649 |
\begingroup |
| 650 |
\ifthenelse{\boolean{mycv@#1}} |
| 651 |
{\endgroup\expandafter\@firstoftwo} |
| 652 |
{\endgroup\expandafter\@secondoftwo}% |
| 653 |
} |
| 654 |
% \iffalse |
| 655 |
%</mycv.cls> |
| 656 |
% \fi |
| 657 |
% |
| 658 |
% |
| 659 |
% \iffalse |
| 660 |
%<*mycv-dec.sty> |
| 661 |
% \fi |
| 662 |
|
| 663 |
\NeedsTeXFormat{LaTeX2e} |
| 664 |
\RequirePackage{svn-prov} |
| 665 |
|
| 666 |
\input{mycv_version.def} |
| 667 |
|
| 668 |
\ProvidesPackageSVN |
| 669 |
{$Id: mycv_dec.sty 89 2012-05-19 18:23:03Z ghangenit $} |
| 670 |
[v\@versionstr][Decorations commands] |
| 671 |
|
| 672 |
\RequirePackage{tikz} % for graphics |
| 673 |
\usetikzlibrary{shapes,decorations,shadows,fadings} |
| 674 |
\usetikzlibrary{decorations.pathmorphing} |
| 675 |
\usetikzlibrary{decorations.fractals} |
| 676 |
\usetikzlibrary{decorations.shapes} |
| 677 |
\usetikzlibrary{calc} |
| 678 |
\RequirePackage{xparse} % for commands with multiple default arguments |
| 679 |
\RequirePackage{xstring} % for string utilities |
| 680 |
|
| 681 |
%%%%%%%%%%%%% |
| 682 |
%% % |
| 683 |
%% Settings % |
| 684 |
%% % |
| 685 |
%%%%%%%%%%%%% |
| 686 |
|
| 687 |
\def\@segmentLengthString{} |
| 688 |
\def\@segmentLengthValue{} |
| 689 |
\def\@lineWidthString{} |
| 690 |
\def\@lineWidthValue{} |
| 691 |
\def\@segmentAmplitudeString{} |
| 692 |
\def\@segmentAmplitudeValue{} |
| 693 |
\def\@xBottomRight{-1cm} |
| 694 |
\def\@yBottomRight{1cm} |
| 695 |
\def\@xTopLeft{1cm} |
| 696 |
\def\@yTopLeft{-1cm} |
| 697 |
|
| 698 |
\tikzfading[% |
| 699 |
name=fade out, inner color=transparent!0, |
| 700 |
outer color=transparent!100% |
| 701 |
] |
| 702 |
|
| 703 |
\tikzset{ |
| 704 |
define mycolor/.code 2 args={\definecolor{#1}{rgb}{#2}}, |
| 705 |
DecoratewithShape/.style={% |
| 706 |
decorate,decoration={shape backgrounds,shape=#1}% |
| 707 |
}, |
| 708 |
DecoratewithPathMorphing/.style={% |
| 709 |
decorate,decoration=#1% |
| 710 |
}, |
| 711 |
Mainstyle/.style={ |
| 712 |
define mycolor={myred}{0.43,0.06,0,13}, |
| 713 |
define mycolor={dpred}{0.80,0.35,0} |
| 714 |
} |
| 715 |
} |
| 716 |
|
| 717 |
%%%%%%%%%%%%% |
| 718 |
%% % |
| 719 |
%% Commands % |
| 720 |
%% % |
| 721 |
%%%%%%%%%%%%% |
| 722 |
|
| 723 |
\newcommand{\versionBasedSettings}[2]{% |
| 724 |
\IfBooleanTF#1{% |
| 725 |
%% --------------------------------------------------------- |
| 726 |
%% From <xstring> package |
| 727 |
%% --------------------------------------------------------- |
| 728 |
%% Macros of this package take the catcodes of tokens into |
| 729 |
%% account. To avoid unexpected behaviour (particulary with |
| 730 |
%% tests), you should keep in mind that tokens and their |
| 731 |
%% catcodes are examined. |
| 732 |
%% For instance, these two arguments: {\string a\string b} |
| 733 |
%% and {ab} do not expand into equal strings for xstring! |
| 734 |
%% Because of the command \string, the first expands into |
| 735 |
%% ab with catcodes 12 while the second have characters |
| 736 |
%% with their natural catcodes 11. Catcodes do not match! |
| 737 |
%% Starred macros do not take catcodes into account. They |
| 738 |
%% simply convert some arguments into arguments with |
| 739 |
%% catcodes 10, 11 and 12, and call the non-starred macros |
| 740 |
%% with these modified arguments. |
| 741 |
%% --------------------------------------------------------- |
| 742 |
\IfStrEqCase*{#2}{% |
| 743 |
{radial}{\def\@colorStr{inner color}}% |
| 744 |
{ball}{\def\@colorStr{ball color}}% |
| 745 |
{none}{\relax}% |
| 746 |
}% |
| 747 |
[mycv: Unknown option <#2>!!!]% |
| 748 |
}{\relax}% |
| 749 |
} |
| 750 |
|
| 751 |
%% ----------------------------------------------------- |
| 752 |
%% Pathmorphing decoration values: |
| 753 |
%% shape, straight zigzag, random steps, saw, zigzag, |
| 754 |
%% bent, bumps, coil, snake, Koch snowflake |
| 755 |
%% |
| 756 |
%% Shadings: radial, ball |
| 757 |
%% ----------------------------------------------------- |
| 758 |
|
| 759 |
\DeclareDocumentCommand{\mydecorationsPathmorphing}% |
| 760 |
{s O{1} m O{gray} D<>{radial} D<>{white}}% |
| 761 |
{% |
| 762 |
\begingroup |
| 763 |
\versionBasedSettings{#1}{#5}% |
| 764 |
\begin{tikzpicture}[overlay,remember picture]% |
| 765 |
\IfBooleanTF#1{% version with a star (shading) |
| 766 |
\shade[ |
| 767 |
Mainstyle, |
| 768 |
\@lineWidthString=\@lineWidthValue, |
| 769 |
\@segmentAmplitudeString=\@segmentAmplitudeValue, |
| 770 |
\@segmentLengthString=\@segmentLengthValue, |
| 771 |
DecoratewithPathMorphing=#3, |
| 772 |
color=#4, |
| 773 |
shading=#5, |
| 774 |
\@colorStr=#6, |
| 775 |
\ifnum#2>0draw\fi |
| 776 |
]}% |
| 777 |
{% version without a star (not shading) |
| 778 |
\path[ |
| 779 |
Mainstyle, |
| 780 |
\@lineWidthString=\@lineWidthValue, |
| 781 |
\@segmentAmplitudeString=\@segmentAmplitudeValue, |
| 782 |
\@segmentLengthString=\@segmentLengthValue, |
| 783 |
DecoratewithPathMorphing=#3, |
| 784 |
color=#4, |
| 785 |
fill=#6, |
| 786 |
\ifnum#2>0draw\fi |
| 787 |
]}% |
| 788 |
($ (current page.north west)+ |
| 789 |
(\@xTopLeft,\@yTopLeft) $) |
| 790 |
rectangle % -- oppure circle (4), ... |
| 791 |
($ (current page.south east)+ |
| 792 |
(\@xBottomRight,\@yBottomRight) $); |
| 793 |
\end{tikzpicture} |
| 794 |
\endgroup |
| 795 |
} |
| 796 |
|
| 797 |
%% -------------------------------------- |
| 798 |
%% Shapes: dart, diamond, rectangle, star |
| 799 |
%% -------------------------------------- |
| 800 |
|
| 801 |
\DeclareDocumentCommand{\mydecorationsShape}% |
| 802 |
{O{1} m O{gray}} |
| 803 |
{% |
| 804 |
\begingroup |
| 805 |
\begin{tikzpicture}[overlay,remember picture] |
| 806 |
\path[ |
| 807 |
Mainstyle, |
| 808 |
\@lineWidthString=\@lineWidthValue, |
| 809 |
\@segmentAmplitudeString=\@segmentAmplitudeValue, |
| 810 |
\@segmentLengthString=\@segmentLengthValue, |
| 811 |
DecoratewithShape=#2, |
| 812 |
color=#3, |
| 813 |
\ifnum#1>0draw\fi |
| 814 |
]% |
| 815 |
($ (current page.north west)+ |
| 816 |
(\@xTopLeft,\@yTopLeft) $) |
| 817 |
rectangle |
| 818 |
($ (current page.south east)+ |
| 819 |
(\@xBottomRight,\@yBottomRight) $); |
| 820 |
\end{tikzpicture} |
| 821 |
\endgroup |
| 822 |
} |
| 823 |
|
| 824 |
\DeclareDocumentCommand{\mydecorationsFading}% |
| 825 |
{O{north} m O{80} O{black} D<>{1.0}} |
| 826 |
{% |
| 827 |
\begin{tikzpicture}[overlay,remember picture] |
| 828 |
\draw[path fading=#1,fill=#2!#3!#4,opacity=#5] |
| 829 |
($ (current page.north west)+ |
| 830 |
(\@xTopLeft,\@yTopLeft) $) |
| 831 |
rectangle % -- oppure circle (4), ... |
| 832 |
($ (current page.south east)+ |
| 833 |
(\@xBottomRight,\@yBottomRight) $); |
| 834 |
\end{tikzpicture}% |
| 835 |
} |
| 836 |
|
| 837 |
\DeclareRobustCommand{\mydecorationsSetPosXTL}[1]% |
| 838 |
[1cm]% |
| 839 |
{% |
| 840 |
\def\@xTopLeft{#1}% |
| 841 |
} |
| 842 |
|
| 843 |
\DeclareRobustCommand{\mydecorationsSetPosYTL}[1]% |
| 844 |
[-1cm]% |
| 845 |
{% |
| 846 |
\def\@yTopLeft{#1}% |
| 847 |
} |
| 848 |
|
| 849 |
\DeclareRobustCommand{\mydecorationsSetPosXBR}[1]% |
| 850 |
[-1cm]% |
| 851 |
{% |
| 852 |
\def\@xBottomRight{#1}% |
| 853 |
} |
| 854 |
|
| 855 |
\DeclareRobustCommand{\mydecorationsSetPosYBR}[1]% |
| 856 |
[1cm]% |
| 857 |
{% |
| 858 |
\def\@yBottomRight{#1}% |
| 859 |
} |
| 860 |
|
| 861 |
\DeclareDocumentCommand{\mydecorationsSetLineWidth}% |
| 862 |
{s O{}}% |
| 863 |
{% |
| 864 |
\IfBooleanTF#1% |
| 865 |
{\def\@lineWidthString{}} % starred |
| 866 |
{\def\@lineWidthString{line width}} % not starred |
| 867 |
|
| 868 |
\def\@lineWidthValue{#2}% |
| 869 |
} |
| 870 |
|
| 871 |
\DeclareDocumentCommand{\mydecorationsSetSegmentAmplitude}% |
| 872 |
{s O{}}% |
| 873 |
{% |
| 874 |
\IfBooleanTF#1% |
| 875 |
{\def\@segmentAmplitudeString{}} % starred |
| 876 |
{\def\@segmentAmplitudeString{segment amplitude}} % not starred |
| 877 |
|
| 878 |
\def\@segmentAmplitudeValue{#2}% |
| 879 |
} |
| 880 |
|
| 881 |
\DeclareDocumentCommand{\mydecorationsSetSegmentLength}% |
| 882 |
{s O{}}% |
| 883 |
{% |
| 884 |
\IfBooleanTF#1% |
| 885 |
{\def\@segmentLengthString{}} % starred |
| 886 |
{\def\@segmentLengthString{segment length}} % not starred |
| 887 |
|
| 888 |
\def\@segmentLengthValue{#2}% |
| 889 |
} |
| 890 |
% \iffalse |
| 891 |
%</mycv-dec.sty> |
| 892 |
% \fi |
| 893 |
% |
| 894 |
% |
| 895 |
% \iffalse |
| 896 |
%<*mycv-style.sty> |
| 897 |
% \fi |
| 898 |
|
| 899 |
\NeedsTeXFormat{LaTeX2e} |
| 900 |
\RequirePackage{svn-prov} |
| 901 |
|
| 902 |
\input{mycv_version.def} |
| 903 |
|
| 904 |
\ProvidesPackageSVN |
| 905 |
{$Id: mycv_style.sty 89 2012-05-19 18:23:03Z ghangenit $} |
| 906 |
[v\@versionstr][Default style file] |
| 907 |
|
| 908 |
\RequirePackage{titlesec} % for title format and spacing |
| 909 |
\RequirePackage{fancyhdr} % for custom headers and footers |
| 910 |
\RequirePackage{xcolor} % for colors |
| 911 |
\RequirePackage{calligra} % for the calligra font |
| 912 |
\RequirePackage{times} % for times font |
| 913 |
\RequirePackage{pifont} % for the ’ding’ style (itemize environment) |
| 914 |
\RequirePackage{marvosym} % symbols - phone |
| 915 |
\RequirePackage{amssymb} % symbols - email |
| 916 |
\RequirePackage{hyperref} % for hypertext links and other stuff |
| 917 |
\RequirePackage{xparse} % for commands with multiple default arguments |
| 918 |
|
| 919 |
%%%%%%%%%%%% |
| 920 |
%% % |
| 921 |
%% Layout % |
| 922 |
%% % |
| 923 |
%%%%%%%%%%%% |
| 924 |
|
| 925 |
%% ----------------------------------------------------- |
| 926 |
%% passing the option 'showframe' to the package permits |
| 927 |
%% to see the page margins: that may be useful for debug |
| 928 |
%% ----------------------------------------------------- |
| 929 |
\RequirePackage[ |
| 930 |
paperwidth=210mm, |
| 931 |
paperheight=297mm, |
| 932 |
textwidth=495pt, |
| 933 |
vmargin=1.5cm, |
| 934 |
columnsep=18pt |
| 935 |
]{geometry} |
| 936 |
|
| 937 |
%%%%%%%%%%%%%%%%%%%%%% |
| 938 |
%% % |
| 939 |
%% Header and footer % |
| 940 |
%% % |
| 941 |
%%%%%%%%%%%%%%%%%%%%%% |
| 942 |
|
| 943 |
\renewcommand{\headrulewidth}{0.0pt} |
| 944 |
|
| 945 |
\fancyhf{} |
| 946 |
|
| 947 |
\DeclareRobustCommand{\mycfoot}[1]{% |
| 948 |
\cfoot{\color{myheadingscolor}{{\sffamily\tiny{#1}}}}% |
| 949 |
} |
| 950 |
|
| 951 |
\pagestyle{fancy} |
| 952 |
|
| 953 |
%%%%%%%%%%%%%%%%%%%%%%%%% |
| 954 |
%% % |
| 955 |
%% Hyperref and colours % |
| 956 |
%% % |
| 957 |
%%%%%%%%%%%%%%%%%%%%%%%%% |
| 958 |
|
| 959 |
%% ------------------------------------------ |
| 960 |
%% setup colours for links, text and headings |
| 961 |
%% ------------------------------------------ |
| 962 |
\definecolor{mylinkcolour}{HTML}{0000FF} % {FF0080} %light purple link for the email |
| 963 |
\definecolor{myshadecolor}{HTML}{F0F0F0} % {E4E3E3}%{D4D7FE} %light blue shade |
| 964 |
\definecolor{mytextcolor}{HTML}{2b2b2b} % text is almost black |
| 965 |
\definecolor{myheadingscolor}{HTML}{701112} % dark red |
| 966 |
|
| 967 |
%% ---------------------- |
| 968 |
%% setup hyperref package |
| 969 |
%% ---------------------- |
| 970 |
\hypersetup{% |
| 971 |
colorlinks,breaklinks,% |
| 972 |
urlcolor=mylinkcolour,% |
| 973 |
linkcolor=mylinkcolour,% |
| 974 |
} |
| 975 |
|
| 976 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 977 |
%% % |
| 978 |
%% Section title format and spacing % |
| 979 |
%% % |
| 980 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 981 |
|
| 982 |
\DeclareDocumentCommand{\mysectionTitleFormat}% |
| 983 |
{O{myheadingscolor} O{myheadingscolor}}% |
| 984 |
{% |
| 985 |
\titleformat{\section}% |
| 986 |
{\bigskip\color{#1}\titlerule\scshape\Large\raggedright}% |
| 987 |
{}{0em}{}[\color{#2}\titlerule\medskip] |
| 988 |
} |
| 989 |
|
| 990 |
\DeclareDocumentCommand{\mysectionTitleSpacing}% |
| 991 |
{O{0pt} O{0pt} O{5pt}}% |
| 992 |
{% |
| 993 |
\titlespacing{\section}{#1}{#2}{#3}% |
| 994 |
} |
| 995 |
|
| 996 |
\mysectionTitleFormat |
| 997 |
\mysectionTitleSpacing |
| 998 |
|
| 999 |
%%%%%%%%%%%%%%%%%%%% |
| 1000 |
%% % |
| 1001 |
%% Customized list % |
| 1002 |
%% % |
| 1003 |
%%%%%%%%%%%%%%%%%%%% |
| 1004 |
|
| 1005 |
\newenvironment{myitemize}% |
| 1006 |
{\renewcommand{\labelitemi}{\ding{43}}\begin{itemize}}% |
| 1007 |
{\end{itemize}} |
| 1008 |
|
| 1009 |
%%%%%%%%%%%%%%%% |
| 1010 |
%% % |
| 1011 |
%% Other stuff % |
| 1012 |
%% % |
| 1013 |
%%%%%%%%%%%%%%%% |
| 1014 |
|
| 1015 |
%% -------------------------------- |
| 1016 |
%% set text color for the whole doc |
| 1017 |
%% -------------------------------- |
| 1018 |
\color{mytextcolor} |
| 1019 |
% \iffalse |
| 1020 |
%</mycv-style.sty> |
| 1021 |
% \fi |
| 1022 |
% |
| 1023 |
% |
| 1024 |
% \iffalse |
| 1025 |
%<*mycv-split-contents.pl> |
| 1026 |
% \fi |
| 1027 |
#!/usr/bin/perl |
| 1028 |
|
| 1029 |
# ------------------------------------------------------- |
| 1030 |
# Copyright 2012 Ghersi Andrea ([email protected]). |
| 1031 |
# |
| 1032 |
# This work may be distributed and/or modified under the |
| 1033 |
# conditions of the LaTeX Project Public License version |
| 1034 |
# 1.3c, available at 'http://www.latex-project.org/lppl'. |
| 1035 |
# ------------------------------------------------------- |
| 1036 |
|
| 1037 |
# $Id: mycv_split_contents.pl 89 2012-05-19 18:23:03Z ghangenit $ |
| 1038 |
|
| 1039 |
use Getopt::Long; |
| 1040 |
use File::Path; |
| 1041 |
use warnings; |
| 1042 |
use strict; |
| 1043 |
use Cwd; |
| 1044 |
|
| 1045 |
# hashes with errors and warnings messages |
| 1046 |
|
| 1047 |
my %errors = ( |
| 1048 |
OME => "$0: ERROR opening <%s> in output mode (CWD: %s): %s\n", |
| 1049 |
IME => "$0: ERROR opening <%s> in input mode (CWD: %s): %s\n", |
| 1050 |
NIF => "$0: ERROR: no input file provided!\nUse the option <-i infile>.\n", |
| 1051 |
NOD => "$0: ERROR: no output dir. provided!\nUse the option <-o outdir>.\n", |
| 1052 |
IOE => "$0: ERROR: input file and output dir are the same!\n" |
| 1053 |
); |
| 1054 |
|
| 1055 |
my %warnings = ( |
| 1056 |
NVC => "WARNING:: <%s> is not recognized as a valid component!\n" . |
| 1057 |
"A component can only be 'header', 'body' or 'footer'.\n" |
| 1058 |
); |
| 1059 |
|
| 1060 |
my $outdir = 'Contents'; # default output dir |
| 1061 |
my $infile = 'cv_contents.tex'; # default input file |
| 1062 |
my $cwd = getcwd(); # current directory |
| 1063 |
my %opt = (); # hash for options |
| 1064 |
|
| 1065 |
|
| 1066 |
### |
| 1067 |
### |
| 1068 |
|
| 1069 |
sub _usage() |
| 1070 |
{ |
| 1071 |
print STDERR << "EOF"; |
| 1072 |
|
| 1073 |
Usage: $0 [-h] [-e] [-i infile] [-o outdir] [-m modelfile] |
| 1074 |
Version <1.0> |
| 1075 |
|
| 1076 |
Options: |
| 1077 |
======== |
| 1078 |
|
| 1079 |
-o outdir \t : uses <outdir> as output dir {default: 'Contents'} |
| 1080 |
-m mdlfile \t : writes basic model directives to the <mdlfile> file |
| 1081 |
-i infile \t : uses <infile> as input file {default: 'cv_contents.tex'} |
| 1082 |
-e \t : keeps file names extension in model directives |
| 1083 |
-h \t : this help message |
| 1084 |
|
| 1085 |
Examples: |
| 1086 |
========= |
| 1087 |
|
| 1088 |
1) Splits the input file 'cv_contents.tex' into multiple files (they |
| 1089 |
will be created in the directory 'Contents'), as specified in the |
| 1090 |
file itself - the input file is not modified: |
| 1091 |
|
| 1092 |
[$0 -i cv_contents.tex] |
| 1093 |
|
| 1094 |
2) As above but, in addiction, a basic model file (model-spl.tex) for |
| 1095 |
multiple files is created (in the model directives, the file names |
| 1096 |
extension will be removed): |
| 1097 |
|
| 1098 |
[$0 -i cv_contents.tex -m model-spl.tex] |
| 1099 |
|
| 1100 |
3) As above, but file names in the model directives will keep their |
| 1101 |
own extension: |
| 1102 |
|
| 1103 |
[$0 -i cv_contents.tex -m model-spl.tex -e] |
| 1104 |
|
| 1105 |
EOF |
| 1106 |
exit 0; |
| 1107 |
} |
| 1108 |
|
| 1109 |
|
| 1110 |
### |
| 1111 |
### |
| 1112 |
|
| 1113 |
sub mcdie { printf STDERR @_, $!; exit 1; } |
| 1114 |
|
| 1115 |
|
| 1116 |
### |
| 1117 |
### |
| 1118 |
|
| 1119 |
sub processCommandLine() |
| 1120 |
{ |
| 1121 |
GetOptions ( |
| 1122 |
'o=s' => \$opt{o}, 'i=s' => \$opt{i}, |
| 1123 |
'm=s' => \$opt{m}, 'h' => \$opt{h}, |
| 1124 |
'e' => \$opt{e} |
| 1125 |
) or _usage(); |
| 1126 |
|
| 1127 |
$opt{h} and _usage(); |
| 1128 |
_usage() if ( $#ARGV > -1 ); |
| 1129 |
|
| 1130 |
_dealWithInOutFiles(); |
| 1131 |
return \%opt; |
| 1132 |
} |
| 1133 |
|
| 1134 |
|
| 1135 |
### |
| 1136 |
### |
| 1137 |
|
| 1138 |
sub _dealWithInOutFiles |
| 1139 |
{ |
| 1140 |
$opt{o} and $outdir = $opt{o}; |
| 1141 |
$opt{i} and $infile = $opt{i}; |
| 1142 |
|
| 1143 |
if ( $infile eq "" ){ die $errors{NIF} } |
| 1144 |
if ( $outdir eq "" ){ die $errors{NOD} } |
| 1145 |
if ( $infile eq $outdir ){ die $errors{IOE} } |
| 1146 |
|
| 1147 |
$opt{outdir} = $outdir; |
| 1148 |
$opt{infile} = $infile; |
| 1149 |
} |
| 1150 |
|
| 1151 |
|
| 1152 |
### |
| 1153 |
### |
| 1154 |
|
| 1155 |
sub fileprocess ($) |
| 1156 |
{ |
| 1157 |
my $cmdoptions = shift; |
| 1158 |
my $outdir = $cmdoptions->{'outdir'}; |
| 1159 |
my $linehook = '###'; |
| 1160 |
my %components; |
| 1161 |
my $sep = '::'; |
| 1162 |
|
| 1163 |
open INFILE, $cmdoptions->{'infile'} or |
| 1164 |
mcdie( $errors{IME}, $cmdoptions->{'infile'}, $cwd ); |
| 1165 |
|
| 1166 |
mkpath($outdir); |
| 1167 |
(-d $outdir) or mcdie( $errors{OME}, $outdir, $cwd ); |
| 1168 |
|
| 1169 |
while ( my $line = <INFILE> ) |
| 1170 |
{ |
| 1171 |
my @info; my $ctype=''; |
| 1172 |
if ( $line =~ /$linehook/ ) |
| 1173 |
{ |
| 1174 |
PROCESSLINE: |
| 1175 |
@info = split(/$sep/, $line); |
| 1176 |
|
| 1177 |
$ctype=$info[2]; # contains the component type (header,...) |
| 1178 |
chomp($ctype); |
| 1179 |
|
| 1180 |
if ( $info[2] ) |
| 1181 |
{ |
| 1182 |
if ( $ctype =~ /header/ ) { push (@{$components{h}}, $line) } |
| 1183 |
elsif ( $ctype =~ /body/ ){ push (@{$components{b}}, $line) } |
| 1184 |
elsif ( $ctype =~ /footer/ ){ push (@{$components{f}}, $line) } |
| 1185 |
else { printf STDERR $warnings{NVC}, $ctype } |
| 1186 |
} |
| 1187 |
|
| 1188 |
if ( $info[1] ) # contains the file name to write |
| 1189 |
{ |
| 1190 |
open OUTFILE, '>', "$outdir/$info[1]" or |
| 1191 |
mcdie( $errors{OME}, $info[1], $cwd ); |
| 1192 |
|
| 1193 |
while ( $line = <INFILE> ) |
| 1194 |
{ |
| 1195 |
if ( $line =~ /$linehook/ ) |
| 1196 |
{ |
| 1197 |
close OUTFILE; |
| 1198 |
goto PROCESSLINE; |
| 1199 |
} |
| 1200 |
else { print OUTFILE $line } # write to file |
| 1201 |
} |
| 1202 |
} |
| 1203 |
} |
| 1204 |
} |
| 1205 |
|
| 1206 |
close INFILE; |
| 1207 |
if ( $cmdoptions->{'m'} ) |
| 1208 |
{ |
| 1209 |
open OUTFILE, '>', $cmdoptions->{'m'} or |
| 1210 |
mcdie( $errors{OME}, $cmdoptions->{'m'}, $cwd ); |
| 1211 |
|
| 1212 |
for my $key ( keys %components ) |
| 1213 |
{ |
| 1214 |
if ( $key eq "b" ) { print OUTFILE "\\def\\bodylayoutlist{%\n" } |
| 1215 |
elsif ( $key eq "h" ) { print OUTFILE "\\def\\headerlayoutlist{%\n" } |
| 1216 |
elsif ( $key eq "f" ) { print OUTFILE "\\def\\footerlayoutlist{%\n" } |
| 1217 |
|
| 1218 |
my @info; my $cnt=0; my $fname=''; |
| 1219 |
while ( $components{$key}[$cnt] ) |
| 1220 |
{ |
| 1221 |
@info = split(/$sep/, $components{$key}[$cnt]); |
| 1222 |
$cnt++; |
| 1223 |
|
| 1224 |
$fname=$info[1]; |
| 1225 |
if ( !$cmdoptions->{'e'} ){ $fname =~ s{\.[^.]+$}{} } |
| 1226 |
if ( $info[1] ){ chomp($fname); print OUTFILE " $fname@" } |
| 1227 |
if ( $info[3] ){ chomp($info[3]); print OUTFILE ":$info[3]" } |
| 1228 |
print OUTFILE ",\n"; |
| 1229 |
} |
| 1230 |
print OUTFILE "}\n"; |
| 1231 |
} |
| 1232 |
close OUTFILE; |
| 1233 |
} |
| 1234 |
} |
| 1235 |
|
| 1236 |
|
| 1237 |
## |
| 1238 |
## MAIN |
| 1239 |
## |
| 1240 |
|
| 1241 |
fileprocess( processCommandLine() ); |
| 1242 |
% \iffalse |
| 1243 |
%</mycv-split-contents.pl> |
| 1244 |
% \fi |
| 1245 |
% |
| 1246 |
% \Finale |
| 1247 |
\endinput |