Git + VS Code + Overleaf
LaTeX is a typesetting system widely used to create technical and scientific documents. This system has many advantages than conventional text editors (like Word, Libre Office, and the other). LaTeX also allows the configuration of personalized themes for presentation and documents.
In other words, the main idea of LaTeX is to make the writer focus on in-text content than it’s formatting (since you already have the model). This is a come in handy for those who create scientific and technical documents! Of course that it’s not limited only to this text type. Some advantages of LaTeX are presented:
1. It’s Free
And that’s it! The main advantage. Haha. I’m kidding. Indeed, it’s not possible to deny that this feature makes it attractive. You can install the LaTeX freely in your computer through by the link below:
LaTeX has support to main Operating Systems: Linux, Windows, and Mac. However, if you don’t want to install it on your computer, there is another way out! You can use an online platform. There is some online platform to create LaTeX documents. The most known is the Overleaf (https://pt.overleaf.com/). I particularly recommend the Overleaf for all new LaTeX users. It’s an excellent platform! Easy to use, and it has many features.
3. High-Quality Documents
This advantage is one of the best! The quality of the document produced by LaTeX is outstanding. The equations, images, tables, and other components are perfectly sharped in the paper (this feature that made LaTeX accession in the academic community).
4. Cite Works is Easily
This is for those who write scientific papers! This problem is typical when you use editors like Word:
"You wrote a long text with several citations. In the end, you send this text for your advisor or for another person to analyze your text. This person required some adjustments in several parts of the text, which cause inclusion and/or exclusion of many citations. Now, you need to verify if all references appear in the text at least once. If it wasn’t, you need to exclude that reference. To make worse: you will need to put order your citations again!"
Yeah, my friends… that’s happened to me frequently. However, LaTeX help me a lot in this work! Actually, it does this job for me. 😬
Well, I imagine the reasons are clear that made LaTeX technology so famous. As I said before, I would suggest you use the Overleaf platform if you wish to start use LaTeX. The most functionalities are free, and I think that paid functions will not be useful initially.
But not everything is a bed of flowers. Overleaf also has disadvantages. One of them is because you need a good internet connection. It doesn’t look a disadvantage for the first time. If you work in an environment with a good internet connection, it’s Ok, there isn’t a problem. But not everyone has this lucky. ☹️
A possible solution for this problem is to use the Visual Studio Code (VS Code) to create the LaTeX documents and synchronized with the Overleaf platform. I will show a little tutorial on how to do this now.
First, you need to install some tools. There are several install options, and each one depends on your OS. The following commands show how to install it in the main operating systems.
- For Linux Ubuntu:
sudo apt update
sudo apt install texlive-full
- For macOS (by HomeBrew):
brew cask install mactex
sudo tlmgr update --self
sudo tlmgr update --all
- For Windows:
Access the following link to download the files:
You also need to install the LaTeX Workshop plugin in VS Code. Go to Extensions in VS Code and type the plugin’s name.
Also, install the GitHub extension for VS Code. You will need it to synchronize the local repository with GitHub.
Now, you are ready! After installing the necessary tools, it’s possible to open and see .tex files. You can see an example following.
To preview, just click on the preview button in the upper right corner of the screen. The compiler is automatic; a new version will appear every time that you save the .tex file (Overleaf have the same pattern).
Your local environment is prepared, and now you must synchronize the GitHub to Overleaf. So we can have the best of both worlds. For this, you’ll use Git and GitHub. I will not explain about Git because you probably know him. I recommend this text About Git if you don’t know about him. You must create a repository in GitHub. If you don’t know about GitHub, see this link.
A little tip: It’s helpful to create a .gitignore file within your repository to avoid sending the various temporary files created during compilation. It’s easy. You just need to create the .gitignore file and list all files that Git should not send to the repository.
An Example of .gitignore file is following:
You already have a repository to manage your LaTeX project. You can synchronize the contents of your project in this repository when you need it.
Now there is little to interconnect everything! Connect your GitHub repository to Overleaf: Go to the Overleaf, click in New Project ⇨ Import from GitHub. Next, you’ll choose which project do you want to import.
The Overleaf will automatically open the project. Remember: every time you modify the project, you must synchronize the content with GitHub. To synchronize, you must click in Menu ⇨ GitHub ⇨ Push Overleaf Changes on Github, as shown in the following Figure.
Everything are integrated: GitHub + Overleaf + VS Code. At this moment, it’s possible to do any one of these options: use the Overleaf and synchronize the contents in GitHub after or use the VS Code to make your document and synchronize the contents in GitHub after.
You must be wondering: Am I really need to do this?
The answer: It depends!
If you are not concerned about internet connection and do not want to use a native editor to make the manuscripts in LaTeX, just use Overleaf. After all, this platform is complete and already provides you with everything to develop your LaTeX projects. One disadvantage when using VS Code for LaTeX projects is that you will have to install packages via the command line.
Well, this is it. I hope you enjoyed this tip.
These are my references. I suggest to read them; they are really good.