https://github.com/xgarrido/org-resume
Vitae using org-mode
https://github.com/xgarrido/org-resume
cv emacs orgmode
Last synced: 11 months ago
JSON representation
Vitae using org-mode
- Host: GitHub
- URL: https://github.com/xgarrido/org-resume
- Owner: xgarrido
- Created: 2013-11-06T10:36:48.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2025-03-19T10:31:26.000Z (about 1 year ago)
- Last Synced: 2025-03-19T11:31:14.534Z (about 1 year ago)
- Topics: cv, emacs, orgmode
- Language: Makefile
- Homepage: https://xgarrido.github.io/org-resume
- Size: 137 KB
- Stars: 38
- Watchers: 4
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+TITLE: Curiculum Vitæ
#+AUTHOR: Xavier Garrido
* Introduction
A repository for my vitæ. It uses [[http://orgmode.org][org-mode]], a custom style sheet and a LaTeX
file style. The resume is done within [[file:resume.org][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
#+BEGIN_SRC emacs-lisp
(require 'ox-html)
#+END_SRC
*** Building html postamble
#+NAME: html-postamble
#+BEGIN_SRC shell :tangle no :results output
if [ -d .git ]; then
LC_MESSAGES=en git --no-pager log -1 HEAD --date=short --pretty=format:' commit %h - %ad'
fi
#+END_SRC
*** Building html preamble
#+NAME: html-preamble
#+BEGIN_SRC shell :tangle no :results output
preamble+='
'
preamble+='Xavier Garrido
'
preamble+='IJCLab
'
preamble+='Paris-Saclay University, Orsay
'
preamble+=''
preamble+=''
preamble+='
'
preamble+='(33) 1 64 46 84 28
'
preamble+='xgarrido.github.io
'
preamble+='xavier.garrido@ijclab.in2p3.fr'
preamble+=''
echo -ne $preamble
#+END_SRC
*** Project definition
#+BEGIN_SRC emacs-lisp :noweb yes
(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 "
"
:html-preamble "<>"
:html-postamble "<>"
:html-head-include-scripts nil))
#+END_SRC
*** CSS stylesheets
**** Main stylesheets
:PROPERTIES:
:HEADER-ARGS: :tangle pub/html/stylesheets/styles.css :mkdirp yes
:END:
***** Google fonts
#+BEGIN_SRC css
@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);
#+END_SRC
***** Main =css= definitions
****** Body
#+BEGIN_SRC css
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;
}
#+END_SRC
****** Headline
#+BEGIN_SRC css
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;
}
#+END_SRC
****** Link
#+BEGIN_SRC css
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;
}
#+END_SRC
****** Code, table, image
#+BEGIN_SRC css
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%;
}
#+END_SRC
****** Misc. (bold, =hr= style)
#+BEGIN_SRC css
#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;
}
#+END_SRC
****** Scrollbars
#+BEGIN_SRC css
.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);
}
#+END_SRC
****** Preamble, postamble
#+BEGIN_SRC css
#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;
}
#+END_SRC
****** Adapting media source
#+BEGIN_SRC css
@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;
}
}
#+END_SRC
**** Org source code styles
:PROPERTIES:
:HEADER-ARGS: :tangle pub/html/stylesheets/org-pygments.css :mkdirp yes
:END:
#+BEGIN_SRC css
.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;
}
#+END_SRC
** PDF export
*** LaTeX style
A homemade style for producing nice looking vitæ with =org-mode=. The main trick
is to use [[http://mirrors.linsrv.net/tex-archive/macros/latex/contrib/titlesec/][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 [[http://kjhealy.github.io/kjh-vita/][Kieran Healy's CV]] with an old one I had.
**** =org= preamble
:PROPERTIES:
:HEADER-ARGS: :tangle org-preamble.sty
:END:
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
#+BEGIN_SRC latex
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{org-preamble}[2013/03/03 v0.01 Bundling of Preamble items for Org to LaTeX export]
#+END_SRC
***** 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.
#+BEGIN_SRC latex :tangle no
\RequirePackage{ifthen}
\newboolean{@fr} %
\setboolean{@fr}{false} %
\DeclareOption{fr}{
\setboolean{@fr}{true}
}
\ProcessOptions
#+END_SRC
***** Packages requirements
****** AMS packages
#+BEGIN_SRC latex
\RequirePackage{amsmath,amssymb}
#+END_SRC
****** Listings package
[[https://code.google.com/p/minted/][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=.
#+BEGIN_SRC latex
\RequirePackage[cache]{minted}
#+END_SRC
****** Unicode typesettings aka XeTeX
#+BEGIN_SRC latex
\RequirePackage{ifxetex}
\ifxetex
\RequirePackage{fontspec}
\RequirePackage{xunicode}
%%\else
\fi
#+END_SRC
****** hyperref package
#+BEGIN_SRC latex
\RequirePackage{hyperref}
#+END_SRC
****** [[http://www.ctan.org/pkg/pifont][pifont]] package
#+BEGIN_SRC latex
\RequirePackage{pifont}
#+END_SRC
****** comment package
#+BEGIN_SRC latex
\RequirePackage{comment}
#+END_SRC
****** [[http://www.texample.net/tikz/][tikz]] package
#+BEGIN_SRC latex
\RequirePackage{tikz}
\usetikzlibrary{positioning,arrows,decorations,backgrounds,patterns,matrix,shapes,fit,calc,shadows,plotmarks,spy,trees}
#+END_SRC
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.
#+BEGIN_SRC latex
%%\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"
#+END_SRC
****** xspace package
#+BEGIN_SRC latex
\RequirePackage{xspace}
#+END_SRC
****** underline package
#+BEGIN_SRC latex
\RequirePackage[normalem]{ulem}
#+END_SRC
****** =relsize=
#+BEGIN_SRC latex
\RequirePackage{relsize}
#+END_SRC
****** Font Awesome
#+BEGIN_SRC latex
\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}
#+END_SRC
***** Email handling
#+BEGIN_SRC latex
\let\@email\@empty
\@ifundefined{email}{%
\newcommand\email[1]{\gdef\@email{#1}}}{}
#+END_SRC
***** New commands
****** Clearing odd pages
#+BEGIN_SRC latex
\RequirePackage{changepage}
\newcommand\clearemptydoublepage{%
\checkoddpage
\ifthenelse{\boolean{oddpage}}%
{\null\clearpage\thispagestyle{empty} \null \clearpage}%
{\null\clearpage}%
}
%%\newcommand{\clearemptydoublepage}{\newpage{\cleardoubleemptypage\thispagestyle{empty}}
#+END_SRC
**** CV style
:PROPERTIES:
:HEADER-ARGS: :tangle cv-style.sty
:END:
***** Basics
#+BEGIN_SRC latex
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cv_style}[2013/11/06 v0.01 Bundling CV LaTeX style]
#+END_SRC
***** Package options
#+BEGIN_SRC latex
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
family=cv,
prefix=cv@
}
\DeclareBoolOption[false]{oldstyle}
\ProcessKeyvalOptions*
#+END_SRC
***** Default parameter values
These values can be overloaded within the org file using =#+LATEX_HEADER=
command.
#+BEGIN_SRC latex
\def\myemail{xavier.garrido@lal.in2p3.fr}
\def\myweb{xavier.github.io}
\def\myphone{+33 (0)1 64 46 84 28}
\def\myfax{+33 (0)1 69 07 94 04}
#+END_SRC
***** Colors
#+BEGIN_SRC latex
\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
}
#+END_SRC
***** Packages
#+BEGIN_SRC latex
\RequirePackage{titlesec}
\RequirePackage{enumitem}
\RequirePackage{a4wide}
\hypersetup{
xetex,
colorlinks=true,
urlcolor=theRefColor,
filecolor=theRefColor,
linkcolor=theRefColor,
plainpages=false,
pdfpagelabels,
bookmarksnumbered,
pagebackref
}
\setlength{\parindent}{0cm}
#+END_SRC
***** Fonts
Choose fonts for use with xelatex. Minion and Myriad are widely available, from
Adobe. Inconsolata is used as monospace font.
#+BEGIN_SRC latex
\setromanfont[Mapping={tex-text},Numbers={OldStyle}]{Minion Pro}
\setsansfont[Mapping=tex-text,Colour=theMainColor]{Myriad Pro}
\setmonofont[Mapping=tex-text,Scale=0.9]{Inconsolata}
#+END_SRC
***** Document title
#+BEGIN_SRC latex
\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}
}
#+END_SRC
***** Tweaking sections & lists
=titlesec= format respects the following writing convention:
#+BEGIN_SRC latex :tangle no
\titleformat{}{}{}{}{}{}{}
#+END_SRC
****** =section=
#+BEGIN_SRC latex
\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}}
#+END_SRC
****** =subsection=
#+BEGIN_SRC latex
\titleformat{\subsection} %command
{\bfseries\itshape} %format
{} %label
{0pt} %sep
{} %before
[] %after
\ifthenelse{\boolean{cv@oldstyle}}{}{
\titlespacing{\subsection}{-5pt}{15pt}{5pt}}
#+END_SRC
****** =itemize=
#+BEGIN_SRC latex
\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}}
}
#+END_SRC
***** VC status
#+NAME: vc-status
#+BEGIN_SRC sh :results output :tangle no
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
#+END_SRC
#+BEGIN_SRC latex :noweb yes
\RequirePackage{ifthen}
\newboolean{@novc} %
\setboolean{@novc}{false} %
\DeclareOption{novc}{
\setboolean{@novc}{true}
}
\ProcessOptions
\ifthenelse{\boolean{@novc}}{}{
\RequirePackage{prelim2e}
<>
}
#+END_SRC
*** =org= to LaTeX stuff
**** Use smart quote when exporting
#+BEGIN_SRC emacs-lisp
(setq org-export-with-smart-quotes t)
#+END_SRC
**** Keep LaTeX logfiles
#+BEGIN_SRC emacs-lisp
(setq org-latex-remove-logfiles nil)
#+END_SRC
**** Default list of LaTeX packages
Only include one default package and remove all the crapppy stuff included by
=org= \rightarrow =latex= translation.
#+BEGIN_SRC emacs-lisp
(add-to-list 'org-latex-packages-alist '("" "org-preamble"))
#+END_SRC
**** =org= LaTeX class
#+BEGIN_SRC emacs-lisp
(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}")))
#+END_SRC
**** Set LaTeX command
#+BEGIN_SRC emacs-lisp
(setq org-latex-pdf-process '("latexmk -xelatex -shell-escape -quiet %f"))
#+END_SRC
**** Markup filter
Remove the quote block
#+BEGIN_SRC emacs-lisp
(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)
#+END_SRC
*** Project definition
#+BEGIN_SRC emacs-lisp
(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 ""
))
#+END_SRC
* Exporter functions
#+BEGIN_SRC emacs-lisp
(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)
))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(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 .")
))
#+END_SRC