Skip to content

Instantly share code, notes, and snippets.

@derlin
Last active August 16, 2016 09:08
Show Gist options
  • Save derlin/4ec9d4c511ceaf3775d9a03af044a297 to your computer and use it in GitHub Desktop.
Save derlin/4ec9d4c511ceaf3775d9a03af044a297 to your computer and use it in GitHub Desktop.
Base for latex articles, with titlepage, headers/footer and eia-fr background
\documentclass[a4paper,11pt]{article}
%% Load additional packages and commands.
\usepackage{tabularx}
%~ paper and margins
\usepackage[tmargin=2.2cm,bmargin=2.2cm,lmargin=2cm,rmargin=2cm]{geometry}
\setlength{\parindent}{0pt} % no indent
\setlength{\parskip}{\baselineskip} % bare line between paragraphs
\setlength{\baselineskip}{2.5pt}
%~ language : load french support
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%~ section headings : decrease the spaces above and below
\usepackage{titlesec}
\titlespacing\section{0pt}{2pt plus 1pt minus 2pt}{-4pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{2pt plus 1pt minus 2pt}{-4pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{2pt plus 1pt minus 2pt}{-4pt plus 2pt minus 2pt}
%~ add default spaces between items in lists
\usepackage{enumitem}
\setitemize{itemsep=3pt}
%~ other really useful packages
\usepackage{graphicx} % for images
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
% hyperref setup
\usepackage[colorlinks=true,urlcolor=blue!30!black,linkcolor=blue!30!black,urlbordercolor={1 0 0},pdfborder=0 0 0]{hyperref}
\setcounter{secnumdepth}{4} % allows 4 numbered subsections
% it is possible to use \paragraph for the 4th level
\sloppy
% colors
\usepackage[svgnames]{xcolor}
%~ tables
\usepackage{array}
\usepackage{booktabs}
\renewcommand{\arraystretch}{1.2}
\newcommand{\cellhead}[2]{\multicolumn{1}{#1}{\textbf{#2}}}
% use gray dotted lines
\usepackage{arydshln}
% use dotted line instead of dashed line
\setlength\dashlinedash{1pt}
\setlength\dashlinegap{1pt}
\setlength\arrayrulewidth{0.5pt}
\definecolor{light-gray}{gray}{0.92}
\newcommand{\grayrule}{\arrayrulecolor{light-gray}\hdashline\arrayrulecolor{black}}
% \begin{verbatim}
% Redefine verbatim to use a smaller font size
\makeatletter
\renewcommand\verbatim@font{\footnotesize\ttfamily\color{black}}
\makeatother
%~ graphics path
\graphicspath{{resources/}}
\usepackage{float}
%~landscape support
\usepackage{pdflscape}
%~ toc
\usepackage{tocloft}
%~ header/footer
\usepackage{fancyhdr}
\usepackage{lastpage}
% --------------------------------------------------------------------------
% COMMANDS
% --------------------------------------------------------------------------
%~ \begin{dotitemize}
%~ bulleted list
\newcommand{\sbt}{\,\begin{picture}(-1,1)(-1,-3)\circle*{2.3}\end{picture}\ }
\newenvironment{dotitemize}{
\begin{list}{$\sbt$}{
\setlength\itemsep{2pt}
\setlength\parindent{2pt}
\setlength\labelsep{13pt}
}
}{\end{list}}
%include a figure, centered, with caption and label
% usage : \includeFigure{percentage of textwidth}{path}{caption}
% \usepackage{float}
\newcommand{\includeFigure}[3]{
\begin{figure}[H]
\centering
\includegraphics[width=#1\textwidth]{#2}
\caption{#3}
\label{fig:#2}
\end{figure}
}
%~ \code[text]
%~ text in monospace font
\newcommand{\code}[1]{{\small\texttt{#1}\normalsize}}
%~ \guillemets[text]
%~ enclose the text between french quotes
%\newcommand{\guillemets}[1]{\og#1\fg{}}
% or english quotes
\newcommand{\guillemets}[1]{``#1''}
%~ Usage:
% \begin{tcolorbox}[title]
% \end{tcolorbox}
\usepackage{tcolorbox}
\definecolor{light-gray}{gray}{0.85}
\definecolor{dark-gray}{gray}{0.10}
\newenvironment{notepar}[1] %http://mirror.switch.ch/ftp/mirror/tex/macros/latex/contrib/tcolorbox/tcolorbox.pdf
{\begin{tcolorbox}[title={#1},colback=white,colframe=light-gray,coltext=dark-gray,coltitle=dark-gray,fonttitle=\bfseries\large]}
{\end{tcolorbox}}
% --------------------------------------------------------------------------
% META
% --------------------------------------------------------------------------
\usepackage{titling} % to have thetitle, theauthor, thedate available
%opening
\title{My awesome project} % TODO
\author{Lucy Linder}
\date{16.07.2016} % TODO
\newcommand{\headone}{DAPLAB}
\newcommand{\headtwo}{}
%% logo of the school in filigrane
\usepackage{wallpaper}
\ULCornerWallPaper{1}{logo-bg.pdf}
% header and footer
\pagestyle{fancy}
\fancyhead{}
\fancyhead[RO,LE]{\slshape \leftmark}
\fancyfoot{}
\fancyfoot[L]{\small\itshape{Haute école d'ingénierie et d'architecture Fribourg}}
\fancyfoot[R]{\thepage\ / \pageref{LastPage}}
% change toc title (with babel french package)
\addto\captionsfrench{\renewcommand\contentsname{Table of Contents}}
% --------------------------------------------------------------------------
% CONTENT
% --------------------------------------------------------------------------
\begin{document}
% ------------------ title page
\begin{titlepage}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command for the horizontal lines, change thickness here
\center % Center everything on the page
\includegraphics[width=.6\textwidth]{heia-fr-logo.png}\\ [1.5cm]
%\textsc{\Large Haute école d'ingénierie et d'architecture de Fribourg}\\[1.5cm] % Name of your university/college
\textsc{\Large \headone{}}\\[0.5cm] % Major heading such as course name
\textsc{\large \headtwo{}}\\[0.5cm] % Minor heading such as course title
\HRule \\[0.4cm]
{ \huge \bfseries \thetitle}\\[0.4cm] % Title of your document
\HRule \\[2cm]
% If you don't want a supervisor, uncomment the two lines below and remove the section above
%\Large \emph{Author:}\\
%John \textsc{Smith}\\[3cm] % Your name
\includegraphics[height=200px]{logo.png}\\[1cm] % Include a department/university logo - this will require the graphicx package
\vfill
\begin{center} \large
\emph{Author:} Lucy \textsc{Linder} % Your name
\end{center}
\vspace{1cm}
{\large \thedate}\\[2cm] %
\end{titlepage}
%--------------------------------------- toc
%\tableofcontents
%\thispagestyle{empty}
%\newpage
% --------------------------------------- document
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment