Archive

Posts Tagged ‘math’

LaTeX: Adding Your Own Paired Delimiters

October 5th, 2012 1 comment

I’ve come to use LaTeX extensively for typesetting my Mathematics homework. It just makes things so beautiful. And like the XHTML/CSS split, it really does encourage strong separation of content from presentation. One of the things I first hated about it though, is that I grew quickly tired of using \left and \right with brackets, parentheses, or anything that needed to be automatically be sized to its content.

And, as any good engineering student might, I sought to encourage my own laziness by finding a clever shortcut. After a few minutes of searching Google, I came across the DeclarePairedDelimiter command in the mathtools package. Its usage is fairly self-explanatory, as I’ll let the following demonstrate.

First, you need to load the mathtools package in your document header:

\usepackage{mathtools}

Then you can create your own paired delimiters with the DeclarePairedDelimiter command:

\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\DeclarePairedDelimiter{\innerproduct}{\langle}{\rangle}

Finally, you can use these new commands in math mode to more easily group your expression. (Append an asterisk to make LaTeX automatically insert the necessary \left and \right commands when you need the delimiters to resize according to their content.)

If \(a \lt 0\) and \(b \gt 0\), then \(\abs{a} = -a\),
and so \(\abs*{\frac{a}{b}} = -\frac{a}{b}\).
The norm of a vector \(v\), denoted \(\norm{v}\), is
defined by \(\norm{v} = \sqrt{\innerproduct{v,v}}\).

As a nice bonus, it increases readability of the LaTeX source tremendously, since it gives those grouped expressions some semantic name rather than just being a bunch of formatting. For instance with the above delimiters, \left\lvert \frac{a}{b} \right\rvert is more to type, and a lot less obviously an absolute value, than the simpler \abs*{\frac{a}{b}}.

Happy hacking!

Categories: Science, Technology Tags: , ,

A Semester of Fun

January 24th, 2009 1 comment

Well, now that I’m nearly finished with the general-education requirements, this semester is shaping up to be quite a fun adventure. Aside from the slight tedium of taking General Chemistry, I’m also taking two math courses (“Advanced Topics in Linear Algebra” & “Ordinary Differential Equations”) and two Japanese classes (“Intermediate Japanese-A” and “Study of Kanji”), so even though it’s going to be quite busy (18 units!), it definitely won’t seem so.

We went to a a used book store in Fullerton that was having a “going out of business” sale over this past weekend: about 70-80% off everything. While there, I picked up a good half-dozen Star Trek books that, along with Christmas and early-birthday gifts, should provide quite ample reading material for the bus rides to and from class, as well as just generally being quite good books. On my desk right now are just a handful of them:

  1. Fallacies and Pitfalls of Language: The Language Trap (S. Morris Engel)
  2. The Audacity of Hope: Thoughts on Reclaiming the American Dream (Barack Obama)
  3. Titan (Stephen Baxter)
  4. Doctor Who: The Indestructible Man (Simon Messingham)
  5. Pegasus in Space (Anne McCaffrey)

This is not an exhaustive list, mind you, but a majority of the Star Trek and other books that I bought were only due to my having read them in the past simply on loan from the local library, and I enjoyed them so much that I simply wanted to ensure myself my own copy. I think I’m going to quite like this. 🙂

Categories: Books, Life Tags: , , , ,