Skip to content

Instantly share code, notes, and snippets.

@themattchan
Last active May 11, 2016 04:19
Show Gist options
  • Save themattchan/712b0663e79f6ac73d17 to your computer and use it in GitHub Desktop.
Save themattchan/712b0663e79f6ac73d17 to your computer and use it in GitHub Desktop.
[DEPRECATED: see https://github.com/themattchan/latex-styles] My LaTeX CS/Math homework style as a YASnippet
# -*- mode: snippet; require-final-newline: nil -*-
# name: homework-sty
# key: homework
# binding: direct-keybinding
# --
\documentclass[10pt,letterpaper]{article}
\usepackage[T1]{fontenc}
\usepackage[parfill]{parskip} % line break instead of indentation
\usepackage[margin=1in]{geometry}
\usepackage{float} % use attribute [H] to force images to stay where they should be
\usepackage{secdot} % dot after section number
\usepackage{lmodern}
\usepackage{amssymb,amsmath,amsthm}
\usepackage{mathtools}
\usepackage{empheq}
\usepackage{enumerate}
\usepackage{nicefrac}
\usepackage{graphicx}
\usepackage{color}
\usepackage{hyperref}
\usepackage{tikz}
\makeatletter
\newcommand\course[1]{\renewcommand\@course{#1}}
\newcommand\@course{}
\newcommand\term[1]{\renewcommand\@term{#1}}
\newcommand\@term{}
\renewcommand{\@maketitle}{%
{\bfseries \@course, \@term \hfill \@author}\\
\begin{center}
{\Large \textbf \@title}
\end{center}
}
\makeatother
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
% use solid black square instead of box for QED
\renewcommand\qedsymbol{$\blacksquare$}
% bold title, italic text, extra space above and below;
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}
% bold title, upright text, extra space above and below;
\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\newtheorem{exmp}{Example}[section]
\newtheorem{xca}[exmp]{Exercise}
% italic title, upright text, no extra space above or below.
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{claim}{Claim}
\newtheorem*{note}{Note}
\newtheorem{case}{Case}
% ================================================================================
\begin{document}
\course{$1}
\term{$2}
\title{Homework $3 Solutions}
\author{$4}
\maketitle
$5
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment