LaTeX input in Inkscape 0.46
July 21st 2008

I use Inkscape to do many of the drawings for my articles and talks, and have come across an irritating problem: I could not include LaTeX formulas on it. I have googled a bit about it, and the first match already led me to a bug report, where a comment by Kees Cook gives a fix that I quote below:

% cd /usr/share/inkscape/extensions
% curl -s 'http://launchpadlibrarian.net/12978623/eqtexsvg.py.patch' | sudo patch -p0

The bug affects (and the patch fixes) Inkscape 0.46 on Ubuntu Hardy Heron and Debian Lenny (that I know of).

Tags: , , , , , , , ,

2 Comments »

Interesting TeX tricks
December 19th 2007

Simply a page with some interesting TeX tricks: volkerschatz.com.

Tags: , , ,

No Comments yet »

LaTeX programming: how to implement conditionals
August 29th 2007

I have recently come across a problem while creating a LaTeX style (for making A0-size posters). Maybe it could be avoided or solved more elegantly, but I wanted to solve it with conditionals.

Basically, what I wanted to do was define a command (actually, an environment) that accepted one argument, and make it return different output, depending on the argument:

if (argument equals something) then
  do something
else
  do somethingelse
end if

It gave me some headaches to get it, but I also learned some interesting things on the way. There are at least two ways of playing with conditionals: defining boolean variables or directly using logical comparisons.

Defining logical valiables

We can define a logical variable logvar as follows:

\newif\iflogvar

By default, it is set to false. We can set it to true by:

\logvartrue

and back to false by:

\logvarfalse

The variable can be used in a conditional as follows:

\iflogvar
  aaaa
\else
  bbbb
\fi

You can think of the above code as a single object, the output value of which will be "aaaa" if logvar is true, and "bbbb" if false. Basically, the following code will, thus, output "Today is great":

Today

\newif\ifismonday

\ismondayfalse

\ifismonday
  sucks!
\else
  is \textbf{great}
\fi

Direct logic comparison

The example I provide works for numbers, but check this page for more info. Recall that LaTeX works with integers (counters) and text strings. As far as I know, floating point operations are impossible in LaTeX (nothing is actually impossible in LaTeX, just veeery difficult).

For example, defining the following command in the preamble:

\newcommand{\isitthree}[1]
{
  \ifnum#1=3
    number #1 is 3
  \else
    number #1 is not 3
  \fi
}

allows us to call it in the document, so the following outputs "We know that number 33 is not 3":

We know that \isitthree{33}

Nesting

Obviously the conditionals can be nested (put one inside another), when more than one condition needs to be tested. For example:

Today

\newif\ifismonday
\newif\ifistuesday

\ismondayfalse
\istuesdaytrue

\ifismonday
  sucks!
\else
  \ifistuesday
    almost sucks.
  \else
    is \textbf{great}
  \fi
\fi
Tags: , , , ,

5 Comments »

PowerDot screen size error in Debian Lenny
July 29th 2007

I use the PowerDot class to make presentations (such as the one in a previous post), and I have come across a nasty problem in the current testing branch of Debian (Lenny). Obviously it is bound to affect any other distro relying on Debian, such as Ubuntu.

The problem is discussed in this thread in freelists.org, and a solution is given by Hendri Adriaens in the tug.org bug page.

In short, when selecting paper=screen paper size in a PowerDot .tex file, the current dvips (version 5.96.1, provided by the package texlive-bin version 2007-12) generates a PostScript file with a wrong paper size. To fix it, you can get the following file:

% wget http://tug.org/svn/texlive/trunk/Master/texmf/dvips/config/config.ps

and put it where the following command tells you:

% kpsewhich --format='dvips config' config.ps

after backing up the old (buggy) one, just in case. For example:

% mv /etc/texmf/dvips/config/config.ps /etc/texmf/dvips/config/config.ps.backup
% mv config.ps /etc/texmf/dvips/config/

This fixes the problem for me.

Tags: , , , ,

No Comments yet »

App of the week: PDF Cube
July 28th 2007

I just found this little app browsing for PDF software in my Debian aptitude repository contents.

In short, PDF Cube displays PDFs in full screen, adding Compiz-like cube transitions from slide to slide if we want. The following YouTube video shows how it works:

[youtube=http://youtube.com/watch?v=AscU72HOwgM]

You can notice the mixed regular/cube transitions, as well as the five zooming options used in slide 4.

By the way, I have started the Wikipedia article for PDF Cube. I think this little program deserves to be in the Wikipedia.

Incidentally, the above is the first video I upload to YouTube! :^)

Tags: , , , , , ,

2 Comments »

LaTeX: the textpos package
May 29th 2007

I have recently discovered a marvelous LaTeX package, namely textpos (PDF manual). My problem was that I wanted to place pieces of text arbitrarily in a page. I had tried tabular environments, a liberal use of \vspace and \hspace, the minipage environment, and even the picture environment. None would do.

However textpos is just what I wanted. The package is loaded with the usual:

\usepackage[options]{textpos}

The options I have used are:

  • absolute - the placing is made with respect to the whole page (stuff me if I understand this)
  • showboxes - draws boxes around the text, so you exactly see what you do (for debugging, of course)

Some variables have to (can) be set, namely the width and height units, for example:

\setlength{\TPHorizModule}{\paperwidth}\setlength{\TPVertModule}{\paperheight}

After that, all the placing specifications can be referred to \TPHorizModule and TPVertModule. A typical use of textpos would be:

\begin{textblock}{width}[xt,yt](X,Y)  the-text-goes-here  \end{textblock}

where width is the desired width of the text box (the height will be enough to place all the text specified), X and Y are the (x,y) placement of the text box, and xt and yt are the point inside the text box which will be placed at (X,Y). All the units refer to \TPHorizModule and TPVertModule. For example:

\begin{textblock}{0.6}[0.5,0.5](0.3,0.4)  hello world\end{textblock}

will print the text "hello world" in a box of width 60% of \TPHorizModule (in my example, this is 60% of the total page width). The center (0.5,0.5) of that box will be placed at a point 30% to the right of the left margin, and 40% below the top margin (in TPxxxModule units).

Tags: , , ,

1 Comment »

Word processors are easy to use
February 18th 2007

Frustrating. Very frustrating.

I am teaching my father how to use OpenOffice.org, as a replacement/reinforcement of a MS Word course he took recently.

My present rant comes from the ubiquitous problem of where some feature of a text piece starts/ends, which is not always obvious. More precisely, I'll refer to itemized/numbered lists and nested lists, like:

* Item 1
  - Subitem 1.1
* Item 2
  - Subitem 2.1
  - Subitem 2.2

After years using LaTeX almost exclusively for document writing, I found it annoying to no end the way in which OpenOffice.org (or any other word processor) handles this kind of things. When I make a list of items, I want the list to be perfectly separated from the surrounding (regular) text, so that I know exactly when I am introducing items in the list, or text before or after the list. I also want to have a logical tree of items and subitems, so I know in every moment at what nesting level I am, and what comes after, or at a lower level than, what.

With LaTeX, this is trivial, as can be seen in the following example:

text before list

\begin{enumerate}

  \item Item 1

  \begin{enumerate}    \item Subitem 2  \end{enumerate}

\end{enumerate}

text after list

I have absolute control about what belongs where. No more fuss about terminating the lists, or about inserting them somewhere, or anything.

On the other hand, word processors provide neither clear separation from the surrounding nor logic for lists. My poor father was struggling to teach the damned program what nest level each entry he wanted it in, how to eliminate the damned dangling "last item", how to add text after a list, but telling the program that it is already out of the list... a nightmare. Yes, some of his problems were probably trivial, but I am the first to admit that I have come across all of them at least once. And some, I never figured out.

Tags: , ,

4 Comments »

TeX capacity exceeded error
November 30th 2006

I am definitely dumb. Well, LaTeX has its part in it, too.

It turns out that all of a sudden, I started having this error when compiling a .tex file:

! TeX capacity exceeded, sorry [input stack size=1500].

After googling for an answer, I found out that the "stack size" limit is defined in the following file:

/usr/share/texmf/web2c/texmf.cnf

However, changing the value made no good: any limit, no matter how large, would be "exceeded". The reason (after a little more hitting my head against the wall) is that there was an infinite loop in the input .tex (maybe \input{file.tex} inside file.tex, or somesuch). 10 hours (well, 5 minutes, actually) of head-banging later, when I was pretty sure no freaking infinite loop was there, I found the answer:

I had deleted the \end{document} tag!!

Now, yes, how stupid am I? And... how stupid is LaTeX to give that silly error, instead of:

TeX warning: You are too dumb, and forgot an \end{document}

Tags: , ,

43 Comments »

Custom style in PowerDot
November 28th 2006

Rembember I mentioned PowerDot for LaTeX? PowerDot is a LaTeX class to produce PowerPoint-like presentations. It creates PDFs that can be read fullscreen with any PDF reader, and turn out to be very nice looking presentations.

I am now fiddling with it, and wanted to do a custom style. I have read the PowerDot Manual[PDF], and it says all you have to do is to copy and rename an existing style, then modify it:

% cd /usr/share/texmf-texlive/tex/latex/powerdot/
% cp powerdot-default.sty powerdot-isilanes.sty
% vi powerdot-isilanes.sty

Then, put style=isilanes in your .tex, et voilĂ !. Well, it fails misserably, saying (among the usual garbage):

! Class powerdot Error: unknown style `isilanes'.

But the .sty is there!

OK, the problem is that LaTeX "doesn't know" you added the style. To remind it, in my Debian Etch box:

% dpkg-reconfigure tetex-base

or, much better (thanks to a comment by bjacquem):

% texhash

This seems to "refresh" the internal LaTeX database, and now it works.

Tags: , , ,

No Comments yet »

LaTeX: PowerDot
September 6th 2006

Tired of hearing that GNU/Linux is good for "technical things", but not for visually appealing matters, such as presentations? Tired of hearing that LaTeX is good for 200-page books full of cross-references, tables and bibliograpy, but not for "other" documents?

Well, next time you can point your ignorant fellow to some LaTeX solutions for making fancy presentations.

You can find some overviews here:

Among the different programs and methods, I'd like to mention the Seminar and Prosper packages for LaTeX. Prosper was written by Timothy van Zandt, and is available as a package for Debian. However, the Prosper package had its capabilities extended by Hendri Adriaens, to create the HA-prosper LaTeX package. Later on, HA-prosper was dropped, and Adriaens and Christopher Ellison commited themselves to the development of PowerDot, a LaTeX class that would supercede both Prosper and HA-Prosper. The PowerDot class (and many others) can be found in the Debian package texlive-latex-recommended.

What Prosper, HA-Prosper and PowerDot do is (since you are using LaTeX) create a DVI, PS or PDF. Usually, your aim will be to create a PDF, since it even allows for fancy slide transitions (an infamous hability of you know who).

Examples of PowerDot presentations (taken from Adriaens' site), can be accessed here: Example 1, Example 2, Example 3.

Actually, I am considering to use PowerDot to make the presentation of my PhD defense... I hope I don't give up and end up using the GUI (and, thus, evil) programs KPresenter or (God forbid) OpenOffice.org.

Tags: , , ,

No Comments yet »

Next »

  • The contents of this blog are under a Creative Commons License.

    Creative Commons License

  • Meta