Skip to content

Instantly share code, notes, and snippets.

@klaseskilson
Last active October 5, 2015 08:34
Show Gist options
  • Save klaseskilson/61b2157be7cd8b236e32 to your computer and use it in GitHub Desktop.
Save klaseskilson/61b2157be7cd8b236e32 to your computer and use it in GitHub Desktop.
Latex starter document

Latex starter document

A neat document to use each time you're about to start writing a new LaTeX document.

\documentclass[12pt,a4paper]{article}
\pdfoutput=1
%%
%% This huge block of usepackages does a lot of things.
%% It makes the text pritty on screens and ensures that you can use some common
%% tools.
%%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
% change language to whatever you write in
\usepackage[swedish]{babel}
\usepackage{amsmath}
\usepackage{lmodern}
\usepackage{listings}
\usepackage{units}
\usepackage{icomma}
\usepackage{color}
\usepackage{graphicx}
\usepackage{multicol,caption}
\usepackage{bbm}
\usepackage{hyperref}
\usepackage{xfrac}
\newcommand{\N}{\ensuremath{\mathbbm{N}}}
\newcommand{\Z}{\ensuremath{\mathbbm{Z}}}
\newcommand{\Q}{\ensuremath{\mathbbm{Q}}}
\newcommand{\R}{\ensuremath{\mathbbm{R}}}
\newcommand{\C}{\ensuremath{\mathbbm{C}}}
\newcommand{\rd}{\ensuremath{\mathrm{d}}}
\newcommand{\id}{\ensuremath{\,\rd}}
% if you want a page header/footer, use this!
% \usepackage{fancyhdr}
% \pagestyle{fancy}
% \lhead{Left in the header}
% \rhead{Right in the header: \today}
% This creates a nice figure environment that puts the image where you use it,
% and not where LaTeX wants it to be.
\newenvironment{Figure}
{\par\medskip\noindent\minipage{\linewidth}}
{\endminipage\par\medskip}
% neat horizontal line
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\begin{document}
\title{The title}
\author{The author}
\date{\today}
%%
%% Use one of these title methods
%%
% \maketitle % simple latex title
\input{./titlepage.tex} % pretty title page, see titlepage.tex in this gist
% empty page after title page, ignore this page in the numbering
\newpage\null\thispagestyle{empty}\pagenumbering{gobble}\newpage
\newpage\pagenumbering{arabic} % Arabic page numbers (and reset to 1)
% optional abstract!
\begin{abstract}
This is an abstract.
\end{abstract}
\newpage
% fairly self-explenatory
\tableofcontents
\newpage
\section{First section}
This is the first paragraph, see \emph{figure \ref{fig:figureref}}.
\subsection{The first subsection}
First paragraph of the first subsection.
% the neat figure
\begin{Figure}
% center it!
\centering
% adjust width as you like, include image from optional folder
\includegraphics[width=0.7\linewidth]{./images/myimg.png}
% caption! change the label ref to what you want
\captionof{figure}{\emph{Figure text..}\label{fig:figureref}}
\end{Figure}
\section*{This section has no number}
Also, it is ignored by the table of contents.
% optional bibliography
\begin{thebibliography}{99}
\end{thebibliography}
\end{document}
\begin{titlepage}
\begin{center}
% Pre-title
\textsc{\Large Pre title}\\[0.5cm]
% Title
\HRule \\[0.4cm]
{ \huge \bfseries Write a title here \\[0.4cm] }
\HRule \\[1.5cm]
% Author and supervisor
\begin{minipage}{0.4\textwidth}
\begin{flushleft} \large
% Author
Name\\
\emph{email@example.com}
\end{flushleft}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{flushright} \large
% supervisor
Supervisor\\
Supervisor name
\emph{supervisor@example.com}
\end{flushright}
\end{minipage}
\vfill
% Bottom of the page
{\large \today}
\end{center}
\end{titlepage}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment