Refactor photo command

This commit is contained in:
Posquit0.BJ 2016-12-03 06:29:14 +09:00
parent 29ef605bc1
commit 031a53d1fb
4 changed files with 52 additions and 50 deletions

View file

@ -21,7 +21,7 @@
%------------------------------------------------------------------------------- %-------------------------------------------------------------------------------
% Identification % Identification
%------------------------------------------------------------------------------- %-------------------------------------------------------------------------------
\ProvidesClass{awesome-cv}[2016/01/30 v1.5 Awesome Curriculum Vitae Class] \ProvidesClass{awesome-cv}[2016/12/03 v1.6 Awesome Curriculum Vitae Class]
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
@ -236,20 +236,21 @@
% Commands for personal information % Commands for personal information
%------------------------------------------------------------------------------- %-------------------------------------------------------------------------------
% Define photo ID % Define photo ID
% Usage: \photoid[circle|rectangle,edge|noedge]{<path-to-image>} % Usage: \photo[circle|rectangle,edge|noedge,left|right]{<path-to-image>}
\newcommand{\photoid}[2][circle,edge]{% \newcommand{\photo}[2][circle,edge,left]{%
\@for\tmp:=#1\do{% \def\@photo{#2}
\ifthenelse{ \@for\tmp:=#1\do{%
\equal{\tmp}{circle} \ifthenelse{\equal{\tmp}{circle} \or \equal{\tmp}{rectangle}}%
\or \equal{\tmp}{rectangle} {\let\@photoshape\tmp}{}%
}{\let\@phishape\tmp}{ \ifthenelse{\equal{\tmp}{edge} \or \equal{\tmp}{noedge}}%
\ifthenelse{ {\let\@photoedge\tmp}{}%
\equal{\tmp}{edge} \ifthenelse{\equal{\tmp}{left} \or \equal{\tmp}{right}}%
\or \equal{\tmp}{noedge} {\let\@photoalign\tmp}{}%
}{\let\@phiedge\tmp}{} }%
} }
}% \def\@photoshape{circle}
\def\@phid{#2}} \def\@photoedge{edge}
\def\@photoalign{left}
% Define writer's name % Define writer's name
% Usage: \name{<firstname>}{<lastname>} % Usage: \name{<firstname>}{<lastname>}
@ -394,17 +395,32 @@
% Define a header for CV % Define a header for CV
% Usage: \makecvheader % Usage: \makecvheader
\newcommand*{\makecvheader}[1][C]{% \newcommand*{\makecvheader}[1][C]{%
\newcommand*{\drawphoto}{%
\ifthenelse{\isundefined{\@photo}}{}{%
\newlength{\photodim}
\ifthenelse{\equal{\@photoshape}{circle}}%
{\setlength{\photodim}{1.3cm}}%
{\setlength{\photodim}{1.8cm}}%
\ifthenelse{\equal{\@photoedge}{edge}}%
{\def\@photoborder{darkgray}}%
{\def\@photoborder{none}}%
\begin{tikzpicture}%
\node[\@photoshape, draw=\@photoborder, line width=0.3mm, inner sep=\photodim, fill overzoom image=\@photo] () {};
\end{tikzpicture}
}%
}
\newlength{\headertextwidth} \newlength{\headertextwidth}
\newlength{\headerphotoidwidth} \newlength{\headerphotowidth}
\ifthenelse{\isundefined{\@phid}}{ \ifthenelse{\isundefined{\@photo}}{
\setlength{\headertextwidth}{\textwidth} \setlength{\headertextwidth}{\textwidth}
\setlength{\headerphotoidwidth}{0cm} \setlength{\headerphotowidth}{0cm}
}{% }{%
\setlength{\headertextwidth}{0.8\textwidth} \setlength{\headertextwidth}{0.76\textwidth}
\setlength{\headerphotoidwidth}{0.2\textwidth} \setlength{\headerphotowidth}{0.24\textwidth}
}% }%
\ifthenelse{\isundefined{\@phishape}}{\def\@phishape{circle}}{} \begin{minipage}[c]{\headerphotowidth}%
\ifthenelse{\isundefined{\@phiedge}}{\def\@phiedge{edge}}{} \ifthenelse{\equal{\@photoalign}{left}}{\raggedright\drawphoto}{}
\end{minipage}
\begin{minipage}[c]{\headertextwidth} \begin{minipage}[c]{\headertextwidth}
\ifthenelse{\equal{#1}{L}}{\raggedright}{\ifthenelse{\equal{#1}{R}}{\raggedleft}{\centering}} \ifthenelse{\equal{#1}{L}}{\raggedright}{\ifthenelse{\equal{#1}{R}}{\raggedleft}{\centering}}
\headerfirstnamestyle{\@firstname}\headerlastnamestyle{{}\acvHeaderNameDelim\@lastname}% \headerfirstnamestyle{\@firstname}\headerlastnamestyle{{}\acvHeaderNameDelim\@lastname}%
@ -485,28 +501,9 @@
{}% {}%
{\headerquotestyle{\@quote\\}\vspace{\acvHeaderAfterQuoteSkip}}% {\headerquotestyle{\@quote\\}\vspace{\acvHeaderAfterQuoteSkip}}%
\end{minipage}% \end{minipage}%
\ifthenelse{\isundefined{\@phid}}{}{% \begin{minipage}[c]{\headerphotowidth}%
\newlength{\phiddim}% \ifthenelse{\equal{\@photoalign}{right}}{\raggedleft\drawphoto}{}
\ifthenelse{\equal{\@phishape}{circle}}{\setlength{\phiddim}{1cm}}{\setlength{\phiddim}{1.3cm}} \end{minipage}
\begin{minipage}[c]{\headerphotoidwidth}%
\raggedleft\begin{tikzpicture}%
\ifthenelse{\equal{\@phiedge}{edge}}{%
\foreach \r/\colora in {0.2/{black!10},0.08/{black!30}}{
\ifthenelse{\equal{\@phishape}{circle}}{%
\pgfmathsetlengthmacro{\x}{(\r)*1cm + 1.4142*\phiddim}
\fill[\colora] (0,0) circle (\x);
}{%
\pgfmathsetlengthmacro{\x}{(\r)*1cm + \phiddim}
\fill[\colora] (-\x,-\x) rectangle (\x,\x);
}%
}%
\node[\@phishape,draw=awesome,line width=0.5mm,inner sep=\phiddim,fill overzoom image=\@phid] () {};
}{% No edge
\node[\@phishape,draw=white,line width=0.0mm,inner sep=1.1*\phiddim,fill overzoom image=\@phid] () {};
}
\end{tikzpicture}%
\end{minipage}
}%
} }
% Define a footer for CV % Define a footer for CV

View file

@ -21,7 +21,7 @@
\documentclass[11pt, a4paper]{awesome-cv} \documentclass[11pt, a4paper]{awesome-cv}
% Configure page margins with geometry % Configure page margins with geometry
% \geometry{left=1.4cm, top=.8cm, right=1.4cm, bottom=1.8cm, footskip=.5cm} \geometry{left=1.4cm, top=.8cm, right=1.4cm, bottom=1.8cm, footskip=.5cm}
% Specify the location of the included fonts % Specify the location of the included fonts
\fontdir[fonts/] \fontdir[fonts/]
@ -51,6 +51,8 @@
% PERSONAL INFORMATION % PERSONAL INFORMATION
% Comment any of the lines below if they are not required % Comment any of the lines below if they are not required
%------------------------------------------------------------------------------- %-------------------------------------------------------------------------------
% Available options: circle|rectangle,edge/noedge,left/right
\photo[circle,noedge,left]{./examples/profile}
\name{Claud D.}{Park} \name{Claud D.}{Park}
\position{Software Engineer{\enskip\cdotp\enskip}Security Expert} \position{Software Engineer{\enskip\cdotp\enskip}Security Expert}
\address{246-1002, Gwangmyeongmayrouge Apt. 86, Cheongna lime-ro, Seo-gu, Incheon-si, 404-180, Rep. of KOREA} \address{246-1002, Gwangmyeongmayrouge Apt. 86, Cheongna lime-ro, Seo-gu, Incheon-si, 404-180, Rep. of KOREA}
@ -93,7 +95,8 @@
\begin{document} \begin{document}
% Print the header with above personal informations % Print the header with above personal informations
\makecvheader % Give optional argument to change alignment(C: center, L: left, R: right)
\makecvheader[R]
% Print the footer with 3 arguments(<left>, <center>, <right>) % Print the footer with 3 arguments(<left>, <center>, <right>)
% Leave any of these blank if they are not needed % Leave any of these blank if they are not needed

View file

@ -51,7 +51,8 @@
% PERSONAL INFORMATION % PERSONAL INFORMATION
% Comment any of the lines below if they are not required % Comment any of the lines below if they are not required
%------------------------------------------------------------------------------- %-------------------------------------------------------------------------------
\photoid{./examples/profile.png} % Available options: circle|rectangle,edge/noedge,left/right
% \photo{./examples/profile.png}
\name{Claud D.}{Park} \name{Claud D.}{Park}
\position{Software Engineer{\enskip\cdotp\enskip}Security Expert} \position{Software Engineer{\enskip\cdotp\enskip}Security Expert}
\address{246-1002, Gwangmyeongmayrouge Apt. 86, Cheongna lime-ro, Seo-gu, Incheon-si, 404-180, Rep. of KOREA} \address{246-1002, Gwangmyeongmayrouge Apt. 86, Cheongna lime-ro, Seo-gu, Incheon-si, 404-180, Rep. of KOREA}

View file

@ -51,7 +51,8 @@
% PERSONAL INFORMATION % PERSONAL INFORMATION
% Comment any of the lines below if they are not required % Comment any of the lines below if they are not required
%------------------------------------------------------------------------------- %-------------------------------------------------------------------------------
\photoid{./examples/profile.png} % Available options: circle|rectangle,edge/noedge,left/right
\photo[rectangle,edge,right]{./examples/profile}
\name{Claud D.}{Park} \name{Claud D.}{Park}
\position{Software Engineer{\enskip\cdotp\enskip}Security Expert} \position{Software Engineer{\enskip\cdotp\enskip}Security Expert}
\address{246-1002, Gwangmyeongmayrouge Apt. 86, Cheongna lime-ro, Seo-gu, Incheon-si, 404-180, Rep. of KOREA} \address{246-1002, Gwangmyeongmayrouge Apt. 86, Cheongna lime-ro, Seo-gu, Incheon-si, 404-180, Rep. of KOREA}
@ -75,7 +76,7 @@
% Print the header with above personal informations % Print the header with above personal informations
% Give optional argument to change alignment(C: center, L: left, R: right) % Give optional argument to change alignment(C: center, L: left, R: right)
\makecvheader \makecvheader[L]
% Print the footer with 3 arguments(<left>, <center>, <right>) % Print the footer with 3 arguments(<left>, <center>, <right>)
% Leave any of these blank if they are not needed % Leave any of these blank if they are not needed