LaTeX

I typeset all of my notes and homework in LaTeX, using Vim as my text editor, with the VimTeX plugin for Vim+LaTeX incorporation, and the Ultisnips plugin for fast snippets while typesetting. All my diagrams are typeset with the TikZ and PGFPlots packages manually.

Inspiration to move over to Vim for LaTeX documents came from Gilles Castel's amazing blog post about his workflow. Most of my initial snippets were taken directly from this post, and I built up many others over time.


Tips

LaTeX can be hard to get used to, and has a decent learning curve. My largest tip is just to keep practicing—you'll only get better by continuously typesetting documents. I've only just gotten to the point where I can typeset live during lectures, and I've spent the past 2 years getting used to LaTeX and finding my own workflow.

Another huge tip is to Google everything you get stuck on as you typeset—eventually, you'll find yourself remembering more and more commands and environments, slowly getting over that learning curve.

Typesetting is very time consuming as you're starting out—be patient! You'll slowly build up speed and familiarity as you go, so don't immediately give up if you find that typesetting homeworks takes twice as long as writing everything by hand (or longer).


Custom Preamble

Here is a link to my current preamble.sty file, and here is a link to a minimal version of the physics package that I compiled from the package sources, containing only the \qty command and the modified math commands. My preamble is always evolving as I typeset more, and I will periodically update the version on this page.

Note: it is not the best idea to use my preamble as-is, if you are looking for a long-term solution; you'll likely have no idea which packages are included and how to use any of the commands/environments I've defined.

I suggest using my preamble as inspiration for what to include in your preamble, or how to structure your custom preamble—this way, you'll know exactly what you're doing, and you'd have full control over what packages to add to suit your needs.

I provide my preamble and full documentation in hopes that I can help others in the process of learning LaTeX, and ease their transition into typesetting. The purpose of sharing my preamble is to give a supplement for learning, not as a drop-in default preamble. Thus, I highly suggest you read through the source code yourself and adapt it to your needs, referencing the below documentation if necessary to clarify any details.


Usage

You may include this preamble within your documents with \usepackage[flags]{preamble}. To make the preamble.sty file available globally, put the file in ~/texmf/tex/latex/ (you may have to update your settings in your local TeX distribution); I have it as ~/texmf/tex/latex/styles/preamble.sty.

Here are the possible options that you can use with my preamble; you can include multiple, but flags specified later will override the previously specified flags. You can include the flags as \usepackage[flag1,flag2]{preamble}; here, flag2 will override flag1.


Groups
  • homework

    Enables: tikz, circuits, enumerate

    Initializes enumerate environments for homework typesetting, and includes all packages for diagram creation (TikZ, PGFPlots, and CircuiTikZ).

  • lecture

    Enables: tikz, circuits, tcbtheorems, fancysections

    Initializes commands and theorem environments for typesetting lecture notes, and also includes all packages for diagram creation.

    The \lecture[date]{title} command is added to start lectures, and the example, definition, theorem, and lemma environments are added as well, using colored boxes. All of these environments have optional arguments \begin{environment}[title][label]. Labels can be referenced by prefixing ex:, def:, thm:, or lem: respectively to the label specified in the environment.

    Lists of theorems, definitions, etc. can be typeset with \tcblistof[\section*]{list name}{section title}. All list names are the environment names, with the suffix list; for example, theorems are in the list theoremlist.

    This is usually the group that includes the most packages and commands.

  • cheatsheet

    Enables: tikz, circuits, narrowmargins, cheatsheetlengths, smallercomponents

    Initializes page margins (narrower margins) and spacing for cheatsheet creation. Also includes all packages for diagram creation.

    Best used with the multicols environment to include two columns in the cheatsheet. See the cheatsheets linked on the coursework page for reference.

Options
  • tikz, notikz

    Default: enabled

    Includes or excludes the TikZ and PGFPlots packages, respectively.

    If set, the CircuiTikZ package will automatically be loaded, and the circuits flag will do nothing.

    If unset, the CircuiTikZ package will never be loaded, even if the circuits flag is set.

  • circuits, nocircuits

    Default: disabled

    Includes or excludes the CircuiTikZ package, respectively.

    The latter is most commonly used in [tikz,nocircuits] to include TikZ but exclude CircuiTikZ.

  • tcbtheorems, notcbtheorems

    Default: disabled

    Initializes theorem environments with the tcolorbox package, making them fancier than the default environments.

    Most commonly excluded if there is no need to define any theorems in lecture notes; in this case, [lecture,notcbtheorems] would be used.

  • narrowmargins

    Default: disabled

    Makes the margins smaller (0.6 inches instead of the default 1 inch).

  • fancysections

    Default: disabled

    Defines the \lecture[date]{title} command for fancier lecture headers.

  • smallercomponents

    Default: disabled

    Decreases the size of CircuiTikZ components to 80%.

  • minted

    Default: disabled

    Includes the minted package.

    Provides syntax highlighting for code listings. Requires the Pygments package to be installed in the system Python interpreter.

    The Pygments style used is my custom port of the Atom One Light color scheme, and will fallback to the default Pygments style if not installed. Additionally, in homework answer environments, the background color of minted code blocks is changed to a light blue to differentiate between answer code blocks and problem statement code blocks.

  • asymptote

    Default: disabled

    Includes the asymptote package. This is not included by default with any of the groups, and requires the external asymptote program to be installed.

    A fair warning that the Asymptote documentation is quite bad, and I've spent countless hours trying to make sense of the options. Since then, I've fully switched over to using TikZ for diagram creation.