This probably is the first time you face LaTeX. Do not worry I am going to introduce you to this realm, so attire for this special occasion
There is a chance that your OS has installed LaTeX, so observe because here is how you are going to trap that:
Do I have LaTeX on my pc?
If you use Linux / iOs just write in the terminal
pdflatex --version
If you have installed any distribution of LaTeX it will appear something like this Remember that the version can change, it depends on when you are reading and doing this
- If you use Windows and you have not installed anything about LaTeX then you do not have anything related to LaTeX on your PC
Note: To create LaTeX documents you need to have installed the compiler, if you just want to try it you can do it online
Overleaf
This is a LaTeX online editor that you can try here Overleaf, you just need to create your account and start editing, you do not need to install anything on your pc
- If you have chosen overleaf instead of installing
Welcome to the virtual world of LaTeX :)
Installing LaTeX
If you already have installed LaTeX you can skip this section :)
Installing the compiler
If you use Linux type the following in the terminal
sudo apt install texlive-latex-extra
If you use Mac go to this link and download MacTeX.pkg and then install it like any other program
If you use Windows go to this link, download the Installer and install it like any other program
Installing the TeX editor
Well, you have installed the compiler, now
where can you write your first document?
I do really suggest you an editor which autocomplete the commands because You are going to save a lot of time, this is, you just are going to write a few letters of the command instead of the entire command and the editor is going to autocomplete the command.
My best suggestion is to install Visual Studio Code
I have tried at least 5 different text editors, the disadvantage of the others is that those do not have the autocompletion for all the commands, just the most common ones, so if you are going to create a new command the editor won't autocomplete that command.
You can download Visual Studio Code in this link you just download it like any other program. Once you downloaded VSCode follow these steps to install the LaTeX extension
- Type
Ctrl + Shift + X
to open the extensions menu, Or you can click there - Search LaTeX and select the LaTeX Workshop extension
- Install the extension by clicking on the blue option install
Congratulations you have set up everything you need to write your first LaTeX document
Writing your first (or second) LaTeX document
I suggest you: Create a unique directory for each LaTeX document because when you compile your document some other files are going to be created so to avoid a mess it is better to create a new directory for that project
- Create a folder anywhere you want
- Create a new file, in VSCode just type
Ctrl + n
- We need that VSCode knows in which language we are typing to turn on the autocomplete option if we do not tell it in which language we are writing VSCode thinks that it is just plain text
- Let's save the file, just type
Ctrl + s
and be sure that you save with a.tex
extension in the directory you created in step 1- Did you notice? There is a new icon in VSCode Yes, this means now you are writing LaTeX
- Let's create the document. LaTeX instruction's indicator is a backslash
\
, just type the following
Congratulations you have typed your first LaTeX document
Compiling your LaTeX document
- Remember that you have edited this document, this is, there is new stuff, you can know that you have edited the document because there is a white dot in the current document
To save the changes just type again
Ctrl + s
If you are using VSCode
There is a green Play icon at the right top
- This icon is only available once you have saved your file, if you do not have the icon, save your file with the .tex extension
When you click on that icon the document will be compiled.
- You can see that it is compiling because at the left bottom there is an indicator of that. We will know that the document is compiled when this icon appears
To visualize your document
- Go to the LaTeX extension that you already installed
- Select the option View LaTeX PDF
- Click on the best option for you.
I suggest you the option View in web browser because if you are surfing the internet, listening to music, or reading something while you are typing LaTeX you will have the LaTeX document in the same place
- Note: That is to visualize the document while you are editing it, so, each time you save the changes you did it will actualize automatically, you do not need to click on the option view document each time you change something.
When you clicked on the green button some files were created in the directory that you just created, to see those just go to that folder, there will be a folder called build
Inside build there will be the files
Bingo! there is the generated file in .pdf
format, do not pay attention to the other files, just focus on the .pdf
file, open it and that is what you just created :)
Please do not cry of happiness
Compiling in terminal
If you do not use VSCode or for any reason you want to compile the code in the terminal
- Open the terminal and go to the directory where your file is, of course, your
.tex
file that you have created- Remember that if you want to compile in the terminal you do not need to have installed VSCode, but you do need to have installed the compiler
- To compile write
pdflatex nameOfYourFile.tex
where nameOfYourFile is the name of your file and do not forget the extension.- This means your file is compiled
- Go to your directory and check that there are new files
Open the .pdf
file, that is what you just created :)
Please do not cry of happiness
That is all mates, if you have any question, suggestion, or something you want to share please comment
Follow me on Twitter
@latexteada
Because sometimes I will be publishing some stuff there
Greetings
Top comments (0)