Subscribe to this blog


I'm nearly writing everything in LaTeX, this ranges from letters to scientific works over taking notes. Yes, taking notes can be easy even with LaTeX, which I now want to explain. The idea behind is that I like to take notes when reading a scientific book to remember later on what was in there. Also in a lecture it can be quite handy to take some notes and to have them structured later on in a nice way.

The most annoying thing when writing down notes in LaTeX is the ever repeating

\begin{itemize}
\item ...
\end{itemize}

I like to be able to use the dash for a new item, as I would on the paper. That's not hard, one must only understand how LaTeX handles signs. First of all, you need to know that you can redefine every letter in TeX. Then you have to know that you can rename control sequences.\ When renaming a command, you give the old command a new name and the old one doesn't exist anymore. Consider the following:

\newcommand\myname{\text{Erasmus Fuerchtegott von Gerstenbein}}
\let\notmyname\myname

Newcommand just creates an alias for the argument in braces. \let does the actual renaming. If I would use

\newcommand\notmyname\myname

I would have two times the same command, using \let removes the old \myname. In order to rename the dash, \let is the best choice.

\let\--

I decided to overwrite \- with the -, because I think that I'll never need to insert hyphens in notes. You can of course be creative and choose something better.

Then you have to make the dash active, which means that you can use the dash actually as a control sequence. For this you need catcode, please see http://en.wikibooks.org/wiki/TeX/catcode for details.

\catcode`-=\active

Then you can simply define the dash as \item using let:

\let-\item

If you structure your notes, you also need to insert headings or something similar which interrupt the itemize environment. Because

\begin{itemize}...\end{itemize}

means a bit of overhead, I redefined them to the lesser and greater signs. Those I stored in \lesser and \greater.

\let\lesser<
\let\greater>

% redefinition:
\catcode`<=\active
\catcode`>=\active
\def<{\begin{itemize}}
\def>{\end{itemize}}

After all, we now can write something like this:

\documentclass{scrartcl}

% ...

\begin{document}

\section{Love Live Of The Butterfly}

<
- live of butterfly in four states (egg, larva, pupa, adult)
- produces eggs
- has interesting courtship ritual with some kind of dance
>

If you want to use HTLatex in order to get an nice HTML file with links and a table of contents, you need to insert the definitions below the \begin{document}, otherwise the compilation will fail.

I have put those redefinitions into a file which you can download here. You can use it by typing \input{latexkeynotes.tex} (it applies the same regarding htlatex).\ Please note that this prohibits dashes in filenames, if you plan to input more files.



Comments