aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2023-11-18 20:16:52 +0800
committerAaron LI <aly@aaronly.me>2023-11-18 20:18:45 +0800
commit9b38bc35b590bfbccffc10de0b910165984e6537 (patch)
treea353735a144d4b574eb09d9637077a10ae9daa79
parentd3ac3b1a2c8eb3f8afa0bad6e2abb0bacc6dc9c2 (diff)
downloadresume-9b38bc35b590bfbccffc10de0b910165984e6537.tar.bz2
class: Enhance '\photo' command to support circle and square shapse
Implement a new optional argument [shape] to the '\photo' command, with the default shape being the original 'circle' shape, and thus allow the user to easily switch to 'square' shape. Close: #18
-rw-r--r--resume.cls29
1 files changed, 20 insertions, 9 deletions
diff --git a/resume.cls b/resume.cls
index 4d9bede..3bed5d6 100644
--- a/resume.cls
+++ b/resume.cls
@@ -12,7 +12,7 @@
%% https://www.latextemplates.com/template/plasmati-graduate-cv
%%
-\ProvidesClass{resume}[2023/02/03 v2.5.1 Resume Class]
+\ProvidesClass{resume}[2023/11/18 v2.5.2 Resume Class]
\LoadClass{article}
%%
@@ -34,6 +34,7 @@
]{geometry}
\RequirePackage{xparse}
\RequirePackage{etoolbox}
+\RequirePackage{ifthen}
\RequirePackage{fontspec}
\RequirePackage{fontawesome5}
\RequirePackage{parskip} % auto adjust parskip and items skip
@@ -257,8 +258,13 @@
% File information
\newcommand*{\fileinfo}[1]{\def\@fileinfo{#1}}
-% Photo: \photo{<diameter>}{<photo>}
-\newcommand{\photo}[2]{\def\@photo{#2}\def\@photodiameter{#1}}
+% Photo: \photo[<shape>]{<width>}{<filename>}
+% Two shapes are supported: circle (default), square
+\NewDocumentCommand{\photo}{O{circle}mm}{
+ \def\@photoshape{#1}
+ \def\@photowidth{#2}
+ \def\@photofile{#3}
+}
% Address
\newcommand*{\address}[1]{\icontext{\locationSymbol}{#1}}
@@ -311,17 +317,22 @@
% Render resume header
\newcommand*{\makeheader}{
- \ifdef{\@photodiameter}{
- \begin{minipage}{\@photodiameter}
- \tikz\path[fill overzoom image={\@photo}]
- circle[radius=0.5\linewidth];
+ \ifdef{\@photowidth}{
+ \begin{minipage}{\@photowidth}
+ \ifthenelse{\equal{\@photoshape}{square}}{%
+ \tikz\path[fill overzoom image={\@photofile}]
+ rectangle (\linewidth, \linewidth);
+ }{%
+ \tikz\path[fill overzoom image={\@photofile}]
+ circle[radius=0.5\linewidth];
+ }
\end{minipage}
\hspace{1em}
}{}
- \ifundef{\@photodiameter}{%
+ \ifundef{\@photowidth}{%
\begin{minipage}{\linewidth}
}{%
- \begin{minipage}{\dimexpr\linewidth-\@photodiameter-2em}
+ \begin{minipage}{\dimexpr\linewidth-\@photowidth-2em}
}
\user{\@firstname}{\@lastname}
\ifdef{\@tagline}{%