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…

LaTeX frustration…


Knowledge of German as a foreign language (sec...
Image via Wikipedia

Anyone who works on software development and in the FOSS world generally is used to seeing books and documentation in English. It is certainly a great advantage to be a fluent speaker and reader.

But it is not always the case – as I have just found out.

Right now I have returned to writing my MSc project proposal and that means back to using the power of LyX and LaTeX. But with great power comes great complexity and it can be tough navigating all of this.

So I discovered there is an O’Reilly “Hacks” book for LaTeX – LaTeX Hacks.

Great! I was going to order it without even bothering to read a review, so sure was I that it would be helpful and useful: until I discovered it was in German and there is no sign of an English translation.

To make matters worse, it seems that the O’Reilly quick reference – LaTeX – is also auf Deutsch.

And there is even 100 neue Latex Hacks

This all has an odd, and unsettling feel to it. A century ago German domination of the physical and mathematical sciences was near-complete. Think of 1905 and Einstein just for starters.

But since the tragedy and disaster of Hitler we are used to thinking of the Germans as great engineers but the US clearly as the world’s leading centre of scientific research. And when a threat to that is identified it is usually seen as being from China (as Barack Obama said only a few weeks ago in his state of the union address). But maybe the LaTeX domination of Germany suggests there is life in the old world yet.

Either that or O’Reilly need to pull their fingers out on translating this stuff.

(The graph shows the numbers of people in EU members states who speak German as a foreign or second language: I did a year of it at High School but would not claim to know much beyond some very basic vocabulary and grammar).

If writing the MSc project proposal is this hard…


…what is the project itself going to be like?

I started work last night on writing up a very early draft of my project proposal. For several reasons it was a lot more difficult than I had expected.

Firstly, and typically, I let the technology of the writing tool get in the way of the actual writing. I spent much more time fiddling with LyX and various templates than writing anything. Should I just write plain text in a word processor and then copy that into the LaTeX tool or soldier on with LyX (after all even the project proposal will have to include mathematical notation)?

Secondly, while I hoped to use Christmas, and the time off work, to find the time to work on this, doing without distraction means staying up to 3am as the house is only quiet after 1am or later at Christmas. Not really sustainable.

Thirdly, and this is the most difficult one – all my mental images of what I was going to write – here’s the hypothesis (currently framed as “a more thorough-going application of the working set concept in the Linux kernel will improve performance”) and everything else flows from that, just melted away.

Indeed I am sort of working on the idea that I really need to explain some of the core ideas and then present a hypothesis to be tested.