Last active
February 20, 2017 11:39
-
-
Save kittsville/226053b0df8da6cad73c to your computer and use it in GitHub Desktop.
Config/function names/general stuff I use in LaTeX. Easier than remembering the last project I used $thing in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% | |
% Many of things involve solutions from TeX, the LaTeX Stack Exchange | |
% You guys are amazing | |
% | |
% Stops ugly hyperlink box | |
\documentclass[11pt,hidelinks]{article} | |
% Custom margins using Geometry package | |
\usepackage[a4paper, total={5.5in, 9in}]{geometry} | |
% For international characters | |
\usepackage[utf8]{inputenc} | |
% Stops mid-word hyphenation | |
\tolerance=1 | |
\emergencystretch=\maxdimen | |
\hyphenpenalty=10000 | |
\hbadness=10000 | |
% Stops new paragraph indentation | |
\setlength{\parindent}{0pt} | |
\setlength{\parskip}{1em} | |
% Citations | |
\usepackage[backend=biber]{biblatex} | |
\addbibresource{citations.bib} | |
% Internal and external links | |
\usepackage{hyperref} | |
% Hyperlinked internal references, using section symbol | |
\newcommand{\iref}[1]{(\hyperref[#1]{\S\ref*{#1}})} | |
% Makes entire text "section 2.3" hyperlink, not just the "2.3" part | |
\newcommand{\refcap}[2]{% | |
\hyperref[#2]{#1 \ref*{#2}}% | |
} | |
\printbibliography | |
% Better Tables | |
\usepackage{multirow} | |
\usepackage{booktabs} | |
\begin{table} | |
\begin{center} | |
\begin{tabular}{ p{3cm}p{3cm}p{4cm}} | |
Col1 & Col2 & Col3 \\ | |
\toprule | |
Cel1 & Cel2 & Cel3 \\ | |
Cel4 & Cel5 & Cel6 \\ | |
\bottomrule | |
\end{tabular} | |
\caption{Table caption} | |
\end{center} | |
\end{table} | |
% Acronyms | |
\usepackage{acro} | |
% Stops first use of Abbreviation being its long form | |
\acsetup{first-style=short} | |
% Example acronym | |
\DeclareAcronym{lgbtq}{ | |
short = LGBTQ* , | |
long = Lesbian Gay Bisexual Transexual Queer (inclusive) , | |
extra = Some extra explanatory text here, | |
class = abbrev | |
} | |
\printacronyms[include-classes=abbrev,name=Abbreviations] | |
% Images | |
\usepackage{graphicx} | |
\graphicspath{ {images/} } | |
\begin{figure}[h] % 'h!' to force position | |
\centering | |
\includegraphics{myimage} | |
\caption{Image caption} | |
\label{fig:figname} % Include if using labels package | |
\end{figure} | |
% Code | |
\usepackage{listings} | |
\usepackage{color} | |
\definecolor{codegreen}{rgb}{0,0.6,0} | |
\definecolor{codegray}{rgb}{0.5,0.5,0.5} | |
\definecolor{codepurple}{rgb}{0.58,0,0.82} | |
\definecolor{backcolour}{rgb}{0.95,0.95,0.92} | |
\lstdefinestyle{mystyle}{ | |
backgroundcolor=\color{backcolour}, | |
commentstyle=\color{codegreen}, | |
keywordstyle=\color{magenta}, | |
numberstyle=\tiny\color{codegray}, | |
stringstyle=\color{codepurple}, | |
basicstyle=\ttfamily\scriptsize, | |
breakatwhitespace=false, | |
breaklines=true, | |
captionpos=b, | |
keepspaces=true, | |
numbers=left, | |
numbersep=5pt, | |
showspaces=false, | |
showstringspaces=false, | |
showtabs=false, | |
tabsize=2, | |
mathescape=true | |
} | |
\lstset{style=mystyle} | |
\begin{lstlisting} | |
def foo(): | |
return 'bar' | |
\end{lstlisting} | |
% Shorter way of superscripting text | |
\newcommand{\up}[1]{\textsuperscript{#1}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment