Tag Archives: LyX

A bug in LyX illustrated (update: it’s a feature)


Update: It’s not a bug, it’s a feature (of LaTeX, not LyX) – see the comments.

So here’s me seeking to use my fantastic art skills once more to illustrate the bare bones of an SMP (symmetrical multiple processor) machine in a slide.

But this is what it ends up looking like…

SMP slideThe text just won’t align with the graphic (both are in minipages inside a minipage).

But if I add just one character (not a space!) above the graphic – it works. Arrgh.

SMP with graphics aligned

How do I do this?


I am preparing a computer science slide presentation and (as I am sane) do not want to use Powerpoint.

So I have been using LyX and the Beamer class.

The slides look great. But how do I add notes?

If I add notes “by hand” e.g. \note{Here is a note} – I see nothing in the PDFs.

And if I use the LyX “Noteitem” I get something like this “Note: Here is a note” on screen, but again nothing in the PDFs.

What am I doing wrong? I have looked at the LyX wiki and it is not illuminating.

Anyone got any thoughts on the LaTeX companion?


Should I shell out £23 for The Latex Companion to ensure I can most effectively write my documents and design my slides for university? I have The LATEX Graphics Companion and there is no doubt it is a good book, but the number of books I could buy increases exponentially the more I think about the work I need to do. So, anyone have any practical experience with the book’s usefulness to a computer science research student with a middling level of LaTeX experience, who is likely to use LyX for a lot of his work?

I bought a book


“Programming Android: Java Programming for the New Generation of Mobile Devices” to be precise.

Now I just have to decide what I want to do with it! I had thought about a LaTeX based application, as both LaTeX and LyX are thinly supported on Android. But that looks very ambitious at the moment.

We’ll see.

GNU source-highlight, another great toy and tool


A Bold GNU Head
Image via Wikipedia

How did I never discover this before – GNU source-highlight, which also has a Qt-based front end.

The one key tip I have if you are using it to generate LaTeX for use with LyX is to make sure you scrub the comment at the top of the output.

LaTeX and O’Reilly


the tarsier featured on the cover of Learning ...
Image via Wikipedia

I have been in touch with Anslem Lingnau, the author of the (German-language) LaTeX Hacks: Tipps und Techniken für professionellen Textsatz – and he tells me that while he would love to see an English translation of his book there seems to be no sign of one forthcoming.

Indeed a quick scan seems to suggest that O’Reilly are not so great at publishing books on LaTeX.

Anslem is also a Scottish country dancing enthusiast of note, if Dashing White Sergeants are your thing…

Smaller PNG graphic files from your LaTeX


I use LaTeX (LyX as the front end) to generate the occasional bits of mathematical script that appear here. Is it bad to admit it gives me a small thrill to see how the LaTex is transformed into something mathematical – makes me feel like a proper scientist/mathematician. Well, I’ve done it now…

WordPress.com will not display postscript natively (or if it can I have never been able to get it to work), so I usually open the .ps files in GIMP and convert them to a PNG – PNGs being optimised to handle things like line drawings and graphical images of text.

The PNGs that come out of this are of a reasonable size but they could be smaller. Some years ago I wrote some Perl code to do that (I needed something that worked in a CGI environment and while Perl is not so fast for even integer maths it was the best option).

That code is available on CPAN as Image::Pngslimmer and on a typical Linux/BSD (OSX too?) install (I am assuming you have perl and the cpan module installed) you should be able to get it on to your box with sudo cpan Image::Pngslimmer – which may ask you a lot of questions before it installs if you have never used CPAN but while YMMV the default answers should probably work.

You can write your own script or just use this quick and dirty one for PNGs of 64K or less:

#!/usr/bin/perl -w
use Image::Pngslimmer();
my $srcfile = shift;
open INF, $srcfile;
binmode INF;
read(INF, $buffer, 65535);
my $blob2 = Image::Pngslimmer::indexcolours($buffer);
my $blob3 = Image::Pngslimmer::discard_noncritical($blob2);
print Image::Pngslimmer::zlibshrink($blob3);

To use this copy the script above into your editor and save it with a name eg shrinker.pl and then execute like this: perl shrinker.pl some.png > smaller.png which will create a new file smaller.png from some.png (which is untouched).

The results can be reasonably impressive. This file – created by cutting from the GIMP – comes in at 14.4KB (NB the graphics you see here are preprocessed by wordpress.com, click on the graphics to see the original):

Proof graphic, uncompressedBut after a bit of processing with the above script, this comes in at 9.7KB:

Compressed proof graphicFinally, please do not say this doesn’t matter because your pipe is so fat. Millions of these things are being pumped through the internet every minute and the collective saving of bandwidth really would matter if we could deliver it…