# Type Equations up to 2x Faster in LaTeX

Typing equations with vanilla LaTeX and amsmath is slow. It involves
lengthy macros and repetition, like typing `\boldsymbol{}`

every time you want to
print a bold symbol for vectors. Moreover they are hard to remember: Why aren’t
dot and cross product named `\cdot`

and `\times`

, and not `\dot`

and `\cross`

?

The problem is **context**: We can’t expect amsmath to have context, since there are
many disciplines that use LaTeX to print formulas, and the symbols have
different meaning in different contexts. Amsmath’s job is not to provide
**contextual macros**, but a robust basis for those who’d like to
build them.

We have to build our own macros in order to **type less and express more**. For
example, taking a partial derivative is a very common operation:

In order to print this, I typed

```
$\frac{\partial x}{\partial y}$
```

Too many characters for such a simple operation, don’t you think? What if we defined a macro for partial derivatives:

```
\newcommand{\partd}[2]{\partial #1}{\partial #2}
```

`\partd`

stands for partial derivative, which is short and easy to remember.
With this macro at hand, I can just type

```
$\partd{x}{y}$
```

The number of characters decreased from 25 to 12, which is more than 50%!

Let’s see what we can do with bold symbols. Amsmath offers `\boldsymbol`

for
that purpose. To print regular `a`

, you just type it: `$a$`

. But to print bold
`a`

, you have to type 13 more characters: `$\boldsymbol{a}$`

. This is absurd!

We can define a shorter macro that uses `\boldsymbol`

```
\newcommand{\B}[1]{\boldsymbol{#1}}
```

effectively decreasing the number of extra characters from 13 to 4. But wait! We can do even better.

The only input `\B{}`

will receive is `A-Z`

, `a-z`

, `0-9`

, and possibly
`\alpha-\omega`

. So with this limited set of inputs, we can get rid of the curly
braces by defining

```
\newcommand{\Ba}{\boldsymbol{a}}
\newcommand{\Bb}{\boldsymbol{b}}
...
\newcommand{\Bz}{\boldsymbol{z}}
```

and so on for each desired character. This would decrease the number of extra
characters to 2: just `\B`

!
And we can do this with other math fonts, such as blackboard bold, cursive,
fraktur etc. In fact, I already did that with
shortsym. I also created a
package called lazyeqn containing the
contextual macros I always use. You can check both out on my GitHub.

I’ve been using LaTeX since 2010 and enjoy it a lot. I finished homeworks, wrote my thesis and typed out whole lecture notes, in real time during the lecture. When I see a friend begin learning LaTeX, I see them lose time setting equations the hard way, because they don’t know how to define their own macros. I hope this will help them and others become more efficient.