Skip to content

Instantly share code, notes, and snippets.

@acjackman
Last active December 10, 2015 11:09
Show Gist options
  • Save acjackman/4425747 to your computer and use it in GitHub Desktop.
Save acjackman/4425747 to your computer and use it in GitHub Desktop.
LaTeX: Document Style
% ================
% = Code Styling =
% ================
\usepackage{listings}
\lstset{ %settings for Listings (fold)
language=R, % choose the language of the code
basicstyle=\footnotesize, % the size of the fonts that are used for the code
numbers=left, % where to put the line-numbers
numberstyle=\footnotesize, % the size of the fonts that are used for the line-numbers
firstnumber=1, % Set the first number to 1, so that lines are number every five starting on the fifth
stepnumber=5, % the step between two line-numbers. If it is 1 each line will be numbered
numberfirstline=true % Always number the First line
numbersep=5pt, % how far the line-numbers are from the code
backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
frame=single, % adds a frame around the code
tabsize=2, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=true, % sets if automatic breaks should only happen at whitespace
escapeinside={\%*}{*)} % if you want to add a comment within your code
}
\documentclass[12pt,letterpaper,oneside]{article}
\newcommand{\university}{Brigham Young University}
\newcommand{\classCode}{TEST 100}
\newcommand{\className}{Intro to Really Interesting Subject}
\newcommand{\documentName}{Notes}
\newcommand{\dateTaken}{August 16, 2012}
\newcommand{\semester}{Fall 3020}
\newcommand{\teacher}{Dr. Fill Johnson}
\newcommand{\docVersion}{v0.0.0}
\newcommand{\authorName}{\href{mailto:adam@acjackman.com}{Adam Jackman}}
\input{./Styles/code.tex}
\input{./Styles/pageStyle.tex}
\input{./Styles/mathCommands.tex}
\begin{document}
\input{./Styles/title.tex}
\end{document}
% =================
% = Math Packages =
% =================
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{xfrac}
% ============
% = Commands =
% ============
\newcommand{\prob}{\text{P}}
\newcommand{\sSpace}{\mathcal{S}}
\newcommand{\sampSpace}{\sSpace}
\newcommand{\natn}{\mathbb{N}} % is the set of natural numbers,
\newcommand{\intn}{\mathbb{Z}} % is the set of integers,
\newcommand{\ratn}{\mathbb{Q}} % is the set of rational numbers and
\newcommand{\realn}{\mathbb{R}} % is the set of real numbers.
\newcommand{\permu}[2]{{}_{#1}\mathrm{P}_{#2}}
\newcommand{\dd}{\mathrm{d}}
% Statistical Functions
\newcommand{\pdf}{\text{f}}
\newcommand{\CDF}{\text{F}}
\newcommand{\expv}{\text{E}}
\newcommand{\loss}{\text{L}}
\newcommand{\lik}{\mathcal{L}} % Likelihood
\newcommand{\loglik}{\text{l}} % Log Likelihood
\newcommand{\var}{\text{Var}}
\newcommand{\cov}{\text{Cov}}
\newcommand{\corr}{\text{Corr}}
\newcommand{\bias}{\text{bias}}
\newcommand{\mse}{\text{MSE}}
% Symbols
\newcommand{\mlest}[1]{\hat{#1}_{\text{\tiny MLE}}}
\def\dotsim{~{\buildrel .\over \sim}~}
\def\iidsim{~{\buildrel \text{iid}\over \sim}~}
\DeclareRobustCommand{\annuity}[1]{%
\def\arraystretch{0}%
\setlength\arraycolsep{.7pt}%
\setlength\arrayrulewidth{.3pt}%
\begin{array}[b]{@{}c|}\hline
\\[\arraycolsep]%
\scriptstyle #1%
\end{array}%
\,
}
\newcommand{\due}[1]{\ddot{#1}}
\newcommand{\vect}[1]{\mathbf{#1}}
% Statistical Distributions
\newcommand{\bernd}{\text{Bernoulli}}
\newcommand{\binomd}{\text{Binomial}}
\newcommand{\poisd}{\text{Poisson}}
\newcommand{\normd}{\mathcal{N}}
\newcommand{\gammad}{\text{Gamma}}
\newcommand{\expd}{\text{Exp}}
\newcommand{\betad}{\text{Beta}}
% ================
% = Page Styling =
% ================
\usepackage{hyperref}
\usepackage{enumerate}
\usepackage[section]{placeins}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
% Page Geometry
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{fancyhdr}
\setlength{\headheight}{15.2pt}
\setlength{\parindent}{0in} % Don't indent paragraphs
\usepackage{parskip} % Add vertical space to distinguish paragraphs, but keep regular spacing for lists, ect.
% Set Header and Footer
\pagestyle{fancy}
\renewcommand{\headrulewidth}{1.0pt}
\renewcommand{\footrulewidth}{1pt}
\fancyhf{}
\fancyhf[HLO,HRE]{\classCode}
\fancyhf[HLE,HRO]{\dateTaken}
\fancyhf[FLE,FRO]{\thepage}
\fancyhf[FLO,FRE]{\authorName}
\fancyhf[HC]{\documentName}
\usepackage{adforn}
\newcommand\crulefill[1][1ex]{\leavevmode\leaders\hrule depth \dimexpr-#1+0.4pt height #1\hfill\kern0pt}
\newcommand\ornline[2][1ex]{\trivlist\item\crulefill[#1]#2\crulefill[#1]\endtrivlist}
\newcommand{\daysep}{\ornline{\hspace{2em}\adforn{21}\hspace{2em}\dateTaken\hspace{2em}\adforn{49}\hspace{2em}}}
\begin{titlepage}
\begin{center}
% Upper part of the page
\vspace*{1 in}
\textsc{\LARGE \university}\\[1.5cm]
% Title
\rule{\linewidth}{0.5mm}\\[0.6cm]
{ \huge \bfseries \className}\\[0.4cm]
\rule{\linewidth}{0.5mm} \\[.5cm]
\textsc{\Large \classCode}\\[0.5cm]
\textsc{\Large \authorName}\\
\rule{\linewidth}{0.25mm}\\[.5cm]
% Author and supervisor
\begin{minipage}{0.4\textwidth}
\begin{flushleft} \large
\emph{Semester}\\
\textsc{\semester}
\end{flushleft}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\begin{flushright} \large
\emph{Teacher} \\
\textsc{\teacher}
\end{flushright}
\end{minipage}
\vfill
% Bottom of the page
{\large \today, \docVersion}
\end{center}
\end{titlepage}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment