Skip to content

New CV Template: Plain CV #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ S3method(vec_ptype_abbr,csl_dates)
S3method(xtfrm,csl_dates)
S3method(xtfrm,list_of_csl_names)
export("%>%")
export(academicl)
export(arrange)
export(awesomecv)
export(bibliography_entries)
Expand All @@ -57,6 +58,7 @@ export(list_of_csl_names)
export(markdowncv)
export(moderncv)
export(mutate)
export(plaincv)
export(rename)
export(select)
export(slice)
Expand Down
21 changes: 21 additions & 0 deletions R/academicl.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#' AcademiCL template
#'
#' AcademiCL is a LaTeX template for a cover letter based on pedrohbraga/AcademicCoverLetter-RMarkdown
#'
#' @param \dots Arguments passed to \code{\link[vitae]{cv_document}}.
#' @inheritParams rmarkdown::pdf_document
#' @param page_total If TRUE, the total number of pages is shown in the footer.
#' @param show_footer If TRUE, a footer showing your name, document name, and page number.
#'
#' @section Preview:
#' `r insert_preview('academicl')`
#'
#' @return An R Markdown output format object.
#'
#' @author Mitchell O'Hara-Wild, theme by Byungjin Park
#' ([@posquit0](https://github.com/posquit0))
#'
#' @export
academicl <- function(..., template = system.file("rmarkdown", "templates", "academicl", "resources", "academicl.tex", package = "vitae")) {
rmarkdown::pdf_document(..., template = template)
}
47 changes: 47 additions & 0 deletions R/plaincv.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#' Plain CV template
#'
#' Plain CV is LaTeX template for a CV or Résumé based on Awesome CV
#'
#' @param \dots Arguments passed to \code{\link[vitae]{cv_document}}.
#' @inheritParams rmarkdown::pdf_document
#' @param page_total If TRUE, the total number of pages is shown in the footer.
#' @param show_footer If TRUE, a footer showing your name, document name, and page number.
#'
#' @section Preview:
#' `r insert_preview('plaincv')`
#'
#' @return An R Markdown output format object.
#'
#' @author Mitchell O'Hara-Wild, theme by Byungjin Park
#' ([@posquit0](https://github.com/posquit0))
#'
#' @export
plaincv <- function(..., page_total = FALSE, show_footer = TRUE) {
template <- system.file("rmarkdown", "templates", "plaincv", "resources", "plain-cv.tex",
package = "vitae")
set_entry_formats(plain_cv_entries)
copy_supporting_files("plaincv")
pandoc_vars <- list()
if (page_total)
pandoc_vars$page_total <- TRUE
if (show_footer)
pandoc_vars$show_footer <- TRUE
cv_document(..., pandoc_vars = pandoc_vars, template = template)
}

plain_cv_entries <- new_entry_formats(brief = function(what, when, with) {
paste(c("\\begin{cvhonors}", glue_alt("\t\\cvhonor{}{<<what>>}{<<with>>}{<<when>>}"),
"\\end{cvhonors}"), collapse = "\n")
}, detailed = function(what, when, with, where, why) {
why <- lapply(why, function(x) {
if (length(x) == 0) {
"{}\\vspace{-4.0mm}"
} else {
paste(c("{\\begin{cvitems}", paste("\\item", x), "\\end{cvitems}}"),
collapse = "\n")
}
})

paste(c("\\begin{cventries}", glue_alt("\t\\cventry{<<what>>}{<<with>>}{<<where>>}{<<when>>}<<why>>"),
"\\end{cventries}"), collapse = "\n")
})
293 changes: 293 additions & 0 deletions inst/rmarkdown/templates/academicl/resources/academicl.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Academic Letter LaTeX and RMarkdown Structure %
% Author: Pedro Henrique Pereira Braga %
% %
% License: %
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/) %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Set the font size (11pt, for now) and paper size (e.g. letterpaper, a4paper)
\documentclass[11pt, letterpaper]{letter}

%----------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------

\usepackage{graphicx} % Required for including pictures
\usepackage{fancyhdr} % Allows the use of fancy headers and footers

\usepackage{microtype} % For typography improvement

\usepackage{url} % Allows the use of hyperlinks
\urlstyle{same} % Allows hyperlink fonts to be the same as the mainfont
\usepackage[hidelinks]{hyperref} % Allows the use of hyperlinks and
% removes the blue boxes around the link

\pagestyle{empty} % Removes headers and footers

\usepackage{setspace} % Allows the use of double spacing in the letter body

\setlength\parindent{1cm} % Paragraph indentation

% Create a new command for the horizontal rule in the document which allows
% thickness specification
\makeatletter
\def\@texttop{} % force the address to start above
\renewcommand*{\opening}[1]{\ifx\@empty\fromaddress
\thispagestyle{firstpage}%
{\raggedleft\@date\par}%
\else % home address
\thispagestyle{empty}%
{\raggedleft\begin{tabular}{l@{}}\ignorespaces
\fromaddress \\*[2\parskip]%
\@date \end{tabular}\par}%
\fi
%\vspace{2\parskip}% <-- Removed
%{\raggedright \toname \\ \toaddress \par}% <-- Removed
%\vspace{2\parskip}% <-- Removed
#1\par\nobreak}
\let\ps@empty\ps@plain
\let\ps@firstpage\ps@plain
\makeatother

%--------------------------------------------------------------------------
% FONTS
%--------------------------------------------------------------------------

\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage[utf8]{inputenc} % Required for inputting international characters

$if(fontfamily)$
\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
$else$
\usepackage{lmodern} % Latin Modern font
$endif$

%----------------------------------------------------------------------------
% DOCUMENT MARGINS
%----------------------------------------------------------------------------

\usepackage{geometry} % Required for adjusting page dimensions

\geometry{
headheight = 0.8in, % Header height
top=1.5in, % Top margin
bottom=1.5cm, % Bottom margin
left=3cm, % Left margin
right=3cm, % Right margin
% showframe, % Uncomment to show how the type block is set on the page
}

%-----------------------------------------------------------------------------
% AUTHOR AND RECIPIENTS NEW COMMANDS AND DETAILS STRUCTURE
%-----------------------------------------------------------------------------

\newcommand{\authordetails}[1]{\renewcommand{\authordetails}{#1}}
\newcommand{\recipientdetails}[1]{\renewcommand{\recipientdetails}{#1}}

%-----------------------------------------------------------------------------
% HEADER STRUCTURE
%-----------------------------------------------------------------------------

\address{
% Include the author's details on the right side of the page under the line
\raggedleft{
\footnotesize{ % Use a smaller font size
\authordetails\\
\hspace{1mm}
}
}
\vspace{-0.05\textheight} % Move the date and letter content up
}

%------------------------------------------------------------------------------
% COMPOSE THE ENTIRE HEADER
%------------------------------------------------------------------------------

\renewcommand{\opening}[1]{
{\fromaddress
\vspace{0.05\textheight}\\ % Print the sender's address here and add some whitespace to allow the printing of the date
\raggedleft{$if(date)$$date$$else$\today$endif$} % Include the date, aligned to the right
\par % par
}
{\raggedright
\toname\\
\toaddress
\par} % Print the recipient's name and adress
\vspace{0.25cm} % White vertical space after recipient's address
\noindent #1 % Following this, insert the opening info
}

%------------------------------------------------------------------------------
% SIGNATURE STRUCTURE
%------------------------------------------------------------------------------
% The signature is a combination of the author's name, title and institution
\signature{$author$$if(from_professional_title)$, $from_professional_title$$endif$$if(from_institution)$\\
$from_institution$$endif$}

% I will later combine the option of inserting a signature within it

\renewcommand{\closing}[1]{
\vspace{2.5mm} % Some whitespace after the letter content and before the signature
\noindent % Stop paragraph indentation
\hspace*{\longindentation} % Move the signature right to the value of \longindentation
\parbox{\indentedwidth}{
\raggedright
#1 % Print the signature text
\vskip 1.65cm % Whitespace between the closing text and author's name for a physical signature
\fromsig % Prints the value of \signature{}, i.e. author name and title
}
}

%-------------------------------------------------------------------------------
% AUTHOR'S INFORMATION
%-------------------------------------------------------------------------------

\authordetails{
$if(from_position)$
$from_position$\\
$endif$
$if(from_department)$
$from_department$\\ % Sender's department/institution
$endif$
$if(from_institution)$
$from_institution$\\
$endif$
$if(from_address)$
$from_address$\\ % Sender's address
$endif$
$if(from_city)$$from_city$$endif$$if(from_state_province)$, $from_state_province$$endif$\\ % Sender's city, state or province,
$if(from_postalcode)$
$from_postalcode$\\ % postal code
$endif$
$if(from_country)$
$from_country$
$endif$
}

%------------------------------------------------------------------------------
% RECIPIENT'S INFORMATION
%------------------------------------------------------------------------------

\recipientdetails{
$to_professional_title$ $to_name$\\
$if(to_department)$
$to_department$\\
$endif$
$if(to_institution)$
$to_institution$\\
$endif$
$if(to_address)$
$to_address$\\
$endif$
$to_city$, $to_state_province$\\
$if(to_postal_code)$
$to_postal_code$\\
$endif$
$if(to_country)$
$to_country$
$endif$
$if(subject)$
\\~\\
Subject: $subject$
$endif$
}

%------------------------------------------------------------------------------
% HEADER CONTENTS
%------------------------------------------------------------------------------

\fancypagestyle{firstpage}{
\fancyhf{}
$if(from_institution_logo)$
\fancyhead[L]{
\includegraphics[height=0.6in, keepaspectratio=true]{$from_institution_logo$}
}
$endif$
\fancyhead[R]{$author$\\
\footnotesize{
$if(from_phone)$
$from_phone$\\ % Sender's phone number
$endif$
$if(from_email)$
$from_email$\\ % Sender's email address
$endif$
$if(from_personal_website)$
$from_personal_website$ % Sender's URL
$endif$
}
}
}

\fancypagestyle{plain}{
\fancyhf{}
$if(from_institution_logo)$
\fancyhead[L]{
\includegraphics[height=0.6in, keepaspectratio=true]{$from_institution_logo$}
}
$endif$
\fancyhead[R]{$author$\\
\footnotesize{
$if(from_phone)$
$from_phone$\\ % Sender's phone number
$endif$
$if(from_email)$
$from_email$\\ % Sender's email address
$endif$
$if(from_personal_website)$
$from_personal_website$ % Sender's URL
$endif$
}
}
}

\fancypagestyle{empty}{
\fancyhf{}
$if(from_institution_logo)$
\fancyhead[L]{
\includegraphics[height=0.6in, keepaspectratio=true]{$from_institution_logo$}
}
$endif$
\fancyhead[R]{$author$\\
\footnotesize{
$if(from_phone)$
$from_phone$\\ % Sender's phone number
$endif$
$if(from_email)$
$from_email$\\ % Sender's email address
$endif$
$if(from_personal_website)$
$from_personal_website$ % Sender's URL
$endif$
}
}
}

%------------------------------------------------------------------------------
\pagestyle{plain}

\begin{document}

%------------------------------------------------------------------------------
% TO ADDRESS
%------------------------------------------------------------------------------

\begin{letter}{\recipientdetails}

%------------------------------------------------------------------------------
% LETTER CONTENT
%------------------------------------------------------------------------------

\opening{$opening_greeting$}
\begin{doublespacing}

$body$

\end{doublespacing}
\closing{$closing_greeting$}

%------------------------------------------------------------------------------

\end{letter}
\end{document}
Loading