My LaTeX preamble and snippets.

\LaTeX is undoubtedly the best tool out there to visualize mathematical formulae. However, it can be often unfriendly and annoying. In this post I’ll share my preamble, snippets and other sources of trickery I use in my infinite struggle against \LaTeX.

Fist things first:

The preamble (in not so pretentious terms, the packages that I use)


\documentclass[12pt]{article} //one can easily change the size of the font to 11, 10pt, etc.
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[bulgarian,english]{babel} //these three are so I can use both English and Bulgarian;
//you can change these into other languages, if the script is Cyrillic or Latin packages.
\usepackage{mathtools,amsmath,amsthm,amssymb,amsfonts} //standard ones
\usepackage[a4paper]{geometry} // So I can manipulate the margins, headers and footers easily
\usepackage{titling} //gives control over the \maketitle command
\usepackage{parskip} //no indentation in the beginning of paragraphs; matter of choice
\usepackage{graphicx} //more options for the graphics
\usepackage{booktabs} //makes tables sexier
\usepackage{rotating} //can rotate graphics, never used it but it sounds fun
\usepackage{colortbl} //color in tables
\usepackage{esvect} //arrows and stuff
\usepackage{textcomp} //adds some symbols
\usepackage{subfigure} //needed for subfigures, duh
\usepackage{hyperref} //makes all the citations and references as hyperlinks; much sexier
\usepackage{listings} //displaying source code (inception)
\lstset{frame=single, basicstyle=\ttfamily}
\usepackage[numbers]{natbib}
\bibpunct{(}{)}{;}{a}{,}{,}
\usepackage{color} //speaks for itself
\usepackage[dvipsnames]{xcolor}
\usepackage{enumerate} //again, speaks for itself
\usepackage{etoolbox}
\usepackage{fancyhdr}
\pagestyle{fancy} //fancy==sexy
\usepackage[margin=10pt,font=small,labelfont=bf]{caption}
\usepackage[overload]{empheq}
\newtheorem{proposition}{Proposition}
\newtheorem{conjecture}{Conjecture}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{theorem}{Theorem}[section]
\newtheorem*{notice}{Notice}
\newtheorem*{funfact}{Fun fact}
\newtheorem*{notation}{Notation}
\newtheorem*{problem}{Problem}
\newtheorem*{exercise}{Exercise}
\newtheorem*{example}{Example}
\newtheorem*{convention}{Convention}
\newtheorem{corollary}{Corollary}[section]
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newtheoremstyle{named}{}{}{\itshape}{}{\bfseries}{.}{.5em}{\thmnote{#3 }#1}
\theoremstyle{named}
\newtheorem*{namedconjecture}{conjecture}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\patchcmd{\thebibliography}{\chapter*}{\section*}{}{}
\title{Title}
\author{Name}
\date{\today}
\fancyhead{}
\lhead{Title}
\rhead{Name}
\chead{}

Now, after the packages, it’s time for the fun part – the snippets. I use Sublime text 3. It allows for tons of little tweaks that make my workflow a little bit faster. The snippets are maybe the most helpful tool of all. Creating snippets is extremely easy. Since it will be pointless to copy and paste all of them as text here, I’ll just upload the files. My favorite one is the article 


<snippet>
<content><![CDATA[
\documentclass[12pt]{article}
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage[a4paper]{geometry}
\usepackage{a4wide}
\usepackage{titling}
\usepackage{mathtools}
\usepackage{parskip}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{colortbl}
\newcommand{\gray}{\rowcolor[gray]{.9}}
\usepackage{textcomp}
\usepackage{subfigure}
\usepackage{hyperref}
\usepackage{listings}
\lstset{frame=single, basicstyle=\ttfamily}
\usepackage[numbers]{natbib}
\bibpunct{(}{)}{;}{a}{,}{,}
\usepackage{color}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage{etoolbox}
\newcommand{\todo}[1] {\textbf{\textcolor{red}{#1}}}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[margin=10pt,font=small,labelfont=bf, labelsep=endash]{caption}
\usepackage[overload]{empheq}
\newtheorem{proposition}{Proposition}
\newtheorem{conjecture}{Conjecture}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{theorem}{Theorem}[section]
\newtheorem*{notice}{Notice}
\newtheorem*{problem}{Problem}
\newtheorem*{convention}{Convention}
\newtheorem{corollary}{Corollary}[section]
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newtheorem{appadef}{Definition}[section]
\renewcommand{\theappadef}{\Alph{section}.\arabic{appadef}}
\newtheorem{appalem}{Lemma}[section]
\renewcommand{\theappalem}{\Alph{section}.\arabic{appalem}}
\newtheorem{appathm}{Theorem}[section]
\renewcommand{\theappathm}{\Alph{section}.\arabic{appathm}}
\newtheoremstyle{named}{}{}{\itshape}{}{\bfseries}{.}{.5em}{\thmnote{#3 }#1}
\theoremstyle{named}
\newtheorem*{namedconjecture}{conjecture}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\patchcmd{\thebibliography}{\chapter*}{\section*}{}{}
\title{$1${2:Title}}
\author{Kristian Georgiev}
\date{\today}
\fancyhead{}
\lhead{${3:Title}}
\rhead{Kristian Georgiev}
\chead{}
\begin{document}
\begin{titlepage}
\clearpage\maketitle
\thispagestyle{empty}
\begin{abstract}
${4:Abstract}
\end{abstract}
\end{titlepage}
\par ${5:Text here}
\end{document}
]]></content>
<tabTrigger>doc</tabTrigger>
</snippet>

which allows me to setup a new document with just typing doc and a few tabs. Another gold one for me is the important_definition


<snippet>
<content><![CDATA[
\begin{center}
\colorbox[HTML]{F8E0E0}{
\begin{minipage}[c]{\textwidth}
\begin{definition}
$1
\end{definition}
\end{minipage}}
\end{center}
]]></content>
<tabTrigger>impdef</tabTrigger>
</snippet>

which outputs something like this (putting the definition in a colored box),

screenshot-from-2016-12-11-12-46-34

and the matrix_NxN


<snippet>
<content><![CDATA[
\begin{pmatrix}
$1 & $2 & \cdots & $3 \\\
$4 & $5 & \cdots & $6 \\\
\dot \cdot & \dot \cdot & \dot \cdot & \dot \cdot \\\
$7 & $8 & \cdots & $9
\end{pmatrix}
]]></content>
<tabTrigger>matn</tabTrigger>
</snippet>

which outputs an N\times N matrix in a sexy way with no effort.

These are the things that come to my mind now. I hope you’ll find them useful. If I add new stuff, I’ll update the post.

KG^2

P.S. The obligatory xkcd comic.

file_extensions

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s