Posts Tagged ‘ pdf ’

Precompile pgfplots using tikzexternalize

Using pgfplots allows you to quickly create very beautiful plots, that look like they belong to your paper, by automatically using the correct fonts and styles. It does this by using the latex compiler to make the figures. This approach is very powerful but has a major drawback: the latex compiler was not made to do this. As a result, latex tends to run out of memory very fast, and projects with a lot of pgfplots tend to take a long time to compile.

We’ve previously shown how to increase the amount of memory latex has available, but this only solves half the problem.

A proper way to fix this is using the tikzexternalize command. It causes latex to compile the figures in a separate run, generating pdfs. These pdfs are then included in the main document, reducing both the memory requirements and the compilation time.

Using tikzexternalize is very simple, two step process

  1. Call latex with the “shell-escape” option.
    This looks like this on linux:

    pdflatex -shell-escape mydocument.tex

    The easiest way to do this is to modify the build command of your latex-editor of choice.

  2. Add the following lines of code to your latex preamble


    The first line loads the tikzexternalize library, the second line activates it. The second line also contains an option that specifies the folder where the resulting pdfs and intermediary files should be stored.

Latex will now externalize any tikzpicture you make. You can optionally use


to specify a name for the resulting pdf file. This is strongly recommended, because latex will only recompile a figure if you remove the resulting pdf.

Import latex formulas into inkscape

Getting nice looking formulas in your presentations / posters is always a problem. Latex is great at producing nice looking formulas and text, but for presentations and posters it’s not really equipped.

You could however write your formulas in a latex document, then import the pdf into inkscape and cut out the formulas. Unfortunately, inkscape will insist on treating your formulas as text, and mess them up in the process.
With a minor sidestep to acrobat professional we can get around this in five easy steps:

1. Open the pdf in acrobat professional.
2. Add a watermark using Document -> Watermark -> add. Set its opacity to 0%
3. Open advanced -> Printing Production -> Flattener Preview
4. Check “convert text to paths” and hit apply
5. Save your pdf

The text has now been converted to a vector drawing, and can now be imported into inkscape without problems.
If you don’t add the watermark in acrobat professional, it’ll just ignore the “convert text to paths” option (don’t ask why). This trick can be used to import any fancy formatted text without running into font problems. (You do lose the ability to edit the actual text though)

Enjoy your nicely formatted formulas in your presentations / posters

Mendeley and KDE

Mendeley is a very convenient bibliography tool. It keeps track of all your references, you can easily import from tons of sites and it backs up your collection on their servers. It also works on all major operating systems thanks to the Qt library.

Their latest builds had a bug on KDE systems though: you can’t open a pdf in an external viewer, which is rather annoying because the internal one is rather limited.

Now it appears that you can solve this bug by remove the Qt library files that come with the mendeley installation. Just add .bak to all files that have “Qt” in their name in the mendeley install folder.
Mendeley will now use your systems Qt libraries and “open in external viewer” will work. As an added benefit Mendeley will now also better integrate in your desktop visualy.