Skip to content

Latest commit

 

History

History
802 lines (716 loc) · 20.1 KB

README.org

File metadata and controls

802 lines (716 loc) · 20.1 KB

Curiculum Vitæ

Introduction

A repository for my vitæ. It uses org-mode, a custom style sheet and a LaTeX file style. The resume is done within resume.org file. All styles are embedded within this file and a Makefile is provided to produce the html and pdf files.

Project publish function

This section is used to publish the documentation to html and pdf in the pub/ directory.

This code defines the publish-html-cv and publish-pdf-cv which are used to publish the CV into html and pdf, respectively.

HTML export

Requirements

(require 'ox-html)

Building html postamble

if [ -d .git ]; then
    LC_MESSAGES=en git --no-pager log -1 HEAD --date=short --pretty=format:'<i class=\"fab fa-github-alt\"></i> commit <a href=https://github.com/xgarrido/org-resume/commit/%H>%h</a> - %ad'
fi

Building html preamble

preamble+='<div id=\"address\">'
preamble+='<span class=\"name\">Xavier Garrido</span><br>'
preamble+='<a href=\"http://www.ijclab.in2p3.fr\">IJCLab</a><br>'
preamble+='Paris-Saclay University, Orsay<br>'
preamble+='</div>'
preamble+='<div id=\"contact\">'
preamble+='<span class=\"name\">&nbsp;</span><br>'
preamble+='(33) 1 64 46 84 28<br>'
preamble+='<a href=\"http://xgarrido.github.io\">xgarrido.github.io</a><br>'
preamble+='<a href=\"mailto:[email protected]\">[email protected]</a>'
preamble+='</div>'
echo -ne $preamble

Project definition

(setq this-directory (file-name-directory (or load-file-name buffer-file-name)))
(setq pub-directory (concat this-directory "pub/"))
(unless (boundp 'org-publish-project-alist)
  (setq org-publish-project-alist nil))

(setq org-publish-timestamp-directory "/tmp/org-timestamps/")

(setq org-html-style-default "")
(setq org-html-htmlize-output-type 'css)

(add-to-list
 'org-publish-project-alist
 `("publish-html-cv"
   :base-directory ,this-directory
   :base-extension "org"
   :publishing-directory ,(expand-file-name "html" pub-directory)
   :publishing-function org-html-publish-to-html
   :exclude ".*publish.*.org\\|README.org"
   :time-stamp-file nil
   :section-numbers nil
   :with-toc nil
   :html-head "<link rel=\"stylesheet\" href=\"stylesheets/styles.css\">
               <link rel=\"stylesheet\" href=\"stylesheets/org-pygments.css\">"
   :html-preamble  "<<html-preamble()>>"
   :html-postamble "<<html-postamble()>>"
   :html-head-include-scripts nil))

CSS stylesheets

Main stylesheets

Google fonts
@import url(//fonts.googleapis.com/css?family=Open+Sans);
@import url(//fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700);
@import url(//fonts.googleapis.com/css?family=Inconsolata);
Main css definitions
Body
body {
    width:800px;
    margin:50px auto;
    /*font:14px/1.5 Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;*/
    font-family: "Open Sans", sans-serif;
    font-size: 12px;
    color:#777777;
    font-weight:300;
}
Headline
h1, h2, h3, h4, h5, h6 {
    color:#777777;
    margin:0 0 20px;
}

h1, h2, h3 {
    line-height:1.1;
}

h1 {
    display: none;
}

h3, h4, h5, h6 {
    font-style: italic;
}
Link
a {
    color: #3399cc; /*#67ad00;*/
    font-weight:400;
    text-decoration:none;
}

a:hover {
    color:#006699; /*#7fd600;*/
}

a small {
    font-size:11px;
    color:#777777;
    margin-top:-0.6em;
    display:block;
}

a:hover small {
    color:#777777;
}
Code, table, image
p, ul, ol, table, pre, dl {
    margin:0 0 20px;
}

blockquote {
    border-left:1px solid #e5e5e5;
    width:600px;
    padding:0 0 0 20px;
    font-style:italic;
}

code, pre {
    font-family:Inconsolata, Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal;
    color:#777;
    font-size:12px;
}

pre {
    padding:8px 15px;
    background: #f8f8f8;
    border-radius:5px;
    border:1px solid #e5e5e5;
    overflow-x: auto;
}

table {
    width:80%;
    border-collapse:collapse;
    margin-left:auto;
    margin-right:auto;
}

th, td {
    text-align:left;
    padding:5px 10px;
    border-bottom:1px solid #e5e5e5;
}

dt {
    color:#444;
    font-weight:700;
}

th {
    color:#444;
}

img {
    max-width:100%;
}
Misc. (bold, hr style)
#content {
    width:700px;
    float:right;
    padding-bottom:50px;
/* border:1px solid #e5e5e5; */
/* border-width:1px 0; */
/* padding:20px 0; */
/* margin:0 0 20px; */
}

strong {
    color:#222;
    font-weight:700;
}
small {
    font-size:11px;
}

hr {
    border:0;
    background:#e5e5e5;
    height:1px;
    margin:0 0 20px;
}

.footpara {
    display: inline;
}
Scrollbars
.scrollbar-container {
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    margin: 20px;

    border: 4px solid rgba(0, 0, 0, 0.2);
    overflow: auto;
    background-color: whiteSmoke;
}
.scrollbar-container .inner {
    height: 2011px;
    width: 1985px;
    padding: 1em;
    background-color: white;
    font-family: sans-serif;
}
::-webkit-scrollbar {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border: solid whiteSmoke 4px;
    border-radius:15px;
}
::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}
Preamble, postamble
#preamble:before, #preamble:after {
    display: table;
    content: "";
}

#preamble:after {
    clear: both;
}

#postamble {
    margin-top: 10px;
    text-align: center;
    font-size: 11px;
    clear: both;
}

#address {
    float: left;
}

#contact {
    float: right;
    text-align: right;
}

.name {
    font-size: 20px;
    line-height: 22px;
    font-weight: 600;
}
Adapting media source
@media print, screen and (max-width: 960px) {

    body {
        width:auto;
        margin:0;
    }

    header, content, footer {
        float:none;
        position:static;
        width:auto;
    }

    header {
        padding-right:320px;
    }

    header a small {
        display:inline;
    }

    header ul {
        position:absolute;
        right:50px;
        top:52px;
    }
}

@media print, screen and (max-width: 720px) {
    body {
        word-wrap:break-word;
    }

    header {
        padding:0;
    }

    header ul, header p.view {
        position:static;
    }

    pre, code {
        word-wrap:normal;
    }
}

@media print, screen and (max-width: 480px) {
    body {
        padding:15px;
    }

    header ul {
        display:none;
    }
}

@media print {
    body {
        padding:0.4in;
        font-size:12pt;
        color:#444;
    }
}

Org source code styles

.org-string,
.org-type {
    color: #DEB542;
}

.org-builtin,
.org-variable-name,
.org-constant,
.org-function-name {
    color: #69B7F0;
}

.org-comment,
.org-comment-delimiter,
.org-doc {
    color: #93a1a1;
}

.org-keyword {
    color: #D33682;
}

pre {
    color: #777777;
}

PDF export

LaTeX style

A homemade style for producing nice looking vitæ with org-mode. The main trick is to use titlesec LaTeX package to tweak the title/section/subsection… look and thus, use all the hierarchical view of org-mode. Then the style itself is a mix of Kieran Healy’s CV with an old one I had.

org preamble

This section defines org preamble and settings for documents exported from .org to .tex files. The basic use is to add \usepackage{org-preamble} in your LaTeX document.

Basics
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{org-preamble}[2013/03/03 v0.01 Bundling of Preamble items for Org to LaTeX export]
Style options

Options can be passed to org-preamble style file within \usepackage[options] call. For the time being, I have only copied/pasted how to declare such options but do not use it.

\RequirePackage{ifthen}
\newboolean{@fr} %
\setboolean{@fr}{false} %
\DeclareOption{fr}{
  \setboolean{@fr}{true}
}
\ProcessOptions
Packages requirements
AMS packages
\RequirePackage{amsmath,amssymb}
Listings package

minted is a package that facilitates expressive syntax highlighting in LaTeX using the powerful Pygments library. The package also provides options to customize the highlighted source code output using fancyvrb.

\RequirePackage[cache]{minted}
Unicode typesettings aka XeTeX
\RequirePackage{ifxetex}
\ifxetex
\RequirePackage{fontspec}
\RequirePackage{xunicode}
%%\else
\fi
hyperref package
\RequirePackage{hyperref}
pifont package
\RequirePackage{pifont}
comment package
\RequirePackage{comment}
tikz package
\RequirePackage{tikz}
\usetikzlibrary{positioning,arrows,decorations,backgrounds,patterns,matrix,shapes,fit,calc,shadows,plotmarks,spy,trees}

We use the external library from tikz to cache i.e. produce a pdf file of each tikzpicture. tikz/external looks if the pdf exist and if not, export it.

%%\tikzset{
%%  external/system call={%
%%    xelatex -shell-escape
%%    -halt-on-error -interaction=batchmode
%%    -jobname "\image" "\texsource"}}
%%\tikzexternalize[prefix=latex.d/]
\input "|mkdir -p latex.d"
\input "|mkdir -p /tmp/latex.d"
xspace package
\RequirePackage{xspace}
underline package
\RequirePackage[normalem]{ulem}
relsize
\RequirePackage{relsize}
Font Awesome
\newfontfamily{\FA}{FontAwesome}
\newcommand*{\faicon}[1]{{\FA\csname faicon@#1\endcsname}}
\expandafter\def\csname faicon@github-alt\endcsname{\symbol{"F113}}\def\faGithubAlt{{\FA\csname faicon@github-alt\endcsname}\xspace}
\expandafter\def\csname faicon@external-link\endcsname{\symbol{"F08E}}\def\faExternalLink{{\FA\csname faicon@external-link\endcsname}\xspace}
Email handling
\let\@email\@empty
\@ifundefined{email}{%
  \newcommand\email[1]{\gdef\@email{#1}}}{}
New commands
Clearing odd pages
\RequirePackage{changepage}
\newcommand\clearemptydoublepage{%
  \checkoddpage
  \ifthenelse{\boolean{oddpage}}%
             {\null\clearpage\thispagestyle{empty} \null \clearpage}%
             {\null\clearpage}%
}
%%\newcommand{\clearemptydoublepage}{\newpage{\cleardoubleemptypage\thispagestyle{empty}}

CV style

Basics
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cv_style}[2013/11/06 v0.01 Bundling CV LaTeX style]
Package options
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
  family=cv,
  prefix=cv@
}
\DeclareBoolOption[false]{oldstyle}
\ProcessKeyvalOptions*
Default parameter values

These values can be overloaded within the org file using #+LATEX_HEADER command.

\def\myemail{[email protected]}
\def\myweb{xavier.github.io}
\def\myphone{+33 (0)1 64 46 84 28}
\def\myfax{+33 (0)1 69 07 94 04}
Colors
\definecolor{red}{RGB}{221,42,43}
\definecolor{green}{RGB}{105,182,40}
\definecolor{blue}{RGB}{0,51,153}
\definecolor{gray}{RGB}{25,25,25}
%\definecolor{red}{HTML}{D43F3F}
%\definecolor{blue}{HTML}{00ACE9}
%\definecolor{green}{HTML}{6A9A1F}
\colorlet{theMainColor}{blue}
\colorlet{theRefColor}{blue!90}
\newcommand{\globalcolor}[1]{%
  \color{#1}\global\let\default@color\current@color
}
Packages
\RequirePackage{titlesec}
\RequirePackage{enumitem}
\RequirePackage{a4wide}
\hypersetup{
  xetex,
  colorlinks=true,
  urlcolor=theRefColor,
  filecolor=theRefColor,
  linkcolor=theRefColor,
  plainpages=false,
  pdfpagelabels,
  bookmarksnumbered,
  pagebackref
}
\setlength{\parindent}{0cm}
Fonts

Choose fonts for use with xelatex. Minion and Myriad are widely available, from Adobe. Inconsolata is used as monospace font.

\setromanfont[Mapping={tex-text},Numbers={OldStyle}]{Minion Pro}
\setsansfont[Mapping=tex-text,Colour=theMainColor]{Myriad Pro}
\setmonofont[Mapping=tex-text,Scale=0.9]{Inconsolata}
Document title
\RequirePackage{ifthen}
\newboolean{@fr} %
\setboolean{@fr}{false} %
\DeclareOption{fr}{
  \setboolean{@fr}{true}
}
\ProcessOptions
\newcommand{\mytitle}{}
\ifthenelse{\boolean{@fr}}{
\renewcommand{\mytitle}{\normalsize\@author\\\footnotesize \href{http://www.lal.in2p3.fr}{Laboratoire de l'Accélérateur Linéaire}
      \\ Bâtiment 200, \\ Université Paris-Sud, \\ \vspace{-0.05in} 91898 Orsay Cedex}
}{
\renewcommand{\mytitle}{\normalsize\@author\\\footnotesize \href{http://www.lal.in2p3.fr}{Laboratoire de l'Accélérateur Linéaire}
      \\ Building 200, \\ Paris-South University, \\ \vspace{-0.05in} 91898 Orsay Cedex}
}
\renewcommand*{\maketitle}{%
  \globalcolor{gray}
  \begin{minipage}[t]{2.95in}
    \flushleft {\mytitle}
  \end{minipage}
  \hfill
  \hfill
  \begin{minipage}[t]{1.7in}
    \ifthenelse{\boolean{@fr}}{
      \flushright \footnotesize Téléphone:~\myphone \\
    }{
      \flushright \footnotesize Phone:~\myphone \\
    }
    Fax:~\myfax  \\
    {\scriptsize  \texttt{\href{mailto:\myemail}{\myemail}}} \\
    {\scriptsize  \texttt{\href{\myweb}{\myweb}}}
  \end{minipage}
  \vspace{10pt}
}
Tweaking sections & lists

titlesec format respects the following writing convention:

\titleformat{<command>}{<shape>}{<format>}{<label>}{<sep>}{<before-code>}{<after-code>}
section
\ifthenelse{\boolean{cv@oldstyle}}{
  \titleformat{\section}[block] %command
              {\usekomafont{sectioning}\usekomafont{section}%
                \tikz[overlay] \shade[left color=white,right color=blue] (0,-0.7ex) rectangle (\textwidth,-0.8ex);}%} %format
              {\thesection} %label
              {1em} %sep
              {} %before
              [] %after
              \titlespacing{\section}{0pt}{10pt}{5pt}}{
  \titleformat{\section} %command
              [leftmargin] %shape
              {\footnotesize\bfseries\sffamily\raggedleft} %format
              {} %label
              {0pt} %sep
              {\lowercase} %before
              [] %after
              \titlespacing{\section}{90pt}{10pt}{15pt}}
subsection
\titleformat{\subsection} %command
            {\bfseries\itshape} %format
            {} %label
            {0pt} %sep
            {} %before
            [] %after
\ifthenelse{\boolean{cv@oldstyle}}{}{
  \titlespacing{\subsection}{-5pt}{15pt}{5pt}}
itemize
\ifthenelse{\boolean{cv@oldstyle}}{}{
  \renewenvironment{itemize}{
    \begin{list}{\textbullet}{%
        \setlength{\itemsep}{0.05in}
        \setlength{\parsep}{0in}
        \setlength{\parskip}{0in}
        \setlength{\topsep}{0in}
        \setlength{\partopsep}{0in}
        \setlength{\leftmargin}{0.1in}}
      \vspace{-5mm}}{\end{list}}
  %%  \renewenvironment{enumerate}{
  %%    \begin{list}{}{%
  %%        \setlength{\itemsep}{0.05in}
  %%        \setlength{\parsep}{0in}
  %%        \setlength{\parskip}{0in}
  %%        \setlength{\topsep}{0in}
  %%        \setlength{\partopsep}{0in}
  %%        \setlength{\leftmargin}{0.1in}}}{\end{list}}
}
VC status
if [ -d .git ]; then
    log=$(LC_MESSAGES=en git --no-pager log -1 HEAD --date=short --pretty=format:"commit \href{https://github.com/xgarrido/org-resume/commit/%H}{\color{gray!50}\texttt{%h}} -- %ad")
    echo "\renewcommand*{\PrelimText}{\textnormal{\small\color{gray!50}${log}}}"
fi
\RequirePackage{ifthen}
\newboolean{@novc} %
\setboolean{@novc}{false} %
\DeclareOption{novc}{
  \setboolean{@novc}{true}
}
\ProcessOptions
\ifthenelse{\boolean{@novc}}{}{
  \RequirePackage{prelim2e}
  <<vc-status()>>
}

org to LaTeX stuff

Use smart quote when exporting

(setq org-export-with-smart-quotes t)

Keep LaTeX logfiles

(setq org-latex-remove-logfiles nil)

Default list of LaTeX packages

Only include one default package and remove all the crapppy stuff included by orglatex translation.

(add-to-list 'org-latex-packages-alist '("" "org-preamble"))

org LaTeX class

(unless (boundp 'org-latex-classes)
  (setq org-latex-classes nil))

(add-to-list 'org-latex-classes
             '("cv"
               "\\documentclass[10pt]{scrartcl}
                [PACKAGES]
                \\usepackage[]{cv-style}
                [NO-DEFAULT-PACKAGES]"
               ("\\section{%s}" . "\\section*{%s}")
               ("\\subsection{%s}" . "\\subsection*{%s}")
               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
               ("\\paragraph{%s}" . "\\paragraph*{%s}")
               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

Set LaTeX command

(setq org-latex-pdf-process '("latexmk -xelatex -shell-escape -quiet %f"))

Markup filter

Remove the quote block

(defun latex::cv-quote-filter (contents backend info)
  (when (eq backend 'latex)
    (replace-regexp-in-string "." "" contents)))
(add-to-list 'org-export-filter-quote-block-functions
             'latex::cv-quote-filter)

Project definition

(add-to-list
 'org-publish-project-alist
 `("publish-pdf-cv"
   :base-directory ,this-directory
   :base-extension "org"
   :publishing-directory ,(expand-file-name "pdf" pub-directory)
   :publishing-function org-latex-publish-to-pdf
   :exclude ".*publish.*.org\\|README.org"
   :section-numbers 2
   :with-toc        t
   :latex-class "cv"
   :latex-header-extra ""
   ))

Exporter functions

(defun org-publish-html ()
  (progn
    (org-publish-project "publish-html-cv" 'force)
    (rename-file (expand-file-name "resume.html" (expand-file-name "html" pub-directory))
                 (expand-file-name "index.html" (expand-file-name "html" pub-directory)) t)
    ))
(defun org-publish-pdf ()
  (progn
    (org-publish-project "publish-pdf-cv" 'force)
    (shell-command "mv ./latex.d pub/pdf/.; mv -f resume* *.sty ./pub/pdf/latex.d/.; mv ./pub/pdf/latex.d/resume*.org .")
    ))