Mastering LaTeX on Linux without Overleaf

Nicola Landro
4 min readSep 1, 2021

Overleaf is a very useful web server that offer the possibility to share and edit easily the LaTeX project. But sometimes you need to use only your computer and also the conviction that without overleaf you can’t must be destroyed. Also to know better LaTeX is a good motivation.

LaTeX Vs Word like software

If you have no reason to use LaTeX I think that the professional template for thesis or other arguments templates that you can find online or you can create by yourself is better than MS Word alternatives. Also the simplest way to change template is very interesting feature. The possibility to write without think to the pagination is the best feature for my creativity. Also build a Word file full of math formula make it crashes. Word and similar software crash with no possibility to recover files. Make a binary file like .doc an .docx under version control is very bad and you cannot merge difference easily.

Requirements

We can install on latex lib and two ide with different ideas: Latexila(Gnome LaTeX) and Kile.

sudo apt-get install -y latexila texlive-latex-extra texlive-science texlive-lang-italian xreader kile

Compiling LaTeX

To compile you can chose two compilers: latex (cmd: latex file.tex) and pdflatex (cmd: pdflatex file.tex) with a normal file is both good, but pdflatex support more image format and in general compile all the things that I find online.

If you use bibtex (cmd: bibtex file.aux) for bibliography you mast compile many times:

  • pflatex: compile to see all sections but the page of this is unknown so also the index is uncorrect
  • bibtex: update the bibliography that now know the what is cited and when to order correctly the bibliography and remove non cited works
  • pdflatex: add bibliography and other information bibtex
  • pdflatex: fix the page changes after bibliography added

Yes this is old and not so easy but it is better than Microsoft Word.

Shovel python automation

To automatize all things descripted above I use python and a task lib named shovel:

# you must have python on your computer
pip install shovel

Shovel need a file shovel.py

from shovel import task
import os
import subprocess
@task
def install():
"""
This install all latex requirements. Esamples: shovel install
"""
os.system('sudo apt-get install -y latexila texlive-latex-extra texlive-science texlive-lang-italian xreader')
@task
def build(name='template'):
"""
This compile latex code into pdf. Esamples: shovel build
"""
commands = [
['pdflatex', name + '.tex'],
['bibtex',name + '.aux'],
['pdflatex', name + '.tex'],
['pdflatex', name + '.tex']
]
for c in commands:
subprocess.call(c)
@task
def open(name='template.pdf'):
"""
This open pdf. Esamples: shovel open
"""
subprocess.call(['xreader', name])
def remove_all_file_with_extention(ext):
for parent, dirnames, filenames in os.walk('./'):
for fn in filenames:
if fn.lower().endswith(ext):
os.remove(os.path.join(parent, fn))
@task
def clean():
"""
This clean all file create by latex. Esamples: shovel clean
"""
extensions = ['.aux', '.bbl', '.blg', '.idx', '.lof', '.log', '.lot', 'out']
for ext in extensions:
remove_all_file_with_extention(ext)

Put it into your folder with template.tex latex file and now you can exec in that folder (or in general in every folder you have the shovel.py file) this commands:

shovel install # install all lib seen at step requirements
shovel build # build pdf
shovel open # open pdf
shovel clean # remove all generated file excluded the .pdf

Latexila or Gnome LaTeX

To edit simply latex I use Latexila now renamed to Gnome LaTeX is a simply text editor that highlight the instructions and get help to add symbols

I use xreader (shovel open) to show the pdf and manually build sometimes (shovel build). Xreader automatically update the pdf.

kile

If you need something like Overleaf with the compiled pdf you can use Kile

Share work and work together

A good way to work together is to use git and something like github, gitlab, bitbucket etc. to maintain the remote collaboration.

The problem of work in that way is that you cannot see in real time the modification of the other user and you cannot work in real time in different part of the document that can be very useful if you work with other in realtime.

Latex Alternatives

For something like papers or article that will be printed in paper Latex overcome every other alternative, the only one that can be compete is LyX that is a middle way between latex and MS word, but it is not very known.

Slide and presentation: for this aim I prefer to use something like reveal.js that use html as language.

Also InkSlide or Inkscape + Sozi can be used to make better animated and more graphics presentation.

But for soon presentation I use some PowerPoint web application, also because in general the presentation have no problem of too many math formula (that make crash Word) or other problems: any slide should be simply.

Conclusions

Only Overleaf offer you to work in real time with others but if you need to work with others in a classical way or you work alone the presented “offline” methods are perfect for you.

I think that for large document and many other reason the MS Word like programs are very bad but also LaTeX is a very old language. However it remain a better alternatives. I think that it should not be improved because the paper world will be finished soon (or better it will be limited, so no one want to invest time or money for it).

So I’m using LaTeX

--

--

Nicola Landro

Linux user and Open Source fun. Deep learning PhD. , Full stack web developer, Mobile developer, cloud engineer and Musitian.