Mastering LaTeX on Linux without Overleaf
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.
sudo apt-get install -y latexila texlive-latex-extra texlive-science texlive-lang-italian xreader kile
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
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
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:
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:
This clean all file create by latex. Esamples: shovel clean
extensions = ['.aux', '.bbl', '.blg', '.idx', '.lof', '.log', '.lot', 'out']
for ext in extensions:
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.
If you need something like Overleaf with the compiled pdf you can use Kile
Share work and work together
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.
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.
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.
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