Archive for October, 2006
Customising class styles
Tuesday, October 31st, 2006 | LaTeX | No Comments
The basic premise of TeX is that nearly everything can be changed. So, we could change, for instance, the \maketitle command to output a page of fluffy bunnies with your title, name and other info (like \thanks) in a pink box. This will almost guarantee that your paper looks rather unique in your teacher’s pile of papers to grade—we will leave that up to you to decide whether that is a good thing, though.
Since the character @ lies in a special category (I’ll return to categories some other time—they aren’t strictly relevant to understand for the purpose of this post), it is a good choice to use as internal
variables, since a user doesn’t accidentally use one. Thus, most internal commands are on the form \@myname.
So, when we write something like
\documentclass{article} \author{Henrik Stuart} \title{Brian, the Bunny Slayer} \begin{document} \maketitle \end{document}
We get a fancy first page as seen in this figure:
Not really the thing that’ll catch a child’s fancy (nor most grown-ups for that matter).
Now, what happens when we write \title is that the following command is triggered (the exact details may differ by distribution and version):
\def\title#1{\gdef\@title{#1}}
What this basically does is to globally define the command \@title to contain your argument. In our case, using \@title inside the document would print out Brian, the Bunny Slayer
(sans the quotes, if your browser supports them). Likkewise \author globally defines \@author. The difference between \def and \gdef will also be covered at a later time.
So, using our knowledge, we can generate our title in a… ehm… lovely pink box, like this:
\documentclass{article} \usepackage{tikz,xcolor,pgflibrarysnakes,calc} \author{Henrik Stuart} \title{Brian, the Bunny slayer} \makeatletter \renewcommand{\maketitle}{ \newpage \noindent \begin{tikzpicture} \draw[snake=bumps,fill=pink,color=pink] (0,0) rectangle (\textwidth,6cm); \draw[snake=bumps] (0,0) rectangle (\textwidth,6cm); \draw (.5\textwidth,4cm) node[baseline] {\color{white}\bfseries\Huge\@title}; \draw (.5\textwidth,2cm) node[baseline] {\color{white}\bfseries\itshape\Large\@author}; \end{tikzpicture} } \makeatother \begin{document} \maketitle \end{document}
which results in the following page:
This is probably very appetising for a 5-year old, but I’m not sure who else would want such a title page.
This, however, is not the primary point of this post—albeit it has taken up considerable space. Imagine that you’re working on your LaTeX document in a somewhat diverse group whose members use different distributions on different operating systems. Then \@author could’ve been \@author, or something entirely different, leading to an error when the other group members try to compute the document.
The \maketitle redefinition is a fairly benign command to modify, but imagine if you had to look up the internal commands for altering the layout of the table of contents, list of figure, chapters, sections, etc. Also imagine that the internals can be changed by a new version, rendering all your old documents obsolete. Thus, it is probably for the best to use a popular document class, as it is likely it will quickly be updated to accomodate a new version (or not need to be modified at all), and you can settle with just updating in one place.
The document class of choice isn’t article, report or book that most tutorials use, but rather memoir, which has been written to limit the amount of packages you need, and to provide a great deal of control over the layout and typography of your document. To use memoir, it has a dense and very useful documentation that I would suggest you pursue. It even contains a very good part on typography that is valuable reading. Most of my future posts will be using memoir, so to get ahead of the game, read and enjoy its manuals (also contained at the above link).
A typographical beginning
Monday, October 30th, 2006 | LaTeX | No Comments
For the most part, LaTeX is used almost exclusively in the academe, by some few publishers and by some companies that are largely populated by disaffected college students.
So, despite its fairly limited widespread use, it is by far one of the best tools for typesetting articles and books, in particular for mathematical equations. However, I won’t spend a lot of time presenting the basics in this blog, but rather spend time on stepping away from the mediocre standard layout it presents a user with. In short, we will look at ways that we can customise the many aspects of LaTeX to suit our smallest whims. We do this by looking at how we can ensure separation of content and layout, much like the basic premise of the division between HTML and CSS.
So, for the first post here are some pointers to some introductory LaTeX documents. The future will step up the bar quite a bit, so you can start with preparing by deepening your understanding of LaTeX.
Distributions:
Introductions:
With that, enjoy your reading, or check back once in a while for new and exciting updates. If you have a suggestion for a topic you’d like to see covered, let me know in the comments.
A new time
Friday, October 20th, 2006 | Personal | No Comments
So, when I said in my last blog post that I was back in the blogging business, I had, of course, counted on the fact that we were moving on the first, and that my telephone company couldn’t hook me up with Internet at the new place for almost two weeks. The best way to come back to the blogging business is to leave it abruptly again, making everyone wonder where you’ve went, driving up traffic when people pine for your next nugget of information (or something).

It has, unfortunately been pretty much overcast constantly since we moved in, so you’ll have to do with a slightly dark image from the back side of the house. We’ve bought this lovely house in a nice suburb north of Copenhagen, just next to a school and a stone throw from a nursery, so the stage is set for the next aspect of life.
We’re still getting settled in, so until we’re finished with that, I’ll postpone the indoors pictures as everything is a bit cluttered. My desk is still in a temporary position in the middle of the living room so I can do some work. Hopefully everything will have gotten in order within long. We’re fortunate that there’s also a lot of nature around, so I’ll be sure to take a few snapshots from the lake nearby as well if I can manage to remember to bring the camera when we go for a walk.
Apart from us moving, then Microsoft has released Internet Explorer 7 unto the world and since it fixes a lot of issues with formatting the layout of my website I have taken the chance to do a nice spring cleaning and make my site look pristine on IE7 and FireFox. If you’re on an earlier version of Internet Explorer and my site suddenly looks very strange then… well, that’s why.
Lastly, I’ve written another fascinating project in partial fulfillment of my masters degree in Computer Science, which you can see here (PDF). It is about creating a language for specifying typefaces (fonts) for the computer. If you want bit more of a description of the project, look at the research page.
So, to a new time…
Categories
Archives
- July 2011
- June 2011
- November 2010
- October 2010
- April 2010
- November 2009
- October 2009
- June 2009
- May 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- December 2006
- November 2006
- October 2006
- September 2006
- June 2006
- April 2006
- March 2006
- February 2006
- January 2006
- December 2005
- November 2005
- October 2005
- September 2005
- May 2005
- April 2005
- March 2005
- February 2005
- January 2005
- December 2004
- June 2004
- April 2004
- February 2004
- November 2003
- January 2003
- November 2002