Posts Tagged ‘LaTeX’


Install TikZ/PGF and PGFPlots on Ubuntu

In howto on Feb 8, 2016 by theoryl Tagged: , , , , , ,

The installation of TikZ/PGF and PGFPlots on Ubuntu-based distros is mostly straight forward. First, download the latest TDS releases from and They are and at the time of writing. Create the directory ~/texmf if it doesn’t exist. Unzip the zip files into ~/texmf:

unzip -d ~/texmf
unzip -d ~/texmf

That’s it!


Highlight a name in BibTeX Bibliography

In howto on Jan 24, 2016 by theoryl Tagged: , ,

How to highlight a particular author’s name in the bibliography when using BibTeX? This was asked on TeX Stack Exchange. I didn’t like the top answer as much as the third answer. Simply edit the .bst file and add a function that highlights your name:

{ duplicate$ purify$ "YOURNAME" purify$ =
    { bold }

(Here I chose to bold the name)

Then, look for the string “$” in the .bst file, and call the function right after it, e.g.

FUNCTION {format.names}

A related modification you can make in the .bst file is to turn DOI into a hyperlink. Look for the string “doi *”, change it to:

FUNCTION { format.doi } {
        "\href{" doi * "}{DOI: " * doi * "}" *


Font Awesome in pdfTeX

In howto on Jan 15, 2016 by theoryl Tagged: , , , , , , ,

Font Awesome is a font that provides scalable icons that can easily be used in text. It can even be used in TeX!

This is for pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian), which I obtained directly from the Ubuntu 14.04 official repository. The fontawesome package (v3.1.1) in this distribution does not work with pdfLaTeX. (It can only be used with XeLaTeX or LuaLaTeX.) But the latest version of fontawesome (v4.4.0 2015-07-30) includes type1 conversion of the font and is usable with pdfLaTeX. See for more detail.

The zip file available for download from CTAN does not have the correct “TDS” layout though, so it cannot be directly installed. See for detail.

Thus, to really install fontawesome, the following is what I did. First, download the zip file.


Unzip it.


Put the files according to the correct layout (see in the local “texmf” area: ~/texmf/.

mkdir -p ~/texmf/
mkdir -p ~/texmf/doc/fonts/fontawesome/
mkdir -p ~/texmf/fonts/enc/dvips/fontawesome/
mkdir -p ~/texmf/fonts/map/dvips/fontawesome/
mkdir -p ~/texmf/fonts/opentype/public/fontawesome/
mkdir -p ~/texmf/fonts/tfm/public/fontawesome/
mkdir -p ~/texmf/fonts/type1/public/fontawesome/
mkdir -p ~/texmf/tex/latex/fontawesome/

cd fontawesome
mv ~/texmf/doc/fonts/fontawesome/
mv doc/* ~/texmf/doc/fonts/fontawesome/
mv enc/* ~/texmf/fonts/enc/dvips/fontawesome/
mv map/* ~/texmf/fonts/map/dvips/fontawesome/
mv opentype/* ~/texmf/fonts/opentype/public/fontawesome/
mv tfm/* ~/texmf/fonts/tfm/public/fontawesome/
mv type1/* ~/texmf/fonts/type1/public/fontawesome/
mv tex/* ~/texmf/tex/latex/fontawesome/

cd ..
rm -rf fontawesome

Finish the installation. See


Verify that the map file has been registered.


Now, try to pdfLaTeX this guy:



{Normal \faAdjust}
{\Huge Huge \faAdjust}


If pdfLaTeX doesn’t complain, you’re good!


TeX Live 2012 on Linux Mint Maya

In howto on Apr 5, 2014 by theoryl Tagged: , , , , , ,

Ubuntu 12.04 is distributed with a really old version of TeX Live: TeX Live 2009. Fortunately, TeX Live 2012 is available in Ubuntu 12.10 and is backported to 12.04 via a ppa (Thanks!). Since Linux Mint Maya is based on Ubuntu 12.04, it can install the TeX Live version provided by the PPA.

There are numerous answers of how to do that, such as: How do I install the latest TeX Live 2012? (askubuntu), Problems installing TeX Live 2012 on 12.04 (askubuntu), How to remove everything related to TeX Live for fresh install on Ubuntu? (stackexchange)

The following is what I did. If you have never installed TeX before, skip to the next section. Else, let’s uninstall the existing TeX so that you can make a clean installation:

sudo apt-get purge texlive*
# Some of the following might not apply
#sudo rm -rf /usr/local/texlive/2012/
sudo rm -rf /usr/share/texmf/
sudo rm -rf /usr/local/share/texmf/
sudo rm -rf /var/lib/texmf/
sudo rm -rf /var/lib/tex-common/
sudo rm -rf /etc/texmf/
#rm -rf ~/.texlive/
rm -rf ~/.texmf-var/
sudo apt-get purge tex-common
sudo apt-get autoremove
sudo apt-get autoclean

Now add the PPA to you system:

sudo add-apt-repository ppa:texlive-backports/ppa
sudo apt-get update

Now ready to install TeX Live 2012

sudo apt-get install texlive-full

To test whether it’s installed successfully, try calling tex. I got the following prompt:

This is TeX, Version 3.1415926 (TeX Live 2012/Debian)


rst2wiki with math support

In howto on Jul 3, 2012 by theoryl Tagged: , , , , , ,

Another post about reStructuredText: can you convert reStructuredText into Wiki format? I found in Docutils sandbox a tool: rst2wiki. It currently supports conversion to TWiki and Atlassian Confluence. rst2wiki is available through SVN (web-access)

In Docutils >= 0.8, there is “math” support; on the other hand, TWiki can display LaTeX equations if MathModePlugin is installed and set up properly. The syntax is

<latex [attr="value"]* > formula </latex>

In order to use rst2wiki with math support, we will modify In class WikiTranslator, add:

    # Start Math
    def visit_math(self, node):
        if self.math_start:

    def depart_math(self, node):
        if self.math_end:
    # End Math

In class TWikiTranslator, add:

        self.math_start = '<latex>'
        self.math_end = '</latex>'

Done :)


rst2beamer ‘sectnum_depth’ error

In howto on Jun 28, 2012 by theoryl Tagged: , , , ,

I’m using rst2beamer 0.6.6, with Docutils 0.9 and Python 2.6.5 on Ubuntu 10.04. When I tried to call rst2beamer, there is an error/incompatibility with the latex2e writer that comes with Python 2.6:

AttributeError: Values instance has no attribute ‘sectnum_depth’

To debug this, I edited /usr/local/lib/python2.6/dist-packages/rst2beamer-0.6.6-py2.6.egg/ to add sectnum_depth (set as 0) in BEAMER_DEFAULTS. After the changes, my at line 160 looks like:

    'use_latex_toc': True,
    'output_encoding': 'latin-1',
    'documentclass': 'beamer',
    'documentoptions': 't',#text is at the top of each slide rather than centered.  Changing to 'c' centers the text on each slide (vertically)
    'sectnum_depth': 0,

Now rst2beamer works for me.


Spacing between items in itemize

In howto on Apr 19, 2012 by theoryl Tagged: ,

According to, the following allows one to change the vertical spacing between items in the itemize environment: