Formatting and math style in LaTeX

LaTeX gives almost infinite control over formatting, and it is possible to spend hours making small adjustments to a document, forcing every character and every pixel to be in an optimal location.

A much easier solution is to trust LaTeX to format documents. Though it might not look exactly as you might envision, LaTeX’s standard document classes do a surprisingly good job at formatting. Of course, some manual adjustments might still be in order; you might want to change the default indent size (e.g. with \parindent=0in), force some space between paragraph breaks (e.g. with \parskip=5px), or change the margins (e.g. with the geometry package or using \usepackage{fullpage}). The general structure of a document, however, is best left up to LaTeX’s default styles.

LaTeX can fairly easily create a title heading. Here is an example:

\title{All of Mathematics}
\email{someone@somewhere.com}
\author{C.F. Gauss}
\date{\today}
\begin{abstract}
      This paper explains all of mathematics, in alphabetical order.
\end{abstract}
\maketitle

The final \maketitle command tells LaTeX to display the title, author, email, date, and abstract information in the style defined by your documentclass.

LaTeX can also handle section headings and section numbering. To start a new section, simply say \section{My new section}. Similarly, you can define new subsections and subsubsections with \subsection{My subsection} and \subsubsection{A subsubsection}. These sections (and subsections and subsubsections) are automatically numbered sequentially. (To disable automatic numbering in LaTeX, add an asterisk, i.e. \section*{Unnumbered section}.)

LaTeX is also often used with mathematical expressions, for which there are also some stylistic points to keep in mind. Firstly, it is a good idea to use displayed equations. These can be used for long or complicated expressions to make them easier to read. When surrounded by text, they also serve to break up long paragraphs into more manageable chunks. Even simple equations can be displayed to make them stand out, such as

\displaystyle  e^{i\pi}+1=0.

Something to keep in mind is that all punctuation following a displayed equation should be placed in math mode, immediately following the equation.

Make it a habit to use math mode for all mathematical symbols, regardless of length. For example, it looks ugly to say “Consider a function f with f'(x) = x+5“; instead, say “Consider a function f with f'(x) = x+5“. Doing this allows you to clearly differentiate between math symbols and text, and also eliminates confusion resulting from math mode letters looking different from text mode letters.

LaTeX also provides a number of math operators for easy formatting. For example, log x looks ugly, while \log x looks much better. It is easy to define new operators as well. For example, if you want to use “disc” to denote a discriminant, then you can use \def\disc{\operatorname{disc}} or \DeclareMathOperator{\disc}{disc} to define the \disc operator. This allows you to type \disc K to get \mathrm{disc}\, K.

You can also use expanding delimiters in large math expressions. For example, compare

\displaystyle  P(\frac1x) \qquad P\left(\frac1x\right).

The symbol on the right is achieved by writing $P\left(\frac{1}{x}\right)$. All other delimiters expand as well, via commands like \left[, \left\{, \left|.

For clarity, inline fractions in text can be typeset horizontally. That is, in a typical font size, the fraction 79/128 is easier to read than the fraction \frac{79}{128}. Of course, there are plenty of cases when you want to write fractions vertically, such as when they are part of a larger expression (e.g. \frac12 + \frac13 = \frac56).

Long equations can be broken up. It’s no good when an equation is too long and runs off the page, and it’s ugly to see an equation reach into the margin. Instead, break the equation up at binary operators and equals signs, such as + or =. Long calculations can be broken up at each equals sign, such as

\displaystyle  \begin{array}{rcl}  K_m(s) &=& \frac{1}{m+1} \frac{1}{1- e^{it}} \left( \frac{1 - e^{-i(m+1)s}}{1 - e^{-is}} - e^{is} \frac{1 - e^{i(m+1)s}}{1 - e^{is}}\right) \\ &=& \frac1{m+1} \frac1{e^{is/2} (e^{-is/2} - e^{is/2})} 	\left( 		\frac{1 - e^{-i(m+1)s}}{e^{-is/2} (e^{is/2} - e^{-is/2})} 		-\frac{e^{is} (1 - e^{i(m+1)s})}{e^{is/2} (e^{-is/2} - e^{is/2})} 	\right) \\ &=& \frac1{m+1} \frac1{e^{-is/2} - e^{is/2}} 	\left( 		\frac{1 - e^{-i(m+1)s}}{e^{is/2} - e^{-is/2}} 		-\frac{1 - e^{i(m+1)s}}{e^{-is/2} - e^{is/2}} 	\right) \\ &=& \frac1{m+1} 	\left( 		\frac{ e^{i(m+1)s} + e^{-i(m+1)s} - 2 }{(e^{is/2} - e^{-is/2})^2} 	\right) \\ &=& \frac1{m+1} 		\frac{ \sin^2 (\frac{m+1}2 s) }{\sin^2 \frac s2}. \end{array}

Similarly, it is a good idea to align lists of equations at equal signs, such as

\displaystyle  \begin{array}{rcl}  \sin\theta &=& y \\ \cos\theta &=& x \\ \tan\theta &=& \frac yx \end{array}

Such an effect can be achieved using a construction like

\begin{align*}
       \sin\theta &= y \\
       \cos\theta &= x \\
       \tan\theta &= \frac yx.
\end{align*}

Integrals need extra space. Compare:

\displaystyle  \int x^2 dx \qquad \int x^2 \, dx.

The second integral separates the dx from the integrand, making the equation more clear. This was typeset using $\int x^2 \, dx$, where the \, serves to add a bit of space.

Technical writing

It is important to remember that even though technical writing aims to communicate ideas precisely and unambiguously, such writing is still ultimately read by human beings and not computers. Readers of technical writing already have to struggle with challenging ideas, and it is up to the writers to make their writing as approachable and clear as possible.

Use words between mathematical symbols. For example, instead of “Consider {A_{mn}}, {n < m}”, use “Consider {A_{mn}} where {n < m}”. This serves to delimit mathematical expressions and avoid confusion.

Consider using words instead of symbols to express simple ideas. For example, instead of “Take {m, n \in \mathbb{Z}}”, consider using “Take integers {m} and {n}”. The goal is to avoid burying the reader in a morass of unnecessary symbols and notation.

Avoid unnecessary symbols and abbreviations. Instead of using {\therefore}, {\forall}, {\exists}, write them out in words! It is easier to read “for every {\epsilon > 0} there exists {\delta > 0} …” than “{\forall \epsilon > 0}, {\exists \delta > 0} …”

Write in complete sentences. Consider replacing each mathematical expression with some filler word, like “blah”. Is each sentence still complete? Still properly punctuated? Using mathematical symbols does not absolve the writer from the rules of grammar. If a sentence ends with a displayed math expression, use a period! For example, we can define

\displaystyle  |x| = \begin{cases} x & x \ge 0 \\ -x & x < 0. \end{cases}

Explain with words. It is often tempting to write pages of formulas and calculations and leave the reader to fend for himself while working through those computations. It is much nicer to the reader, however, to include some running commentary explaining what is being done.

Avoid walls of text. Nobody likes working through a dense argument that is one massive paragraph. Use paragraph breaks to give the reader some space to reflect on what’s been said so far. Use displayed equations to make them more readable, more visible, and simply as a way to break a paragraph into more manageable pieces.

Don’t be afraid to be redundant. It often makes things clearer to say the same thing in both words and symbols. For example, which definition of an open set is easier to read: “Every point {x \in X} has some neighborhood {B_\delta(x)} of radius {\delta > 0} around {x} such that {B_\delta(x) \subset X}” or “For all {x \in X} there exists {\delta > 0} such that {B_\delta(x) \subset X}”? They carry the same content, but in the first, the reader can focus on the concepts presented by the text, while in the other, the reader needs to translate from mathematical symbols into a more humanly parsable form.

Each theorem, lemma, corollary, definition should be self-contained. When scanning through a paper, its confusing to see

Theorem {f(x)} is a continuous but nowhere differentiable function.

Much better is to see “Let {f(x)} be as defined above in Definition 1.3. Then {f(x)} is continuous but nowhere differentiable.” Alternatively,

Theorem Let {f(x) = \sum_{n=0}^\infty a^n \cos(b^n \pi x)} where {b} is a positive odd integer, {0 < a < 1}, and {ab > 1 + \frac32 \pi}. Then {f(x)} is continuous but nowhere differentiable.

Give motivation and talk about the big picture. It is easy to blithely jump from one lemma to the next, giving clear and rigorous proofs of each lemma but losing sight of the reasoning behind those jumps. Before a chain of arguments and ideas, it helps to spend a paragraph talking about the big picture: Where is this argument leading? What’s the goal? Is there some intuitive picture or motivating example? All of this might be extremely clear for the writer, especially if he worked all of the details out on his own; for the reader, however, finding motivation and intuition often requires gaining a deep understanding of the topics under discussion. It only takes a few words to make everything much clearer.

Use clear formatting. Use section headings and appropriately space and align equations. This helps to communicate the structure of a paper. This is the subject of my next post.

For more on technical writing, see Knuth’s notes on mathematical writing.

Too much typing

I spend a lot of time typing mathematics in LaTeX. Here’s a summary of everything that I typed for my math courses this quarter:

Algebraic number theory:
Notes: 22 pages
Homework: 49 pages

Functional analysis:
Notes: 60 pages
Homework: 42 pages

Representation theory:
Notes: 42 pages
Homework: 15 pages

That’s a total of 230 pages over ten weeks. I hope my computer is not getting too tired.

Update:
I also typed papers for my writing class (PWR) in LaTeX. That comprised a total of approximately 12 double-spaced pages. This means that for every page written for my writing class, I wrote approximately 19 pages of math.

I need more work?

I spent all of spring quarter feeling somewhat overworked. It felt as if I was trying to juggle too many things: three math classes, another class that was a waste of time, SUMO events, ARML coaching, and everything else that happened over the quarter: launching rockets, finishing up SMT stuff, various miscellaneous meetings… I didn’t have time to do anything as well as I would like, and work was often deferred until it become no longer relevant.

Now that the quarter is over, I suddenly have a lot more free time. There are no more constant deadlines, and I can actually look more than a day or two into the future without recoiling in horror at mountains of work. I’m returning to a regular sleep schedule, and everything is good — except for one minor problem. I’ve become accustomed to always having lots to do, and having free time feels rather foreign.

I’m still trying to keep myself busy, of course. My summer to do list is long, longer than what could possibly be finished in one summer. But the lack of firm deadlines makes all of that seem distant, maybe even optional. The clear lesson here is that I need more work.

Surely, I’ll stop feeling this way fairly soon. By the fall, having any work at all will probably feel odious and unpleasant. But for now, I’ll continue to ponder my long to do list, procrastinate on most of it, and wonder why I have so little work.

Dreams

One day, a few weeks ago, I was working on a representation theory problem set, and at some point, I curled up on a couch in order to take a nap. I dreamed that I was in a forest, holding a harpoon gun, hunting representations. The representations were little LaTeX symbols with legs, \chi_U and \rho(g) and character tables that kept running away into the bushes. I dreamed that I was walking softly through the forest, stalking my prey. I can’t recall if I ended up catching any representations, though I think I woke up from the frustration of watching those representations run away.

Another time, I started to fall asleep in an algebraic number theory class. At the time, fields were being discussed, and as I drifted into sleep, I saw a cow standing by the door at the front of the classroom. The cow appeared to be in a grassy field, and it looked very happy.

I think I should sleep more.

ARML

Sorry about not posting for the past few months. I’ve been very busy recently. With the start of the summer, I should be able to post much more frequently.

I have been a coach for the San Francisco Bay Area ARML team for the past two years. Every year, people ask me why I help with ARML, and the answer is always the same: because it’s fun.

I enjoyed my first trip to ARML in 2008, and ARML has gotten better every year. Unlike most contests, ARML is heavily team-based, and as such, it is a great way to meet interesting people. ARML tends to build a sense of community that is lacking from most math events. Over the past few years, I’ve met many students and coaches at ARML, and they are a major reason why I go back to ARML every year.

Another big part of coaching ARML are the practices that we run every spring. It’s always great to see the gathering of people with similar mathematical interests. I believe in teaching math as a way to learn and understand something more thoroughly, and I hope to do more teaching at ARML practices in future years. Doing math is often most enjoyable as a social activity, and I think that our practices fully demonstrate that feature.

Here’s a list of interesting things that happened at ARML, in no particular order:

  • Green sharpies
  • Easy button thieves
  • A disappearing sword
  • Brilliant power round solutions
  • Paper balls and paper airplanes
  • Math!

Happy Pi Day!

This is the obligatory pi day post.

Despite my insistence on celebrating this most glorious of holidays, I believe that celebrating Pi Day is silly numerology. Here’s why:

  • 3.14 depends on the base 10 number system.
  • 3.14 is only an approximation.
  • Pi Day suggests that pi is more important than other mathematical constants, such as e or tau.

Of course, celebrating e day is rather difficult because February does not have 71 days. There is actually a movement to celebrate Tau Day, however. I believe that celebrating tau instead of pi is even sillier.

  • Tau Day suffers from all of the problems of Pi Day that were listed above.
  • What food would we eat on Tau Day?
  • Why don’t we celebrate 2 Pi i day instead?
  • Einstein was born on Pi Day.
  • In particle physics, the pi particle is lighter and therefore more nimble than the tau particle. In addition, the pi particle interacts by the strong force while the tau particle interacts via the weak force.
  • Roughly speaking, pions are the particles that bind protons and neutrons together in the nucleus (according to the Yukawa interaction). Without pions, the only element in the world would be hydrogen, which would be rather unfortunate. So pions are very important in everyday life. In contrast the tau is basically a fat electron that decays quickly and doesn’t really do anything, so it’s pretty useless.
  • In chemistry, pi bonds are crucial while tau bonds are much less important.
  • \prod is the symbol for product, so pi represents productivity.
  • “Pirates” starts with pi, and as we should know, the decrease in pirates is linked with an increase in average global temperature.

Numerology is silly. In other news, today is the anniversary of the creation of this blog. Guess which post so far has been the most popular? Ironically, it’s 2011: Numerology.

A problem from the SMT

The 13th annual Stanford Mathematics Tournament was held on February 19, 2011. My favorite problem on the contest was the last problem on the calculus subject test.

Theorem 1 Compute the integral

\displaystyle  \int_0^\pi \ln (1 - 2a \cos x + a^2) \, dx

for {a > 1}.

Read more of this post

2011: Numerology

It is time to celebrate the first day of the new year, and I hereby welcome you to the year 2011.

Of course, the timing of the start of the year is an artifact of our calendar system. The choice of the date to be called “January 1” was determined more or less arbitrarily, and in fact, other cultures use different calendar systems with the new year occurring on different dates. As far as I can tell, time passes uniformly and there is no canonical time that deserves to be called the start of the year. In that sense, celebrating the new year is no more sensible than numerology.

In fact, 2011 (like every other number) has interesting numerological properties; given sufficient time and effort, the number of numerological properties are unbounded. Here’s a small sample:

  • 2011 is prime
  • 2011 is the sum of 11 consecutive primes: 2011 = 157 + 163 + 167 + 173 + 179 + 181 + 191 + 193 + 197 + 199 + 211
  • The past few prime years were 1997, 1999, 2003, 2011. Notice that the successive differences of these years are consecutive powers of two. In fact, 2027 is also a prime year, though 2059 = 29 * 71 is not.
  • 2011^2 = 4044121. Reversing the digits on each side, we get 1102^2 = 1214404.
  • 2011 = 1 + 2 * 3 * (4 * (5 * 6 + 7 * 8) – 9)

Content-free mathematics

All of mathematics is content-free.

That’s a claim that would probably get me lynched in any self-respecting math department, and anyone who has taken a real math class would feel that it isn’t true. How could anything that causes so much pain and confusion be content-free?

In some sense, however, every statement in mathematics is trivial. After all, a proof is no more than a series of logical implications, and every such implication is logically trivial (i.e. correct). The difficulty in understanding a proof is simply a parsing problem. For a technically challenging proof, there may be many definitions and lemmas to parse, and the writing may not be very clear, but all of the logical steps are there. In mathematics, proving is hard, but once a proof has been written, checking the proof requires much less inspiration and genius. In fact, given a proof, it could be written in computer-checkable form, and we all (hopefully) believe that computers aren’t yet sentient.

This isn’t to say that reading and understanding proofs is entirely easy; if this were true, learning math would take no time at all and checking Perelman’s proof of the Poincare Conjecture would not have taken many months and years. Even though I can try to justify a theoretical claim that mathematics is trivial, it is nonetheless true that I struggle to understand things. My brain isn’t a computer; though it’s probably better as being creative, it’s certainly worse at parsing. An argument about the triviality of math because purely philosophical and is itself content-free.

However, there are some parts of math that I do believe to be content-free, not just because all proofs are logically correct, but because they have been generalized to the point of being eaten up by other broader fields. These domains of mathematics become special cases of general statements, and though they may maintain their clever tricks and elegant arguments, work in these fields can contribute little that is not trivially known.

Consider Euclidean geometry as an example. In the time of Euclid and the Greeks, geometry was considered the essence of mathematics; they even used it to prove facts about the primes. Now, however, Euclidean geometry as moved into the realm of the content-free. Every statement in pure Euclidean geometry can be restated in terms of basic building blocks like collinearity and concurrency, and these can be translated into systems of polynomial equations that can be solved by standard techniques (e.g. Gröbner basis). So the ability to solve problems in Euclidean geometry is a corollary of an understanding of systems of equations, and the work of Euclid can now be automated by a computer.

Of course, plenty of people still care about Euclidean geometry. Even if the mathematical statements themselves are no longer important for the development of mathematics as a whole, Euclidean geometry still provides a good place to learn how to think about math, and that is a skill that transcends mere problems or mere fields. In addition, Euclidean geometry is still a great source of problems for contests because of its abundance of elegant results. For me, an argument in pure Euclidean geometry still carries an aesthetic appeal that a system of equations will never be able to match.

Will every mathematical field end up as a subfield of a more general theory? As I see more math, I believe that the answer is yes: There is always a more general framework in which old ideas are simplified and trivialized. There’s no reason that anyone would care about such a general framework, however, unless it can serve to unify seemingly unrelated ideas. The pursuit of generality for generality’s sake feels to me as rather silly; adding needless abstraction to a problem does not make it any more important or more interesting. Instead, I believe in abstraction when mathematics is ready — and not before.

In the end, there will always be problems and puzzles for mathematicians to ponder, and that is what is important. Regardless of whether mathematics is actually content-free (and throughout this discussion, we never defined “content-free”, so this is an subjective opinion), mathematics will always be interesting and worth studying.