TeXblog

 Typography with TeX and LaTeX

KOMA-Script 3 available

3 November 2008 by Stefan Kottwitz

The new version KOMA-Script 3 by Markus Kohm et al. has been released today.

Some of the new features are:

  • possibility to change almost all settings, even the paper or font size, after loading the class and even after \begin{document},
  • arbitrary base font size, not only in pt, also in other units of measure like pica (pc),
  • new key=value interface, backward compatible,
  • new package tocbasic for generation of table of contents and other lists, supporting the multilingual babel package,
  • arbitrary choice where chapters are allowed to start,
  • improved documentation.

To download KOMA-Script 3, visit http://developer.berlios.de/projects/koma-script3/.

There are release notes in English and more extensive in German.

edit Nov 11: KOMA-Script 3 is available now also as MiKTeX package. I’ve installed it with TeX Live on Ubuntu Linux by the MiKTeX package manager.

Category: LaTeX General | No Comments »

Ubuntu 8.10 “Intrepid Ibex” released

1 November 2008 by Stefan Kottwitz

Ubuntu

On Oct 30 2008 the Ubuntu team announced the release of Ubuntu 8.10 Desktop and Server. You can read about its features in the press release.

To download Ubuntu 8.10, or obtain CDs, see: Get Ubuntu. For instructions on upgrading to Ubuntu 8.10, visit: Upgrading to Ubuntu 8.10.
Upgrades to the latest version of Ubuntu are entirely free of charge as always.

Check out the release notes and look at the new features.

To get more information, visit www.ubuntu.com.

Category: Linux/ Ubuntu Linux | No Comments »

Using \expandafter for macro redefinitions

26 October 2008 by Stefan Kottwitz

Sometimes I want to redefine a macro of a class or package but want to use its original definition. Instead of copy&paste one could use the original macro directly:

  1. come up with a new macro, ensure that it’s not defined yet,
  2. save the definition of the original macro to the new macro,
  3. redefine the original macro using the new macro with the saved original code,

I will give a very simple example for a demonstration. Today a LaTeX Community member said that he’s using the quote environment but wants the enclosed text to have a smaller size. A straightforward solution is to use \renewenvironment copying the original code, let’s say from article.cls, and to make a small modification:

\renewenvironment{quote}
  {\list{}{\rightmargin\leftmargin}%
   \item\relax\small}
  {\endlist}

Just the \small was added. This solution needs the writer to examine the class source, that may also be changed later.

The second solution is the method I’ve described above:

\newcommand*\origquote{}
\let\origquote\quote
\renewcommand*\quote{\origquote\small}

The \newcommand line may be omitted, I’ve just used it to ensure that an error would be raised if a macro with that name was already defined by somehing else.
The last code works like the first solution, but respects the original class code and it will also respect further changes of the class, therefore I’m preferring it.

But the third solution is similar, shorter and doesn’t need the creation of another macro. It’s doing the same job but uses the original macro directly, avoiding a recursion problem by using \expandafter:

\expandafter\def\expandafter\quote\expandafter{\quote\small}

You can find the same method applied in my comment to a previous blog post.

If you want to know how expandafter works you will find explanations in TeX books and documentations. Further there’s an extensive tutorial by Stephan v. Bechtolsheim (TUGboat, Volume 9, 1988), old but still valid of course.

This topic was discussed in the LaTeX Community Forum and on Matheplanet.com.

Category: LaTeX General, plain TeX | No Comments »

Ubuntu 8.10 “Intrepid Ibex” Release Party

24 October 2008 by Stefan Kottwitz

On October 30, 2008 the version 8.10 of Ubuntu Linux will be released. The user group Ubuntu Berlin is inviting to the Intrepid Ibex Release Party:

Intrepid Ibex Release Party Flyer

The party in the c-base Berlin will start on November 1, 2008, 4pm, admission will be free. There will be presentations showing new features of Ubuntu 8.10, its new network management, talks about first steps with Ubuntu and tuning the desktop. Of course I’ll be there too.

If you cannot come to Berlin but want to celebrate the Intrepid release too, have a look at the Intrepid release parties worldwide.

Category: Linux/ Ubuntu Linux | No Comments »

TikZ: chains with labeled edges

19 October 2008 by Stefan Kottwitz

These days I wanted to include some commutative diagrams in a math text. There are already packages designed for this purpose, like amscd and xy-pic. I’ve used xy-pic before and didn’t like its usability and output much. The most recent documents I found on CTAN were dated 1999, many links on its homepage were dead, though xy-pic still works fine today, also with pdflatex. But I decided to use pgf/TikZ now because it can be used to create graphics in many different ways. For instance the beamer class is using pgf already, so why not use it also for math diagrams.

For writing exact sequences the chains library seemed very useful, but I missed the feature to label the edges of a chain. Just arrows weren’t enough, I needed to write maps over, under or just next to it.

I decided to make a workaround by modifying the join method of the chain library. Its syntax is join=with<node> by <options>, I’m changing the syntax to join={node[options] {label}}, this is the code to achieve the effect wanted:

\tikzset{join/.code=\tikzset{after node path={%
\ifx\tikzchainprevious\pgfutil@empty\else(\tikzchainprevious)%
edge[every join]#1(\tikzchaincurrent)\fi}}}

Some general settings before starting the diagrams:

\tikzset{>=stealth',every on chain/.append style={join},
         every join/.style={->}}

Now a long exact sequence can be written for example:

\begin{tikzpicture}[start chain] {
    \node[on chain] {$0$};
    \node[on chain] {$A$} ;
    \node[on chain, join={node[above]
          {$\scriptstyle\varphi$}}] {$B$};
    \node[on chain, join={node[above]
          {$\scriptstyle\psi$}}] {$C$};
    \node[on chain] {$0$}; }
\end{tikzpicture}

Output:

long exact sequence

For more complex diagrams you could use the matrix library to create matrices of math nodes, connecting the nodes by chains. Here’s the code for the Short 5-Lemma as example:

\begin{tikzpicture}
  \matrix (m) [matrix of math nodes, row sep=3em,
    column sep=3em]
    { 0 & A  & B  & C  & 0 \\
      0 & A' & B' & C' & 0 \\ };
  { [start chain] \chainin (m-1-1);
    \chainin (m-1-2);
    { [start branch=A] \chainin (m-2-2)
        [join={node[right] {$\scriptstyle\eta_1$}}];}
    \chainin (m-1-3) [join={node[above]
                      {$\scriptstyle\varphi$}}];
    { [start branch=B] \chainin (m-2-3)
        [join={node[right] {$\scriptstyle\eta_2$}}];}
    \chainin (m-1-4) [join={node[above]
                      {$\scriptstyle\psi$}}];
    { [start branch=C] \chainin (m-2-4)
        [join={node[right] {$\scriptstyle\eta_3$}}];}
    \chainin (m-1-5); }
  { [start chain] \chainin (m-2-1);
    \chainin (m-2-2);
    \chainin (m-2-3) [join={node[above]
                      {$\scriptstyle\varphi'$}}];
    \chainin (m-2-4) [join={node[above]
                      {$\scriptstyle\psi'$}}];
    \chainin (m-2-5); }
\end{tikzpicture}

Output:

long exact sequence

See full LaTeX source code.
During writing of this entry I’ve applied that modification also on CQF.info.

Category: Graphics, Mathematics | 4 Comments »

Vertical alignment of graphics

18 October 2008 by Stefan Kottwitz

If graphics or graphics and text had to be set side-by-side they would often be placed inside minipage environments. This usually works fine if the minipages should be bottom-aligned. A frequently asked question is how to get top alignment, like here on mrunix.de and here on matheplanet.com. A first approach could be to use t as optional positioning argument of the minipage environment. Here’s a compilable example, showing that graphics would stay bottom-aligned that way, used for a fix:

\documentclass{article}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[ht]
  \fbox{\begin{minipage}[t]{150pt}
    \includegraphics[height=100pt,width=150pt]{test}
  \end{minipage}}
  \hfill
  \fbox{\begin{minipage}[t]{150pt}
    \includegraphics[height=60pt,width=150pt]{test}
  \end{minipage}}
\end{figure}
\end{document}

I’ve used \fbox additionally to visualize the minipages. You may notice that it’s compilable even without the image file, that’s achieved by using demo as option for graphicx.

The reason is that \includegraphics sets the baseline to the bottom. A quick fix is just to insert \vspace{0pt} right before each \includegraphics command, this way the reference point will be the top and both images will be placed top-aligned now.

You could use the same approach if you want to place graphics inside \parbox or inside table cells top-aligned.

Category: Graphics | 1 Comment »