Personal Notes on LaTeX

Fr, 07 Mai 2010 02:34:08 +0200

I am making this post to finally have everything written down in a central place.

Firstly, everytime I can, I use TexMacs. I dont like LaTeX, I never found a real introduction that goes into the implementation details of latex or tells how to really write code with it – I mean its said to be turing-complete, but I dont actually know how to do some quite simple things with it.

However, TexMacs is said to be capable of vitally anything LaTeX also is, and its scriptable with scheme, but well, sometimes its not capable of some things, and its not as well-documented as latex is. If I just want to write lecture notes, then I use TexMacs because you can really typeset the stuff fast and looking very good.

But for „larger“ things like my project thesis, I decided to use LaTeX. And before I knew TexMacs (which is – unfortunately – very unknown), I also used LaTeX, and before I knew LaTeX, I used the (which isnt that bad at all).

And so, here a few notes of problems that I had and their solutions:

Sometimes one wants to have one page without a page number. Setting \pagestyle{empty} should work in most cases. But not in all. When you use \maketitlepage, it somehow changes the pagestyle, so you have to use \thispagestyle{empty} afterwards instead. Setting the pagestyle back to the „default“ value is done by \pagestyle{plain}, which is the default, afaik.

Well, then there are dedication-pages. What I want is a single page which is empty except for one small text in the center of the page. Well, there are the commands \hfill and \vfill, filling up a line horizontally and a page vertically. Using these should make this possible. So I tried something like \vfill \hfill my-dedication \hfill \vfill \newpage. Didnt work. After a lot of trying around, finally, I „hacked“ around it by just using empty formulas, which make LaTeX think that it has to keep place: $ $\vfill$ $ \hfill my-dedication \hfill $ $ \vfill $ $. Well, not perfect, but it works.

For Code-Listings I finally found the LaTeX-Package „listings“ and this nice tutorial (which is in german). This is yet another of these „I can do everything“-Packages of which LaTeX has so many. In my opinion, a language should give you the possibilities of defining your own routines and only help you for this, but not keeping you as good as it can from doing anything yourself, while providing packages for „everything“.

Meanwhile I always use UTF-8. I dont see any reason for using anything else for my documents. Especially, when I want to include special characters like Hiragana or Katakana. Just to prevent the encoding hell. Actually, I dont quite understand why anybody is using anything else than UTF-8. Ok, some software needs encodings with an equal width, but these are special needs. For vitally everything the user has to handle with, UTF-8 should be the best.

Including graphics is also one major problem which always occurs. There may be a lot of packages which should place the graphics somewhere special, etc. – but none of them actually worked everywhere. Using pdf-files with \includegraphics from the graphicx-Package was sufficient for me so far – especially because I couldnt find anything that really worked better so far.

Then linebreaks. If I have a large formula, or a large word, or a large \tt-form, then LaTeX either goes over the side-boundaries, or gives up completely. I already used \emergencystretch=10000pt which sort of solved this problem (that is, it made some lines stretched pretty hard, but I didnt mind), but it created widows and orphans (seems to undermine the prevention-mechanisms somehow). Ok, it is a problem to choose what to do then. But the default I found was „just do it by hand“, but seriously, this cannot be a solution. Especially since the solution for me was clear: Use your algorithm where you can, but if a line would become too empty to stretch it, then simply dont do this with that line, just use \flushleft for this line. In my opinion, that sounds like the only thing one really can do about it – that is, even if I did it by hand, I would do it that way. But I couldnt find any pre-defined package or instruction defining this behaviour. So what I basically did was to just use \flushleft everywhere. It doesnt look that „pretty“, but well, it also doesnt look that „bad“, at least it looks continuous.