Check spelling on multiple LaTeX files using multiple languages

Consider that you have several directories and sub-directories, e.g., the organization of a thesis document in which each chapter has its own directory and several .tex files. And your goal is to check the spelling on all the .tex files in this tree of directories, recursively. Moreover, you want to check the spelling in different languages, some circumstances require that, such as the abstract of the thesis was written in multiple languages. Here is my approach for that, explained step-by-step:

First, in order to check the spelling, we are going to use aspell. Therefore, we rely on its dictionaries, which are packeged on Debian as aspell-[language], e.g., aspell-fr is the package for French dictionary. Install the packages referent to the dictionaries you want. To check which language dictionaries you have installed do:

aspell dump dicts

Then take note of those you gonna use, we gonna need them later on.

Now, back to our .tex spell check. First, lets get the content of all the .tex files, from here on lets consider you are in the root directory of your document’s tree:

find . -name '*.tex' -exec cat {} \;

Second, to spell check the words from text that resulted from the command above using, at the same time, many languages, for example, English from US and Brazilian Portuguese , we use aspell as following:

aspell --lang=en_US -t list | aspell --lang=pt_BR -t list

the -t indicates that we are going to check LaTeX files, i.e., to discard its directives and the list parameter outputs the words that were not found in the dictionary.

A final touch would be write to a file only unique instances of the misspelled words alphabetically sorted, thus the whole command is:

find . -name '*.tex' -exec cat {} \; | aspell --lang=en_US -t list | aspell --lang=pt_BR -t list | sort -u > typo.txt

Now you can proofread the typo.txt file and see if there are problematic words in there.

Installing Latex Packages in Linux

Install LaTeX packages in Linux is quite simple. Lemme say we want to install the package called booktabs. So you have to:

  • Download the .zip
  • Extract its content somewhere (for example ~/booktabs)
  • Enter in /booktabs directory, and generate the .sty file trough the command latex booktabs.ins
  • Copy the just generated file booktabs.sty to /usr/share/texmf-tetex/tex/latex/booktabs (if you are using tetex), or to /usr/share/texmf-texlive/tex/latex/booktabs (if you are using texlive). Probably you have to create the “booktabs” directory.
  • It is necessary to “tell” to LaTeX that you just installed a new package, just enter this command sudo mktexlsr in the console.
  • In your .tex file, just add \usepackage{booktabs}

and voilà.

[Versão em Português]

Simple Beamer’s Theme Modification in Linux

If you have been using beamer, and know how powerfull it is to build slides, I guess you already thinked about how to change some stuff in its themes. Let me give a simple example how to do that. In this example I’m interested in to change the default’s theme color.

First you need to copy the /usr/share/texmf/tex/latex/beamer/themes/theme/beamerthemedefault.sty and paste it and rename to beamerthemeRed.sty. When you open it, there is something like:




In order to create a new theme with a new color, we’re going to change the color theme used in our new Red theme. So, change the \usecolortheme{default} to \usecolortheme{red}. At this point, our beamerthemeRed.sty looks like that:




so we need now to generate the file that will be used by this theme to make everything red. The file is located at /usr/share/texmf/tex/latex/beamer/themes/color directory. So we will copy the beamercolorthemedefault.sty and paste it renamed as beamercolorthemered.sty and its content has something like:

\definecolor{beamer@blendedblue}{rgb}{0.2,0.2,0.7} % use structure theme to change

But now we will change it to the red color

\definecolor{beamer@blendedblue}{rgb}{1.0,0.0,0.0} % use structure theme to change

Now, what you need to do is to use this theme in your presentation, lets do it using the following commands:


Before you compile your presentation, you need to make sure to refresh the Latex packages databases, so this way Latex know that you’ve added a new theme:

sudo mktexlsr

Now, what you need is to compile your presentation and voilà. That is it.


Gedit LaTeX plugin bug: rubber uses deprecated md5 module

This post complements another post that introduces LaTeX plugin for Gedit. It treats a bug found in the first latex compilation after enable Latex Plugin in Gedit on Ubuntu 9.10. The turnaround is as follows:

sudo sed -i "s/import md5/import hashlib/g" /usr/share/rubber/rubber/
sudo sed -i "s/" /usr/share/rubber/rubber/

After it you should restart gedit to apply changes.

See ya

LaTeX Math Formulas Online

In this site you can build LaTeX formulas online and even export them as image. Check out a simple sample: