diff options
author | Aaron LI <aly@aaronly.me> | 2024-12-06 09:16:39 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2024-12-06 09:16:39 +0800 |
commit | 4c316f5e66dc380bf194a150e43d34395dd1aecb (patch) | |
tree | 5b2b0e5041f881b67f00b4f84fd7fd1bd6a074af /resume.cls | |
parent | ddc7ca28fa62b933e72075b47c417868ea2289ab (diff) | |
download | resume-4c316f5e66dc380bf194a150e43d34395dd1aecb.tar.bz2 |
class: Refactor "\photo" again to support left/right position
Extend the "\photo" command to support to place the photo on the right
side of profile, which can be controlled with the new "position"
parameter key. Use the "keyval" package to implement the key=value
style optional parameters for the "\photo" command.
See also: PR #21
Diffstat (limited to 'resume.cls')
-rw-r--r-- | resume.cls | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -34,7 +34,6 @@ ]{geometry} \RequirePackage{xparse} \RequirePackage{etoolbox} -\RequirePackage{ifthen} \RequirePackage{fontspec} \RequirePackage{fontawesome5} \RequirePackage{parskip} % auto adjust parskip and items skip @@ -50,6 +49,7 @@ \RequirePackage[skins]{tcolorbox} % required by tikz to make the header \RequirePackage{csquotes} \RequirePackage{relsize} % relatively scale the icons +\RequirePackage{keyval} % key=value style parameters \ifdef{\@zh}{ \RequirePackage{xeCJK} }{} @@ -259,13 +259,22 @@ % File information \newcommand*{\fileinfo}[1]{\def\@fileinfo{#1}} -% Photo: \photo[<shape>]{<width>}{<filename>} -% Two shapes are supported: circular (default), square -\NewDocumentCommand{\photo}{O{circular}mm}{ +% Photo: +% \photo[ +% shape=<circular|square>, % default is circular +% position=<left|right>, % default is left +% ]{<width>}{<filename>} +\define@key{photo}{shape}{\def\@photo@shape{#1}} +\define@key{photo}{position}{\def\@photo@position{#1}} +\NewDocumentCommand{\photo}{ + O{shape=circular, position=left} + m m +}{ + \setkeys{photo}{#1} \def\@photo@width{#2} \def\@photo{% \begin{minipage}{\@photo@width} - \ifthenelse{\equal{#1}{square}}{% + \ifdefstring{\@photo@shape}{square}{% \tikz\path[fill overzoom image={#3}] rectangle (\linewidth, \linewidth);% }{% @@ -320,7 +329,9 @@ }{ \def\@profile@width{\linewidth} }% - \ifdef{\@photo}{\@photo\hspace{1em}}{}% + \ifdefstring{\@photo@position}{left}{% + \@photo\hspace{1em}% + }{}% \begin{minipage}{\@profile@width} {\LARGE\bfseries\color{accentcolor} \@name} \ifdef{\@tagline}{% @@ -330,6 +341,8 @@ \medskip \\ \@profile \end{minipage} + % photo on the right side + \ifdefstring{\@photo@position}{left}{}{\hfill\@photo} } %% |