From 3dd1fd22ea779b30ee679f153fdb9630724b55bb Mon Sep 17 00:00:00 2001 From: Xavier Danaux Date: Fri, 22 Feb 2013 19:21:52 -0500 Subject: [PATCH] Deprecated \phone, \mobile and \fax in favour of \phone[type] --- .bzrignore | 4 +- CHANGELOG | 2 + collection.sty | 85 ++++++++++++++++++++++++++++ examples/template-es.pdf | Bin 171988 -> 171988 bytes examples/template-zh.pdf | Bin 241627 -> 241627 bytes examples/template.pdf | Bin 235045 -> 235045 bytes examples/template_banking_red.pdf | Bin 169202 -> 169202 bytes examples/template_casual_orange.pdf | Bin 235052 -> 235052 bytes examples/template_classic_green.pdf | Bin 279245 -> 279245 bytes examples/template_multibib.pdf | Bin 235582 -> 235582 bytes examples/template_oldstyle_grey.pdf | Bin 70640 -> 70640 bytes moderncv.cls | 17 ++---- moderncvcompatibility.sty | 9 +++ 13 files changed, 103 insertions(+), 14 deletions(-) create mode 100644 collection.sty diff --git a/.bzrignore b/.bzrignore index 3896863..61610e8 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1,6 +1,4 @@ *xdanaux* *.sh examples/*.sh -examples/template_casual_orange.tex -examples/template_classic_green.tex -examples/template_multibib.tex +examples/template_*.tex diff --git a/CHANGELOG b/CHANGELOG index fd3f793..e33e951 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ version 1.4.0 (dd MMM 2013) + - deprecated \phone, \mobile and \fax in favour of \phone[], where + can be "mobile", "fixed" (default) or "fax". - deprecated \firstname and \familyname in favour of \name{}{}. - removed the use of the suffix package. diff --git a/collection.sty b/collection.sty new file mode 100644 index 0000000..e4e5bca --- /dev/null +++ b/collection.sty @@ -0,0 +1,85 @@ +%% start of file `collection.sty'. +%% Copyright 2013-2013 Xavier Danaux (xdanaux@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/. + + +%------------------------------------------------------------------------------- +% identification +%------------------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{collection}[2013/02/19 v1.0.0 collections] + + +%------------------------------------------------------------------------------- +% requirements +%------------------------------------------------------------------------------- + + +\RequirePackage{ifthen} + + +%------------------------------------------------------------------------------- +% code +%------------------------------------------------------------------------------- + +% creates a new collection +% usage: \collectionnew{} +\newcommand*{\collectionnew}[1]{% + \newcounter{collection@#1@count}} + +% adds an item to a collection +% usage: \collectionadd[]{}{} +\newcommand*{\collectionadd}[3][]{% + \expandafter\def\csname collection@#2@item\roman{collection@#2@count}\endcsname{#3}% + \if\relax\noexpand#1\relax% if #1 is empty + \else\expandafter\def\csname collection@#2@key\roman{collection@#2@count}\endcsname{#1}\fi% + \stepcounter{collection@#2@count}} + +% returns the number of items in a collection +% usage: \collectioncount{} +\newcommand*{\collectioncount}[1]{% + \value{collection@#1@count}} + +% gets an item from a collection +% usage: \collectiongetitem{}{} +% where is an integer between 0 and (collectioncount-1) +\newcommand*{\collectiongetitem}[2]{% + \csname collection@#1@item\romannumeral #2\endcsname} + +% gets a key from a collection +% usage: \collectiongetkey{}{} +% where is an integer between 0 and (collectioncount-1) +\newcommand*{\collectiongetkey}[2]{% + \csname collection@#1@key\romannumeral #2\endcsname} + +% loops through a collection and perform the given operation on every element +% usage: \collectionloop{}{} +% where is the code sequence to be evaluated for each collection item, +% code which can refer to \collectionloopid, \collectionloopkey, \collectionloopitem and +% \collectionloopbreak +\newcounter{collection@iterator} +\newcommand*{\collectionloopbreak}{\let\iterate\relax} +\newcommand*{\collectionloop}[2]{% + \setcounter{collection@iterator}{0}% + \loop\ifnum\value{collection@iterator}<\value{collection@#1@count}% + \def\collectionloopid{\arabic{collection@iterator}}% + \def\collectionloopitem{\collectiongetitem{#1}{\collectionloopid}}% + \def\collectionloopkey{\collectiongetkey{#1}{\collectionloopid}}% + #2% + \stepcounter{collection@iterator}% + \repeat} + +% loops through a collection and finds the (first) element matching the given key +% usage: \collectionfindbykey{}{key>} +\newcommand*{\collectionfindbykey}[2]{% + \collectionloop{#1}{% + \ifthenelse{\equal{\collectionloopkey}{#2}}{\collectionloopitem\collectionloopbreak}{}}} + + +\endinput + + +%% end of file `collection.cls'. diff --git a/examples/template-es.pdf b/examples/template-es.pdf index 19d98fbe251b752939b586a1d831fe4158d2f4ec..387c6110a6f44c95f55328729e134146b127e058 100644 GIT binary patch delta 115 zcmcbzpX}+D_WMpXQ=$$}cw2Y3OWbXku>Z=4NW_W@zkc;_77P>f&anVB<IMetnq2z6`6(`mC8-J;E>=bchQL=xxtJL{I++=m7`T~O8rvz@5KyvRWirz_ FMgXEZA}9a= delta 136 zcmeyglIzn-u7(!IElfOp+J>eEMg|7PCb|Zu>IMetnq2z6`6(`mC8-J;E>=bchQ}Gz??(F1jXkl(@=Nk%#4g(jVzrF%#Dnk&5R74+>D&;6l@47*?!!Cg^dXSv9}&_ delta 120 zcmX@xDtNY4u%U&qg{g&k3rmLuhoPx~k%57c@$?B6EYfh^_RSV77ulW7Ow3&^ot%t~ n%v@Yt44s@T-7FoQ9SsaE%*`w;U0h7<6l@47*?!!Cg^dXS!XY01 diff --git a/examples/template_multibib.pdf b/examples/template_multibib.pdf index 7b80226462fc8bebc6cb4f617643acaa5878fd95..2bb1e275ee0569c2d711e77bf6ff79a01cc04ef7 100644 GIT binary patch delta 118 zcmdnDfp6aizJ?aY7N#xCfjt~XMuwJ##-@hTBYT*o;k@lNJJC=0G7Q3qxZ|M+;MDI|Um;O16tkW7c8<0Cv9}rvLx| delta 118 zcmdnDfp6aizJ?aY7N#xCfju0CrUpg^1|}xcBYT*o;k@lNJ}=v_;AG@t=4fncXl!I* hZsuxk>SF3*Zs=lYW@c#S;%cX0LrBSXT_MK9i~u+*9gzS4 diff --git a/moderncv.cls b/moderncv.cls index 92a06ca..706b77e 100644 --- a/moderncv.cls +++ b/moderncv.cls @@ -235,17 +235,12 @@ % usage: \address{}{}{} % where the and arguments can be omitted or provided empty \NewDocumentCommand{\address}{mG{}G{}}{\def\@addressstreet{#1}\def\@addresscity{#2}\def\@addresscountry{#3}} -% defines one's mobile phone number (optional) -% usage: \mobile{} -\newcommand*{\mobile}[1]{\def\@mobile{#1}} -% defines one's fixed phone number (optional) -% usage: \phone{} -\newcommand*{\phone}[1]{\def\@phone{#1}} -% defines one's fax number (optional) -% usage: \fax{} -\newcommand*{\fax}[1]{\def\@fax{#1}} -% defines one's email address (optional) -% usage: \email{} +% adds a mobile/fixed/fax number to one's personal information (optional) +% usage: \phone[]{} +% where should be either "mobile", "fixed" or "fax +\RequirePackage{collection} +\collectionnew{phones} +\newcommand*{\phone}[2][fixed]{\collectionadd[#1]{phones}{#2}} \newcommand*{\email}[1]{\def\@email{#1}} % defines one's home page (optional) % usage: \homepage{} diff --git a/moderncvcompatibility.sty b/moderncvcompatibility.sty index 7aab158..8772a0d 100644 --- a/moderncvcompatibility.sty +++ b/moderncvcompatibility.sty @@ -86,6 +86,15 @@ \newcommand*{\familyname}[1]{\def\@lastname{#1}} \def\@familyname{\@lastname} +% compatibility with versions <= 1.4.0 +\newcommand*{\mobile}[1]{\collectionadd[mobile]{phones}{#1}} +%\newcommand*{\phone}[1]{\collectionadd[fixed]{phones}{#1}}% implicit, as \phone{...} defaults to \phone[fixed]{...} +\newcommand*{\fax}[1]{\collectionadd[fax]{phones}{#1}} +\newcommand*{\@mobile}{\collectionfindbykey{phones}{mobile}} +\newcommand*{\@phone}{\collectionfindbykey{phones}{fixed}} +\newcommand*{\@fax}{\collectionfindbykey{phones}{fax}} + + \endinput