summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mycv/mycv_base.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-04-13 22:31:07 +0000
committerKarl Berry <karl@freefriends.org>2012-04-13 22:31:07 +0000
commit623c812ad9f18e80cd3ca0032ec3ec4187202593 (patch)
tree9c1c9a6a858f51e197cb1ad03b7a0257e13baa2b /Master/texmf-dist/tex/latex/mycv/mycv_base.tex
parent844a044419a675256a955f28ebf38f85433ba27f (diff)
new latex package mycv (13apr12)
git-svn-id: svn://tug.org/texlive/trunk@25955 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mycv/mycv_base.tex')
-rw-r--r--Master/texmf-dist/tex/latex/mycv/mycv_base.tex341
1 files changed, 341 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/mycv/mycv_base.tex b/Master/texmf-dist/tex/latex/mycv/mycv_base.tex
new file mode 100644
index 00000000000..0c059f91916
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/mycv/mycv_base.tex
@@ -0,0 +1,341 @@
+% -------------------------------------------------------
+% start of file 'mycv_base.tex'.
+% 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'.
+% -------------------------------------------------------
+
+\ProvidesFile{mycv_base.tex}
+
+%%%%%%%%%%%%%%%%%%
+% %
+% Default values %
+% %
+%%%%%%%%%%%%%%%%%%
+
+\def\@mainbodypagesize{1.00}
+\def\@subbodypagesize{0.45}
+
+\def\@mainheaderpagesize{1.00}
+\def\@subheaderpagesize{0.44}
+
+\def\@mainfooterpagesize{1.00}
+\def\@subfooterpagesize{0.44}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% Layout components (parser) %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def\@cmdsListSep{:}
+\def\@argsListSep{=}
+
+\expandaftercmds{\DeclareCmdListParser\MyParserCmds}{\@cmdsListSep}
+\expandaftercmds{\DeclareCmdListParser\MyParserArgs}{\@argsListSep}
+
+% -----------------------------------
+% setup file components: header pages
+% -----------------------------------
+
+\def\@MainHeaderPageBegin{MainHeaderPageBegin}
+\def\@SubHeaderPageBegin{SubHeaderPageBegin}
+\def\@MainHeaderPageEnd{MainHeaderPageEnd}
+\def\@SubHeaderPageEnd{SubHeaderPageEnd}
+
+% ---------------------------------
+% setup file components: body pages
+% ---------------------------------
+
+\def\@MainBodyPageBegin{MainBodyPageBegin}
+\def\@MainBodyPageEnd{MainBodyPageEnd}
+\def\@SubBodyPageBegin{SubBodyPageBegin}
+\def\@SubBodyPageEnd{SubBodyPageEnd}
+
+\def\@MainFooterPageBegin{MainFooterPageBegin}
+\def\@SubFooterPageBegin{SubFooterPageBegin}
+\def\@MainFooterPageEnd{MainFooterPageEnd}
+\def\@SubFooterPageEnd{SubFooterPageEnd}
+
+% -------------------
+% regular expressions
+% -------------------
+
+\def\@regexPreCmd{<precmd:([-!*@.0-9A-Za-z \@cmdsListSep\@argsListSep]+)>}
+\def\@regexPostCmd{<postcmd:([-!*@.0-9A-Za-z \@cmdsListSep\@argsListSep]+)>}
+\def\@regexArgsList{\@argsListSep([-!*@.0-9A-Za-z \@argsListSep]+)}
+
+\def\@regexMarginLB{/ml([0-9.-]+.{2})}
+\def\@regexMarginRB{/mr([0-9.-]+.{2})}
+\def\@regexPageSizeAbs{/pagesize([0-9.]+.{2})/}
+\def\@regexPagebreak{/pagebreak/}
+\def\@regexPageSize{<([0-9.]+)>}
+\def\@regexMarginLE{/endml/}
+\def\@regexMarginRE{/endmr/}
+\def\@regexFileName{^(.+)@}
+\def\@regexCmdName{([a-zA-Z]+)}
+\def\@regexFileVar{^.{1}([A-Za-z]+)}
+\def\@regexParamTypeA{^[@]}
+\def\@regexParamTypeB{^[!]}
+\def\@regexParamTypeC{^[*]}
+
+% ==================
+% Auxiliary commands
+% ==================
+
+\newcommand{\@concatCommandArg}[1]{%
+ \ifnum\pdfmatch{\@regexParamTypeA}{#1}=1
+ \StrGobbleLeft{#1}{1}[\arg]
+ \expandafter\g@addto@macro\expandafter\args%
+ \expandafter{\expandafter[\arg]}
+ \else
+ \ifnum\pdfmatch{\@regexParamTypeB}{#1}=1
+ \StrGobbleLeft{#1}{1}[\arg]
+ \expandafter\g@addto@macro\expandafter\args%
+ \expandafter{\expandafter<\arg>}
+ \else
+ \ifnum\pdfmatch{\@regexParamTypeC}{#1}=1
+ \g@addto@macro\args{*}
+ \else
+ \g@addto@macro\args{{#1}}
+ \fi
+ \fi
+ \fi%
+}
+
+\newcommand{\@execCommand}[1]{%
+ \let\args\@empty
+ \ifnum\pdfmatch{\@regexArgsList}{#1}=1
+ \@getRegexResult{\argslist}
+ \ifnum\pdfmatch{\@regexCmdName}{#1}=1
+ \@getRegexResult{\cmd}
+ \fi
+ \MyParserArgs[\@concatCommandArg]\argslist
+ \expandaftercmds{\csuse\cmd}{\args}
+ \else
+ \csuse{#1}
+ \fi%
+}
+
+\newcommand{\@getRegexResult}[1]{%
+ \StrPosition{\pdflastmatch 1}{>}[\n]
+ \StrGobbleLeft{\pdflastmatch 1}{\n}[#1]%
+}
+
+\newcommand{\@executeCommandList}[2]{%
+ \ifnum\pdfmatch{#2}{#1}=1%
+ \StrPosition{\pdflastmatch 1}{>}[\n]
+ \StrGobbleLeft{\pdflastmatch 1}{\n}[\cmdlist]
+ \MyParserCmds[\@execCommand]\cmdlist
+ \fi%
+}
+
+\newcommand{\@parsePageBegin}[2]{%
+ \let\pagewidth#2
+ \ifnum\pdfmatch{\@regexPageSize}{#1}=1
+ \@getRegexResult{\pagewidth}
+ \fi
+ \@executeCommandList{#1}{\@regexPreCmd}
+ \ifnum\pdfmatch{\@regexPageSizeAbs}{#1}=1
+ \@getRegexResult{\pagewidth}
+ \noindent\begin{minipage}[t]{\pagewidth}
+ \else
+ \noindent\begin{minipage}[t]{\pagewidth\textwidth}
+ \fi
+ \@executeCommandList{#1}{\@regexPostCmd}
+ \ifnum\pdfmatch{\@regexMarginLB}{#1}=1
+ \@getRegexResult{\marginsize}
+ \begin{mychangemarginLeft}{\marginsize}
+ \fi
+ \ifnum\pdfmatch{\@regexMarginRB}{#1}=1
+ \@getRegexResult{\marginsize}
+ \begin{mychangemarginRight}{\marginsize}
+ \fi%
+}
+
+\newcommand{\@parsePageEnd}[1]{%
+ \ifnum\pdfmatch{\@regexMarginRE}{#1}=1
+ \end{mychangemarginRight}
+ \fi
+ \ifnum\pdfmatch{\@regexMarginLE}{#1}=1
+ \end{mychangemarginLeft}
+ \fi
+ \@executeCommandList{#1}{\@regexPreCmd}
+ \ifnum\pdfmatch{\@regexPagebreak}{#1}=1
+ \end{minipage}
+
+ \else
+ \end{minipage}
+ \fi
+ \@executeCommandList{#1}{\@regexPostCmd}
+}
+
+\newcommand{\@parseFileName}[1]{%
+ \let\marginsizeleft\relax
+ \let\marginsizeright\relax
+ \@executeCommandList{#1}{\@regexPreCmd}
+ \ifnum\pdfmatch{\@regexMarginLB}{#1}=1
+ \@getRegexResult{\marginsizeleft}
+ \begin{mychangemarginLeft}{\marginsizeleft}
+ \fi
+ \ifnum\pdfmatch{\@regexMarginRB}{#1}=1
+ \@getRegexResult{\marginsizeright}
+ \begin{mychangemarginRight}{\marginsizeright}
+ \fi
+ \IfBeginWith{#1}{*}{%
+ \ifnum\pdfmatch{\@regexFileVar}{\noexpand#1}=1
+ \@getRegexResult{\filename}
+ \fi
+ \input\cvcontentsdir/\csuse{\filename}
+ }%
+ {%
+ \ifnum\pdfmatch{\@regexFileName}{#1}=1
+ \@getRegexResult{\filename}
+ \fi
+ \input\cvcontentsdir/\filename
+ }
+ \@executeCommandList{#1}{\@regexPostCmd}
+ \ifx\marginsizeright\relax
+ \relax
+ \else
+ \end{mychangemarginRight}
+ \fi
+ \ifx\marginsizeleft\relax
+ \relax
+ \else
+ \end{mychangemarginLeft}
+ \fi
+}
+
+% =============
+% Main commands
+% =============
+
+\newcommand{\@bodylayoutlistentry}[1]{%
+ \ifstrmatch{\@SubBodyPageBegin}{#1}{%
+ \@parsePageBegin{#1}{\@subbodypagesize}%
+ }%
+ {%
+ \ifstrmatch{\@SubBodyPageEnd}{#1}{%
+ \@parsePageEnd{#1}%
+ }%
+ {%else
+ \ifstrmatch{\@MainBodyPageBegin}{#1}{%
+ \@parsePageBegin{#1}{\@mainbodypagesize}%
+ }%
+ {%else
+ \ifstrmatch{\@MainBodyPageEnd}{#1}{%
+ \@parsePageEnd{#1}%
+ }%
+ {%else
+ \@parseFileName{#1}%
+ }%
+ }%
+ }%
+ }%
+}
+
+\newcommand{\@headerlayoutlistentry}[1]{%
+ \ifstrmatch{\@MainHeaderPageBegin}{#1}{%
+ \@parsePageBegin{#1}{\@mainheaderpagesize}%
+ }%
+ {%else
+ \ifstrmatch{\@SubHeaderPageBegin}{#1}{%
+ \@parsePageBegin{#1}{\@subheaderpagesize}%
+ }%
+ {%else
+ \ifstrmatch{\@MainHeaderPageEnd}{#1}%
+ {\@parsePageEnd{#1}}%
+ {%else
+ \ifstrmatch{\@SubHeaderPageEnd}{#1}{%
+ \@parsePageEnd{#1}%
+ }%
+ {%else
+ \@parseFileName{#1}%
+ }%
+ }%
+ }%
+ }%
+}
+
+\newcommand{\@footerlayoutlistentry}[1]{%
+ \ifstrmatch{\@MainFooterPageBegin}{#1}{%
+ \@parsePageBegin{#1}{\@mainfooterpagesize}%
+ }%
+ {%else
+ \ifstrmatch{\@SubFooterPageBegin}{#1}{%
+ \@parsePageBegin{#1}{\@subfooterpagesize}%
+ }%
+ {%else
+ \ifstrmatch{\@MainFooterPageEnd}{#1}%
+ { \@parsePageEnd{#1}%
+ }%
+ {%else
+ \ifstrmatch{\@SubFooterPageEnd}{#1}{%
+ \@parsePageEnd{#1}%
+ }%
+ {%else
+ \@parseFileName{#1}%
+ }%
+ }%
+ }%
+ }%
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% Layout components (render) %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand{\@raisewarning}[1]{%
+ \ClassWarning{mycv}{%
+ WARNING! The list <#1> used by 'mycv' class is undefined. %
+ Please, define it before using '\myrenderlayout' command. %
+ }%
+}
+
+\DeclareRobustCommand{\myrenderlayout}[1][a]{%
+ \begingroup
+ \ifsinglechar{b}{#1}{%
+ \@ifundefined{bodylayoutlist}%
+ {\@raisewarning{bodylayoutlist}}% else
+ {\csvloop[\@bodylayoutlistentry]{\bodylayoutlist}}%
+ }%
+ {%else
+ \ifsinglechar{h}{#1}{%
+ % --------
+ % HEADINGS
+ % --------
+ \@ifundefined{headerlayoutlist}%
+ {\@raisewarning{headerlayoutlist}}% else
+ {\csvloop[\@headerlayoutlistentry]\headerlayoutlist}%
+ }%
+ {%else
+ % ------------------------------------------------
+ % FOOTINGS: sign and treatment of personal details
+ % ------------------------------------------------
+ \ifsinglechar{f}{#1}{%
+ \@ifundefined{footerlayoutlist}%
+ {\@raisewarning{footerlayoutlist}}% else
+ {\csvloop[\@footerlayoutlistentry]\footerlayoutlist}%
+ }%
+ {%\else
+ % --------------
+ % ALL COMPONENTS
+ % --------------
+ \@ifundefined{headerlayoutlist}%
+ {\@raisewarning{headerlayoutlist}}% else
+ {\csvloop[\@headerlayoutlistentry]\headerlayoutlist}%
+ \@ifundefined{bodylayoutlist}%
+ {\@raisewarning{bodylayoutlist}}% else
+ {\csvloop[\@bodylayoutlistentry]\bodylayoutlist}
+ \@ifundefined{footerlayoutlist}%
+ {\@raisewarning{footerlayoutlist}}% else
+ {\csvloop[\@footerlayoutlistentry]\footerlayoutlist}%
+ }%
+ }%
+ }%
+ \endgroup
+} \ No newline at end of file