Fold phone handling into \social

This commit is contained in:
Łukasz Dobrowolski 2025-09-15 01:58:56 +02:00
commit 6309e011e0
13 changed files with 16 additions and 60 deletions

View file

@ -238,22 +238,12 @@
% where <optional protocol> should be either "https" (default) or "http"
\NewDocumentCommand{\homepage}{O{https}m}{\def\@homepageprotocol{#1}\def\@homepage{#2}}
% adds a fixed/mobile/fax number to one's personal information (optional)
% usage: \phone[<optional type>]{<number>}
% where <optional type> should be either "fixed" (default), "mobile" or "fax
\collectionnew{phones}
\NewDocumentCommand{\phone}{O{fixed}m}{%
\ifthenelse{\equal{#1}{fax}}%
{\collectionadd[#1]{phones}{#2}}
{\collectionadd[#1]{phones}{\protect\tellink{#2}}}
}
% http://latex.org/forum/viewtopic.php?t=12239
\def\SplitMyMacro#1/#2{#2}
% Define links for different social networks
\newcommand{\emaillink}[2]{\protect\href{mailto:#2}{#1}}
\newcommand{\mobilephonelink}[2]{\protect\tellink[#1]{#2}}
\newcommand{\linkedinlink}[2]{\protect\httpslink[#1]{www.linkedin.com/in/#2}}
\newcommand{\xinglink}[2]{\protect\httpslink[#1]{www.xing.com/profile/#2}}
\newcommand{\twitterlink}[2]{\protect\httpslink[#1]{twitter.com/#2}}
@ -345,9 +335,9 @@
\newcommand*{\listitemsymbol} {\labelitemi~}
\newcommand*{\addresssymbol} {}
\newcommand*{\bornsymbol} {}
\newcommand*{\mobilephonesymbol} {}
\newcommand*{\fixedphonesymbol} {}
\newcommand*{\faxphonesymbol} {}
\newcommand*{\mobilephonesocialsymbol} {}
\newcommand*{\fixedphonesocialsymbol} {}
\newcommand*{\faxphonesocialsymbol} {}
\newcommand*{\emailsocialsymbol} {}
\newcommand*{\homepagesymbol} {}
\newcommand*{\linkedinsocialsymbol} {}

View file

@ -86,8 +86,6 @@
\ifthenelse{\equal{\@addresscountry}{}}{}{\addtofoot[~--~]{\@addresscountry}}%
\flushfoot\@firstfootelementtrue\\}%
\ifthenelse{\isundefined{\@born}}{}{\addtofoot{\bornsymbol\@born}\flushfoot\@firstfootelementtrue\\}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\addtofoot{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\ifthenelse{\isundefined{\@homepage}}{}{\addtofoot{\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
@ -118,8 +116,6 @@
\ifthenelse{\equal{\@addresscountry}{}}{}{\addtofoot[~--~]{\@addresscountry}}%
\flushfoot\@firstfootelementtrue\\}%
\ifthenelse{\isundefined{\@born}}{}{\addtofoot{\bornsymbol\@born}\flushfoot\@firstfootelementtrue\\}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\addtofoot{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\ifthenelse{\isundefined{\@homepage}}{}{\addtofoot{\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link

View file

@ -72,9 +72,6 @@
% optional detailed information (pre-rendering)
\@initializebox{\makecvheaddetailsbox}%
\if@details%
\def\phonesdetails{}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\def\socialsdetails{}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\protected@edef\socialsdetails{\socialsdetails\protect\makenewline\collectionloopitem}}%
@ -86,7 +83,6 @@
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\ifthenelse{\isundefined{\@born}}{}{\makenewline\bornsymbol\@born}%
\phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}%
\socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
@ -174,8 +170,6 @@
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link

View file

@ -141,8 +141,6 @@
\ifthenelse{\equal{\@addresscountry}{}}{}{\addtomakeheaddetails[~--~]{\@addresscountry}}%
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\\\null}%
\ifthenelse{\isundefined{\@born}}{}{\addtomakeheaddetails{\bornsymbol\@born}}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\addtomakeheaddetails{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\ifthenelse{\isundefined{\@homepage}}{}{\addtomakeheaddetails{\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link

View file

@ -94,8 +94,6 @@
\ifthenelse{\equal{\@addresscountry}{}}{}{\addtomakeheaddetails[~--~]{\@addresscountry}}%
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\\}%
\ifthenelse{\isundefined{\@born}}{}{\addtomakeheaddetails{\bornsymbol\@born}}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\addtomakeheaddetails{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\ifthenelse{\isundefined{\@homepage}}{}{\addtomakeheaddetails{\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
@ -153,8 +151,6 @@
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link

View file

@ -110,8 +110,6 @@
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\ifthenelse{\isundefined{\@born}}{}{\makenewline\hbox to 1.0em{\bornsymbol}~\@born}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\makenewline\hbox to 1.0em{\csname\collectionloopkey phonesymbol\endcsname}~\collectionloopitem}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\hbox to 1.0em{\homepagesymbol}~%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
@ -158,8 +156,6 @@
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\makenewline\hbox to 1.0em{\csname\collectionloopkey phonesymbol\endcsname}~\collectionloopitem}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\hbox to 1.0em{\homepagesymbol}~%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link

View file

@ -82,8 +82,6 @@
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and \addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\ifthenelse{\isundefined{\@born}}{}{\makenewline\bornsymbol~\@born}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\makenewline\csname\collectionloopkey phonesymbol\endcsname~\collectionloopitem}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol~%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
@ -154,8 +152,6 @@
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}%
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link

View file

@ -115,8 +115,6 @@
\ifthenelse{\equal{\@addresscountry}{}}{}{\addtomakeheaddetails[~--~]{\@addresscountry}}%
\flushmakeheaddetails\@firstmakeheaddetailselementtrue\\\null}%
\ifthenelse{\isundefined{\@born}}{}{\addtomakeheaddetails{\bornsymbol\@born}}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\addtomakeheaddetails{\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\ifthenelse{\isundefined{\@homepage}}{}{\addtomakeheaddetails{\homepagesymbol%
\ifthenelse{\equal{\@homepageprotocol}{http}}{\httplink{\@homepage}}{\httpslink{\@homepage}}}}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link

View file

@ -79,9 +79,6 @@
% optional detailed information (pre-rendering)
\@initializebox{\makecvheaddetailsbox}%
\if@details%
\def\phonesdetails{}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\def\socialsdetails{}%
\collectionloop{socials}{% the key holds the social type (=symbol command prefix), the item holds the link
\protected@edef\socialsdetails{\socialsdetails\protect\makenewline\collectionloopitem}}%
@ -93,7 +90,6 @@
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\ifthenelse{\isundefined{\@born}}{}{\makenewline\bornsymbol\@born}%
\phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\socialsdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
@ -186,9 +182,6 @@
\@initializebox{\makeletterdetailsbox}%
\if@details%
\def\phonesdetails{}%
\collectionloop{phones}{% the key holds the phone type (=symbol command prefix), the item holds the number
\protected@edef\phonesdetails{\phonesdetails\protect\makenewline\csname\collectionloopkey phonesymbol\endcsname\collectionloopitem}}%
\savebox{\makeletterdetailsbox}{%
\addressfont\color{headtext}%
\if@left\begin{tabular}[b]{@{}r@{}}\fi%
@ -196,7 +189,6 @@
\ifthenelse{\isundefined{\@addressstreet}}{}{\makenewline\addresssymbol\@addressstreet%
\ifthenelse{\equal{\@addresscity}{}}{}{\makenewline\@addresscity}% if \addresstreet is defined, \addresscity and addresscountry will always be defined but could be empty
\ifthenelse{\equal{\@addresscountry}{}}{}{\makenewline\@addresscountry}}%
\phonesdetails% needs to be pre-rendered as loops and tabulars seem to conflict
\ifthenelse{\isundefined{\@homepage}}{}{\makenewline\homepagesymbol\httplink{\@homepage}}%
\ifthenelse{\isundefined{\@extrainfo}}{}{\makenewline\@extrainfo}%
\end{tabular}%

View file

@ -38,9 +38,9 @@
%\newcommand*{\listitemsymbol} {\labelitemi~}
%\newcommand*{\addresssymbol} {}
%\newcommand*{\bornsymbol} {}
%\newcommand*{\mobilephonesymbol} {}
%\newcommand*{\fixedphonesymbol} {}
%\newcommand*{\faxphonesymbol} {}
%\newcommand*{\mobilephonesocialsymbol} {}
%\newcommand*{\fixedphonesocialsymbol} {}
%\newcommand*{\faxphonesocialsymbol} {}
%\newcommand*{\emailsocialsymbol} {}
%\newcommand*{\homepagesymbol} {}
%\newcommand*{\linkedinsocialsymbol} {}

View file

@ -66,9 +66,9 @@
%\renewcommand*{\addresssymbol} {}
\renewcommand*{\mobilephonesymbol} {{\color{mobilephone}\small\faMobile*}~} % alternative: \faMobile (solid style)
\renewcommand*{\fixedphonesymbol} {{\color{fixedphone}\small\faPhone*}~} % alternative: \faPhone (reversed)
\renewcommand*{\faxphonesymbol} {{\color{faxphone}\small\faFax}~} % alternative: \faPrint
\renewcommand*{\mobilephonesocialsymbol} {{\color{mobilephone}\small\faMobile*}~} % alternative: \faMobile (solid style)
\renewcommand*{\fixedphonesocialsymbol} {{\color{fixedphone}\small\faPhone*}~} % alternative: \faPhone (reversed)
\renewcommand*{\faxphonesocialsymbol} {{\color{faxphone}\small\faFax}~} % alternative: \faPrint
\renewcommand*{\emailsocialsymbol} {{\color{email}\small\faEnvelope[regular]}~} % alternative: \faInbox, \faEnvelope (solid style)
\renewcommand*{\homepagesymbol} {{\color{homepage}\small\faGlobeAmericas}~} % alternative: \faHome, \faGlobe, \faGlobeEurope, \faGlobeAfrica, \faGlobeAsia
\renewcommand*{\linkedinsocialsymbol} {{\color{linkedin}\small\faLinkedinIn}~} % alternative: \faLinkedin

View file

@ -23,9 +23,9 @@
%\renewcommand*{\labelitemiv} {\labelitemiii} % no change from default in moderncv.cls
\renewcommand*{\addresssymbol} {}
\renewcommand*{\mobilephonesymbol} {\textbf{M}~}
\renewcommand*{\fixedphonesymbol} {\textbf{T}~}
\renewcommand*{\faxphonesymbol} {\textbf{F}~}
\renewcommand*{\mobilephonesocialsymbol} {\textbf{M}~}
\renewcommand*{\fixedphonesocialsymbol} {\textbf{T}~}
\renewcommand*{\faxphonesocialsymbol} {\textbf{F}~}
\renewcommand*{\emailsocialsymbol} {\textbf{E}~}
\renewcommand*{\homepagesymbol} {\textbf{W}~}
\renewcommand*{\linkedinsocialsymbol} {\textbf{in}~}

View file

@ -19,9 +19,9 @@
\renewcommand*{\labelitemi} {\strut\textcolor{color1}{\marvosymbol{123}}} % equivalent to \Neutral from marvosym package; alternative: \fontencoding{U}\fontfamily{ding}\selectfont\tiny\symbol{'102}
\renewcommand*{\mobilephonesymbol} {\marvosymbol{72}~}
\renewcommand*{\fixedphonesymbol} {\marvosymbol{84}~}
\renewcommand*{\faxphonesymbol} {\marvosymbol{117}~}
\renewcommand*{\mobilephonesocialsymbol}{\marvosymbol{72}~}
\renewcommand*{\fixedphonesocialsymbol}{\marvosymbol{84}~}
\renewcommand*{\faxphonesocialsymbol}{\marvosymbol{117}~}
\renewcommand*{\emailsocialsymbol} {\marvosymbol{66}~}
\renewcommand*{\homepagesymbol} {{\Large\marvosymbol{205}}~}