Differences

This shows you the differences between two versions of the page.

Link to this comparison view

code:latex:preamble [2013/07/04 08:45] (current)
Line 1: Line 1:
 +~~ODT~~
 +This is the [[http://​www.latex-project.org/​|LaTeX]] preamble I normally use (copying might be easier if you [[http://​www.ana.unibe.ch/​~haberthuer/​code/​latex/​preamble?​do=edit&​rev=|look at the page-source]])
  
 +===== Info =====
 +The preamble uses a little trick with \ifhtml to help with the generation of [[wp>​SVG]]-files from the [[:​latex#​tikz|Tikz]]-images in the file, to convert the .tex into .html and ultimatively into .doc (to send to collaborators for easy correction tracking if they refuse to use SVN).
 +
 +This means that if you want to use htlatex for typesetting into a .html-file, uncomment \htmltrue, comment \htmlfalse, scud the file at least three times through "​htlatex"​ and then you should have a nice file with svg-images.
 +
 +If you want a good pdf, use \htmlfalse, "​pdflatex"​ the file at least three times((while ignoring the errors the first two times)), and then you get a nice pdf out of it.
 +
 +To be able to see the SVN-Info in the typeset .pdf, you should remember to set the [[:​latex#​subversion_information|SVN keywords]] of the .tex-file!
 +
 +===== Preamble =====
 +<code latex>
 +\documentclass[a4paper,​abstract=true,​twoside]{scrartcl}
 +
 +\newif\ifhtml
 + 
 +\htmlfalse
 +\htmltrue
 +
 +\ifhtml % In case of web format output...
 + \def\pgfsysdriver{pgfsys-tex4ht.def}
 + \usepackage[dvips]{graphicx}
 + \DeclareGraphicsExtensions{.png}
 +\else
 + \usepackage{graphicx}
 +\fi
 +
 +\usepackage[utf8]{inputenc}
 +\usepackage[T1]{fontenc}
 +\usepackage[english]{babel}
 +\usepackage{siunitx}
 +\usepackage{svn-multi}
 +\usepackage{subfig}
 +\usepackage{fancyhdr}
 +\usepackage{microtype}
 +\usepackage{scrtime}
 +\usepackage{tikz}
 +\usepackage{pgfplots}
 +\usepackage{booktabs}
 +\usepackage[numbers,​square,​sort&​compress]{natbib}
 +\ifhtml
 + \usepackage[disable]{todonotes}
 +\else
 + \usepackage{todonotes}
 + \usepackage{lineno}
 + \linenumbers
 + \modulolinenumbers[2]
 + \usepackage{setspace,​savetrees}
 + \onehalfspacing
 + \usepackage{hyperref}
 + \hypersetup{%
 + pdfauthor={David Haberth\"​{u}r},​%
 + pdftitle={Title},​%
 + pdfsubject={Subject},​%
 + pdfkeywords={keyword1,​keyword2},​%
 + pdfpagemode=UseThumbs%,​
 + %colorlinks=true%
 +                        }
 +\fi
 +
 +% Subversion Information
 +\svnidlong
 +{$HeadURL: $}
 +{$LastChangedDate:​ $}
 +{$LastChangedRevision:​ $}
 +{$LastChangedBy:​ $}
 +\svnid{$Id$} ​
 +
 +\pagestyle{fancy}
 +\fancyfoot{}
 +\fancyfoot[OR]{\tiny \href{\svnkw{HeadURL}}{Revision \svnkw{LastChangedRevision}} --- last commit on \svnkw{LastChangedDate} --- page \thepage}
 +\fancyfoot[EL]{\tiny page \thepage\ --- \href{\svnkw{HeadURL}}{Revision \svnkw{LastChangedRevision}} --- last commit on \svnkw{LastChangedDate}}
 +
 +\newcommand{\imsize}{\linewidth}
 +
 +\newlength\imagewidth
 +\newlength\imagescale
 +
 +\title{Title}
 +\ifhtml
 +\else
 + \subtitle{(SVN-revision:​ \svnkw{LastChangedRevision},​ compiled \today, \thistime)}
 +\fi
 +\author{David Haberth\"​{u}r}
 +\date{\today}
 +
 +\begin{document}
 +\maketitle
 +
 +\begin{abstract}
 +Abstract
 +\end{abstract}
 +
 +\ifhtml
 +\emph{Did you sort out all todos?}
 +\else
 +\listoftodos
 +\fi
 +
 +\tableofcontents
 +
 +\section{first section}
 +\todo{write the document!}\lipsum[1]
 +
 +\section{second section}
 +\lipsum[1]
 +
 +\section{third section}
 +\lipsum[1]
 +
 +\bibliographystyle{unsrtnat}
 +\bibliography{../​references} % since my LaTeX-files sit in folders like p:​\#​docs\thisdocument\file.tex and the reference.bib is saved in p:\#doc
 +
 +\appendix
 +\section{appendix}
 +\lipsum[1]
 +
 +\end{document}
 +</​code>​