## Visualizing SF’s Housing Deficit

Made this for a class project to visualize SF’s lagging housing construction since 2012. This chart does not include any existing housing deficit prior to 2012, but just illustrates how even if the housing stock was perfectly adequate in 2012 (it wasn’t), construction over the following 6 years was insufficient. The red line shows the number of new residents added to San Francisco while the yellow line shows how much new housing has been added in the same period. There is also a dashed grey line which I added as a very rough estimate of where housing should be in order to keep up with the growing population by assuming a constant 2.2 people per household (SF’s number of people per household via the most recent Census data). Notice that the yellow line is quite a bit under the dashed grey line and that the slope of the yellow line doesn’t seem to indicate that it will catch up to the dashed grey line any time soon. This means that housing supply is short, will continue to remain short, and rents and home prices will remain high or rise until a) The red line chills out aka population growth slows, b) The yellow line picks up some speed aka SF accelerates its rate of housing development, or c) The grey line is redefined to be a smaller proportion of the red line aka San Franciscans get more used to packing more bodies into less housing. Option c may be tough, though, because by my math, the grey line doesn’t match the yellow until you start packing ~3.5+ people into each housing unit. With the majority of new housing being 2 bedrooms or smaller, San Franciscans might want to start embracing bunk beds.

## Discovering LaTeX

Recently, I needed to submit an assignment for a college trigonometry course I was taking. My assignment involved modeling some scenario with a trigonometric function and my paper needed to include a bunch of math with all work shown.

I started out with Google Docs, but I wasn’t at all happy about how unreadable all the math ended up looking when typed out:

At a minimum, I could probably throw some π symbols in there, I thought.

That gave me this:

Still stupid looking. After some Googling, I came upon a few options for how to make neater looking math equations in a document.

### Option #1: Google Doc’s built-in Equations

Going here adds this nifty little toolbar to the top of the editor:

It took a bit of fighting, but I was able to type out the symbols I wanted (in the Greek Letters dropdown) and stack the fractions (in the Math Operations dropdown).

The biggest downside here was that typing/editing equations is fairly cumbersome.

### Option #2: Extending Google Doc Functionality with Auto-Latex Equations Plug-In

More Googling lead to me discovering that there were other options through Google Docs if I used a third-party plug-in. IMO, the best one of the bunch I tested was Auto-Latex Equations. This plug-in lets you type in LaTeX markup (more on this later) directly into your document like this:

…and then render all marked-up equations with the click of a button. It will scan the document for any markup and will replace those blocks of text with an inline image:

Learn more about the plug-in: https://sites.google.com/site/autolatexequations/

### Option #3: Nerding out and going 100% LaTeX

Later, I decided to look more into this LaTeX thing. LaTeX is a document preparation / typesetting system that allows a user to author documents in plain-text with markup and then render the document out at a later stage. As a former professional programmer, this sounded Fun™.

I downloaded MiKTeX and Texmaker for Windows (kinda like downloading a compiler and an editor) and started learning more LaTeX markup. Setup took less than 5 minutes after following the installation instructions from both sites. Here’s a peek at the editor and my workflow:

Workflow:

1. Googling to learn new markup. Example searches: “latex insert image”, “latex align equations”, etc.
2. Author my document in the left pane. Type stuff. Copy and paste stuff from the internet. Break things. Etc.
3. Press F1 or hit the “Quick Build” button at the top to render out my document to a pdf. View the results on the right panel.
4. Repeat until stuff looks how I want.

A sample LaTeX document:

\documentclass[10pt]{article}

\title{Example TeX Document}
\author{Jay Austria}
\date{September 2017}

% Cool, you can import packages for extra functionality
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage[export]{adjustbox}

% Kill page numbering (on by defualt)
\pagenumbering{gobble}

\begin{document}

\maketitle

\section{Introduction}
This is a simple demo of a few of the things you can do with Texmaker + MiKTeX:

\section{Examples of Some Stuff}
The following is a quote:
\begin{quote}
“I like rice. Rice is great if you’re really hungry and want to eat 2,000 of something.” – Mitch Hedberg
\end{quote}
Oh look, math stuff:
$$f(x) = 2.5\cos(\frac{3 \pi x}{4} – \frac{\pi}{4})+21.5$$
Aligning equations:
\begin{align*}
3x + 1 &= 4x – 4\\
3x &= 4x – 5 && \text{Subtracted 1 from both sides}\\
-x &= -5 && \text{Subtracted $4x$ from both sides}\\
\Aboxed{x &= 5} && \text{Multiplied both sides by -1}
\end{align*}
Have this cat:

\includegraphics[scale=0.25, center]{cat.jpg}

Some observations about animals:

\begin{center}
\begin{tabular}{| l | l | l |}
\hline
Animal & Is it a cat?\\ \hline
dog & no \\ \hline
cat & yes \\ \hline
\hline
\end{tabular}
\end{center}

\end{document}

Which spits out this beautiful work of art as a PDF in the same directory as my .tex file.

### Conclusion

Option 1 is probably fine for most people.

Options 2 and 3 start to get into the territory where your time investments start to get diminishing returns. If you’re quick at picking up new things, Option 2 gives a good balance of the portability of Google Docs and a faster way to write out nice looking functions.

Going with Option 3 is probably the most “over-engineered” approach to needing to write a paper with some math. Personally, I enjoyed the challenges involved when learning new markup and occasionally fighting things to get it formatted/positioned the way I want. I think it would be a great long-term investment for me to keep authoring things in this environment and internalizing some of the markup. LaTeX may come in handy if I’m ever wanting to author my own exams or other classroom material. For now, it mostly lets me pretend I’m programming again, but being honest–it hasn’t yet done anything major for me that I couldn’t have just done with Option 2 and Google Docs.

Bonus for anyone interested in learning: Here’s a YouTube tutorial that helped me with learning some basic LaTeX markup. Video credit to Michelle Krummel.