Useful Latex tricks for Writing Research Papers

In this blog post, I will talk about some useful latex tricks for researchers writing research papers using Latex. This blog post is aimed at those who knows already how to use Latex but maybe do not know these tricks.

1.Reducing the length of your paper with \vspace

A common problem when writing a research paper is that the paper is too long. Besides rewriting the text to make it shorter, a solution is to use some special Latex commands to reduce the space. WARNING: But be aware that it is sometimes forbidden to use these commands, so use them at your own risk!

The main command is \vspace. It allows to reduce the vertical space between elements on a page. For example using \vspace{-0.5cm} before a figure will reduce the space before that figure of 0.5 cm. This is a very useful command. But it is recommended to use it after finishing writing a paper as this command can easily mess up the layout of your paper if the content is then changed.

2. Reducing the length of an algorithm written using algorithm2e

Another way of reducing the space in a paper is to reduce the size of an algorithm. A command that can be used is \scriptsize after \begin{algorithm}. This will reduce the font size of the algorithm and thus the space.

If you are using the algorithm2e package for your algorithms, another way of reducing the length of an algorithm is to use an inline IF instead of a regular IF. This is done by replacing \if{} by \lIf{}. The result is:

This can save a few lines. Similarly, it is possible to replace a \forEach{} loop by the inline version \lForEach{}. Oher algorithm2e commands can also be used as inline such as \else and \lElse.

Another useful command to reduce the size of an algorithm written with algorithm2e is to use \SetAlgoNoEnd after \begin{algorithm}. This will remove the “END” labels for all the IF, ELSE and FOR EACH parts. For example, the below picture show the effect:

3. Check if your paper contains uncited references with \refcheck

If you want to quickly find all the references that are not cited in your paper, you just need to add this: \usepackage{refcheck}. It will higlight the references that are not used from your bibliography. For example:

4. Comparing two versions of your LaTeX document with Latexdiff

Another very useful tool is LatexDiff. Many journals will ask authors to highlight the differences between two versions of their papers. I previously wrote a detailled blog post about using LatexDiff. Please see that blog post for details. The result is like this:


5. Adding TODO notes

Another useful tool is the TODONOTES package. It allows to add TODO comments on a latex document. This works well with the IEEE template. For example, by adding \usepackage{todonotes}, we can add comments in the document such as \todo{Error!} and it will appear like this:

6. Adding color to your Latex document

Another useful package is the color package. It allows to change the color of some part of your document. This can be useful to highlight what remains to be done in your paper or what has should be revised.

7. Converting Latex to HTML

Sometimes, you may want to convert your Latex paper to an HTML document. You may have a look at my previous blog post on this topic to see how to do it with HTLATEX.


In this blog post, I wanted to share a few useful Latex commands. If you think I have missed some other important commands (surely!), please share in the comment section below. I might then add them to the blog post.

Philippe Fournier-Viger is a full professor working in China and founder of the SPMF open source data mining software.

This entry was posted in Latex, Research and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *