Files
foley-cv/embeddedcv.cls

233 lines
9.1 KiB
TeX

%% ---------------------------------------------------------------------------------------------
%% LaTeX ModernCV stripped down version for embedding in proposals
%% ---------------------------------------------------------------------------------------------
%% Initial version by Joe Foley <foley AT RU dot IS>
%% Questions, comments, complaints: latex@LIST.RU.IS
%% Created on 2015-02-27
%% This code is distributed under the Perl Artistic License
%% http://language.per.com/misc/Artistic.html
%% This template is heavily derived from the RUCSMSc.sty developed by Bjorn Thor Jonsson, bjorn@ru.is
%%
%% Reference for class/package writers
%% http://ctan.uib.no/macros/latex/doc/clsguide.pdf
%%
\newcommand{\fileversion@embeddedcv}{Rev 1}
\newcommand{\filedate@embeddedcv}{2016/03/05}% must be YYYY/MM/DD!
\newcommand{\fileauthor@embeddedcv}{Joseph Timothy Foley, foley at R U dot I S}
\ProvidesClass{embeddedcv}[\filedate@embeddedcv by \fileauthor@embeddedcv]
\NeedsTeXFormat{LaTeX2e}
\typeout{Embedded CV Class \fileversion@embeddedcv <\filedate@embeddedcv>, by \fileauthor@embeddedcv}
%% ---------------- Critical packages -----------------------------
% This package allows you to create conditionals on booleans
\RequirePackage{ifthen}
% detect pdflatex vs latex
\RequirePackage{ifpdf}
%% XeTeX can allow for nicer fonts, but we really don't need it
%% Because we use standard fonts to be consistent
%% Doing the XeTeX tests causes AUCTex to keep asking if you want XeTeX, which is annoying
%\RequirePackage{ifxetex}
%% Morewrites packages allows more programs to generate external files
%% because there is an internal limit
%% Needed if you get a "No room for a new \write" error
%% Unfortunately, it appears to be incompatible with DropBox. Bug filed with developed 2016-2-17 --foley
%\RequirePackage{morewrites}
%% Command to remove things if we are draft mode
\RequirePackage{ifdraft}
% ignore warnings and errors temporarily
%\RequirePackage{silence}
%% LaTeX3
%% Some of this may already be included as a dependancy from another package
% Better handling of arguments, particularly for defaults
\RequirePackage{xargs}
% Specialized commands for constructing macros
\RequirePackage{xparse}
%% ---------------- Execution of Options -----------------------------
\ProcessOptions\relax% this stops searching for a * in
% \ProcessOtions*
%% Alternative way to subclass. Disable the other option processing
%% if you enable it. This will dump all options onto the parent class
%\ProcessOptions\LoadClassWithOptions{article}
%% Read page 20 of http://latex-project.org/guides/clsguide.pdf
%% carefully before modifying any of the execution and previous section.
%% ---------------- Package Loading -----------------------------
\LoadClass{article} % our parent class.
%% ---------------- XeTeX setup -----------------------------
%% Embedding is often needed in MS Word documents, so we need XeTeX
%\ifxetex%
\RequirePackage{fontspec} % font selecting commands
\RequirePackage{xunicode} % unicode character macros
\RequirePackage{xltxtra} % a few fixes and extras
%\else % pdftex or latex
% \RequirePackage[T1]{fontenc}
% \RequirePackage[utf8]{inputenc} % allows UTF encoding, needed for Icelandic characters
%\fi
%% ---------------- Internationalization -----------------------------
%\RequirePackage[autostyle,strict]{csquotes}
%% http://mirrors.concertpass.com/tex-archive/macros/latex/contrib/csquotes/csquotes.pdf
%% You invoke with \enquote{} and \blockquote{}
%% csquotes must be loaded before babel for AUCTeX
%% autostyle: update style as language changes in document
%% strict: any warnings become errors
%\DeclareQuoteAlias{german}{icelandic}
%% Unfortunately, csquotes does not understand Icelandic quotation marks
%% so we must create an alias. German is close enough.
%\@nameuse{RequirePackage}[english,german,icelandic]{babel}
%% Babel allows various automatic text to be in selected languages
%% But to use the options, you have to always load it, even for english
%% The languages must be specified in order.
%% We load german because it seems to be needed for the special Icelandic quotation marks.
%% Smart quotation marks
%% The \@nameuse magic is to prevent AUCTeX from using the semi-broken icelandic mode.
%% If you don't have a keyboard to type the Icelandic characters, there are macros:
%% "` or \glqq (startquote)
%% "' or \grqq (endquote)
%% \TH Þ
%% \th þ
%% \DH Ð
%% \dh ð
%%
% set language based upon the class setting
% \newcommand{\resetlanguage}{%
% \ifthenelse{\boolean{icelandic}}%
% {\selectlanguage{icelandic}}%
% {\selectlanguage{english}}}%
% \resetlanguage{}
\RequirePackage{iflang}
%% iflang allows us to put multiple translations together
%% e.g. \IfLanguageName{icelandic}{Já}{Yes}
\RequirePackage{etoolbox}
\RequirePackage{ifthen}
\RequirePackage{xcolor}
\RequirePackage{url}
\RequirePackage{graphicx}
\RequirePackage{fancyhdr}
%\RequirePackage{tweaklist}
% Definition of "description" causes conflicts, weird.
\RequirePackage{calc}
%% XeLaTeX needed!!
%\setmainfont[Mapping=tex-text]{Arial}
\setmainfont[Mapping=tex-text]{Times New Roman}
\usepackage[margin=10mm]{geometry}
\definecolor{myblue}{rgb}{0,0,0.5}
\newcommand{\bluerule}{\textcolor{myblue}{\hrule}\vspace{\baselineskip}}
\newcommand*{\listitemsymbol}{{\fontencoding{U}\fontfamily{ding}\selectfont\tiny\symbol{'102}}}
\newcommand*{\hintfont}{\small\sffamily}
% length used by the moderncv layout
% quote length
\newlength{\quotewidth}
% section lengths
\newlength{\hintscolumnwidth}
\newlength{\separatorcolumnwidth}
\setlength{\separatorcolumnwidth}{0.025\textwidth}
\newlength{\maincolumnwidth}
% doubleitem lengths
\newlength{\doubleitemmaincolumnwidth}
% listitem lengths
\newlength{\listitemsymbolwidth}
\settowidth{\listitemsymbolwidth}{\listitemsymbol{}~}
\newlength{\listitemmaincolumnwidth}
% listdoubleitem lengths
\newlength{\listdoubleitemmaincolumnwidth}
% recompute all the lengths that depends on the text width
\newcommand*{\recomputethemelengths}{}
\newcommand*{\recomputelengths}{%
\setlength{\quotewidth}{0.65\textwidth}%
% main lenghts
\setlength{\maincolumnwidth}{\textwidth}%
\addtolength{\maincolumnwidth}{-\separatorcolumnwidth}%
\addtolength{\maincolumnwidth}{-\hintscolumnwidth}%
% listitem lengths
\setlength{\listitemmaincolumnwidth}{\maincolumnwidth}%
\addtolength{\listitemmaincolumnwidth}{-\listitemsymbolwidth}%
% doubleitem lengths
\setlength{\doubleitemmaincolumnwidth}{\maincolumnwidth}%
\addtolength{\doubleitemmaincolumnwidth}{-\hintscolumnwidth}%
\addtolength{\doubleitemmaincolumnwidth}{-\separatorcolumnwidth}%
\setlength{\doubleitemmaincolumnwidth}{0.5\doubleitemmaincolumnwidth}%
% listdoubleitem lengths
\setlength{\listdoubleitemmaincolumnwidth}{\maincolumnwidth}%
\addtolength{\listdoubleitemmaincolumnwidth}{-\listitemsymbolwidth}%
\setlength{\listdoubleitemmaincolumnwidth}{0.475\listdoubleitemmaincolumnwidth}%
% fancyhdr lengths
\renewcommand{\headwidth}{\textwidth}%
\recomputethemelengths}
\setlength{\hintscolumnwidth}{0.15\textwidth}
\recomputelengths
% usage: \cvline{margintext}{linetext}
\newcommand*{\cvline}[3][.25em]{%
\begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
\raggedleft\hintfont{#2} &{#3}%
\end{tabular}\\[#1]}
% usage: \cvdoubleitem{subtitle}{text}{subtitle}{text}
\newcommand*{\cvdoubleitem}[4]{%
\cvline{#1}{\begin{minipage}[t]{\doubleitemmaincolumnwidth}#2\end{minipage}%
\hfill%
\begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintfont{#3}\end{minipage}\hspace*{\separatorcolumnwidth}\begin{minipage}[t]{\doubleitemmaincolumnwidth}#4\end{minipage}}}
% usage: \cventry{years}{degree/job title}{institution/employer}{localization}{optionnal: grade/...}{optional: comment/job description}
\newcommand*{\cventry}[6]{%
\cvline{#1}{%
{\bfseries#2}%
\ifthenelse{\equal{#3}{}}{}{, {\slshape#3}}%
\ifthenelse{\equal{#4}{}}{}{, #4}%
\ifthenelse{\equal{#5}{}}{}{, #5}%
.%
\ifx&#6&%
\else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi%
}}%
\newcommand*{\cvitem}[2]{\cvline{#1}{#2}}
% usage (inside 'language' cvsection environment): \cvlanguage{name}{level}{comment}
\newcommand*{\cvlanguage}[3]{%
\cvline{#1}{\begin{minipage}[t]{.225\maincolumnwidth}\textbf{#2}\end{minipage}\hfill\begin{minipage}[t]{0.725\maincolumnwidth}\raggedleft\footnotesize\itshape #3\end{minipage}}}
% usage: \cvlistdoubleitem[symbol]{point1}{point2}
\newcommand*{\cvlistdoubleitem}[3][\listitemsymbol{}]{%
\cvline[0pt]{}{#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}%
\hfill%
\ifthenelse{\equal{#3}{}}%
{}%
{#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#3\end{minipage}}}}
% usage (inside 'computer skills' cvsection environment): \cvcomputer{category}{programs}{category}{programs}
\newcommand*{\cvcomputer}[4]{%
\cvdoubleitem{#1}{\small#2}{#3}{\small#4}}
%% Some commands so that we can use the same .tex file as a full CV
%% Disabled because they are before \begin{document}
\newcommand{\firstname}[1]{}
\newcommand{\familyname}[1]{}
\newcommand{\address}[2]{}
\newcommand{\phone}[1]{}
\newcommand{\email}[1]{}