Have you finally reached the conclusion of a long course of study and all that’s left is to finalize it by writing your thesis? Or perhaps you have been commissioned to write a report or essay on an experiment and need to write mathematical formulas and bibliography in a clear and orderly manner. In that case, your own professor may have specifically suggested that you draft it using the markup language LaTeX: but how to write in LaTeX?
Don’t worry: this is a perfectly legitimate and understandable question, since this writing system is certainly less common than the “visual” ones we are used to in programs like Word. Nevertheless, it is a widely used system for writing textbooks, articles and theses, especially scientific ones, precisely because of the advantage of being able to report mathematical formulas with dedicated tools.
As I will explain in this guide, writing in LaTeX allows you to worry less about formatting and focus more on the text you are writing. In addition, the texts can be processed immediately in PDF format. Later on I’ll tell you about the basic functions of the system and what are the best computer programs, as well as some excellent applications for smartphones and tablets, that allow you to make texts with this system. Ready to get started? Well, then I wish you good reading and good work!
What is LaTeX and basic formatting
First of all, I’d say to clarify what is meant by the word LaTeX and above all, what exactly it is. Well, LaTeX is a markup (or markup) language created for the preparation of documents that, unlike those created with programs such as Microsoft Word or LibreOffice Writer, uses only plain text (oplain text), that is, in simple bytes.
Unlike most popular text programs that use the “What You See is What You Get” system, which reproduce text on screen as it would appear when printed, the LaTeX system displays only simple alphanumeric characters and basic symbols without any graphical representation.
To write in LaTeX, therefore, textual codes are used which represent text formatting rules according to specific language conventions. By applying these markers, the text formatting rules are established, so that once the text is sent to print or displayed outside the editor, in a special program capable of “translating” the formatting, the text will be perfectly readable and formatted with all formulas and other elements displayed in a clear and readable format for everyone.
If the most common writing programs can be the most practical and direct solution for writing documents, the LaTeX system is often appreciated and preferred for writing, for example, theses or documents containing mathematical formulas. This is because it is a language that allows a precise and uniform formatting of such contents (without risking gross errors or otherwise “ugly” results).
If this is your first experience with LaTeX writing, before I move on to tell you about the programs to use I want to touch on the basic formatting functions.For example, it is critically important to insert these markers at the beginning of each of your documents.
documentclass[a4paper,12pt]{article} begin{document} document text end{document}
The first of these is used to set the page size (A4) and the font size, while the part inside the brackets indicates the type of article: in this case article (also suitable for thesis writing), but you can also set book and report as type.
The begin{document} and end{document} markers delimit the content of the main body of the text, so it is critical that you write your text between these two markers.
Also to give structure to your text, the section{chapter title} marker comes in handy as it creates a new chapter in the text, likewise subsection{paragraph title} adds a paragraph, or subsection a sub paragraph. So, to give an example, the following code.
- section{Method of investigation}.
- subsection{Main Methods}
- subsubection{Description of main methods}
It generates the chapter “Method of investigation”, followed by the paragraph “Main methods” and finally the paragraph “Description of main methods”. The paragraph and subparagraph markers are used in the same way. While in the book and report document type, the chapter{First Chapter} markers can also be used.
Thanks to the pagenumbering{numbering style} marker you can set the page numbering in Arabic or Roman numerals, respectively, like this: pagenumbering{arabic} and pagenumbering{roman}.
Finally, if you wanted to insert a table of contents, you can use this tableofcontents marker which will produce a table of contents of the chapters, paragraphs, subchapters, and subparagraphs you have inserted into the document.
But what are the tags to use, for example, to make bold text? If you’re wondering how to write in bold LaTeX, the marker is textbf{bold text}, so to use like this textbf{Salvatore Aranzulla} to write my name in bold in LaTeX.The same kind of usage applies to how to write in italic LaTeX but using the marker textit{italic text} for example like this textit{lorem ipsum}. Not different in usage is the marker for underlined text, namely underline{underlined text}, to be used for example like this underline{notate well} to underline the words “note well”.
A considerable advantage of the LaTeX writing system, however, is the ability to insert formulas into the text, such as writing equations in LaTeX, or writing matrices in LaTeX.
To do this, it is necessary to use the mathematical mode. Its activation is very simple: just enter the $ symbol in the text followed by the formula. For example $ 2 + 2 = 4*$ will be composed by the LaTeX system with the equation format.
Doubling the $ symbols at the beginning and end of the equation will move the formula to the center, giving it more prominence than the body of the text. If you want to insert more equations you can use the equation sequence function: begin{eqnarray}[insert equations here]end{eqnarray}.
These commands are obviously the simplest ones, for basic LaTeX use, because especially for mathematical functions there are a wide variety of methods. If you would like to learn more about LaTeX and mathematics, my suggestion is to consult the LaTeX Mathematics Wikibook page, since it is a complete source of practical examples on how to write functions in LaTeX and a lot of other information about this language.
Applications for writing in LaTeX
Now that you know what the basic commands are, it’s time to recommend you some of the best programs for writing in LaTeX, so that you can prepare yourself for how to write dissertations in LaTeX or otherwise make any document you need to prepare using this language.
MikTeX (Windows/MacOS/Linux)
To start writing in LaTeX, one of the programs that I feel most comfortable recommending is MiKTeX. Among its advantages there is definitely the compatibility with Windows, macOS and Linux operating systems, plus this program has been optimized for a practical and direct use to the user of the LaTeX system.
MiKTeX is a modern distribution of TeX capable of managing the installation of the components necessary for the operation of the writing system without necessarily installing components superfluous to the user’s use.
To download MiKTeX connect to the download page of the project and click on the logo of the operating system for which you want to download the program and then the Download button.
When the download is complete, to proceed with the installation of the Windows version, double-click on the executable file you just downloaded, check the box I accept the MiKTeX copying conditions, then click on the Next button and do it again for the next three times, then press the Start button.
At the end of the process click the Next button two more times and finally uncheck the Tell me more box and click the Close button. After this step you can move on to using the program.
If you use a Mac, instead, open the .dmg package obtained, click the Agree button and copy the MiKTeX icon to the Applications folder of macOS, then launch the software and answer yes to the warning that appears.
Now, then, what to do to start writing a document in LaTeX? Well, included in the MikTeX console is a simple and handy editor geared towards creating PDF documents with the LaTeX system. It’s called TeXworks and you can start it from the console by clicking on the T icon.
As you can see for yourself, the TeXworks screen is quite basic in that it features a menu bar and a command bar at the top, an empty area in the middle where documents are shown, and finally a status bar at the bottom that informs you about the type of formatting, text encoding, and the position of the cursor (line and column) in the text.
In short, whenever you want to start with the creation of a new text in LaTeX, click the New button (whose icon is a blank white page with a yellow dot in the upper right corner). Then start writing the text following the LaTeX rules and when you’re done, click the green arrow in the upper left corner, i.e. the Compose button to start processing the document and also export it to PDF format.
I suggest you create a folder for each document in LaTeX, because the program creates multiple files for each one. That’s all for the basic operation of TeXworks, you just have to learn more about the markup language and other peculiarities of the LaTeX system to learn how to use it and create all the documents you want.
If instead you’d like to discover other programs, or a way to use this writing system on smartphones and tablets, I invite you to continue reading the next chapters.
Other applications for writing in LaTeX
If the program mentioned above did not fully convince you, you could try other solutions for writing in LaTeX. In general, I still recommend installing the MikTeX console as it is very useful for semi-automatic management of components and updates useful for writing in LaTeX. That said, here are what are some other good programs for producing text in LaTeX.
TeXstudio (Windows/MacOS/Linux) – a program for writing and creating documents in LaTeX created with the purpose of making this writing system accessible and simple. To put this objective into practice, TeXstudio integrates tools such as syntax highlighting (for example, by assigning specific colors to functions scattered throughout the text), auto-completion of text, an integrated viewer, a text control system and some virtual writing assistants.
LyX (Windows/MacOS/Linux) – a program especially appreciated for the attention paid to the interface, designed in a way that reminds of classic text editors like Word, but also for the optimization of useful tools for mathematical formulas. LyX also includes advanced markup for writing texts such as theses, for example, thanks to the bibliography tool.
Texmaker (Windows/MacOS/Linux) – a good software for writing in LaTeX, not surprisingly it has also become one of the most popular. Among its strengths are the very intuitive basic configuration page as well as the integrated grammar checking system. Besides, thanks to the “Structure View” tool, it lets you quickly access the various contents included in the document, divided by category.
App for writing in latex on smartphones and tablets
Maybe you didn’t know it yet, but writing with the LaTeX system from smartphones and tablets is possible. There are a few apps that allow you to write with this system, and while there aren’t a lot of them, there are some that are really complete and have little or nothing to envy to programs installed on computers. Here are the ones I recommend.
VerbTeX (Android/ iOS/iPadOS) – a really comprehensive LaTeX writing app that is rich in features and tools. In addition to the editing and document creation part, it also integrates tools for viewing, editing and managing others already created. Among the most appreciable tools are the PDF file creator (PdfTeX or XeTeX), automatic synchronization with DropBox accounts and the presence of two modes: Local mode and Cloud mode. While the first one lets you work disconnected from the Web and save everything on your device, the other one takes advantage of the cloud technology of various services to let you collaborate simultaneously with multiple users on the same document (like Google Drive or Microsoft 365, for example).
texpad (iOS/iPadOS) – a reference tool for creating LaTeX texts directly from Apple-branded devices. The app includes a syntax-checking tool, an error-reporting system oriented even to less experienced users, and a real-time PDF file rendering tool (during the drafting itself).
Overleaf (Web) – this last tool I’m talking about is actually a service easily accessible from any web browser. So it’s a cloud service accessible from anywhere and on any device (so including smartphones and tablets), complete with every feature for editing in LaTeX, including a collaboration tool and a real-time text preview tool. Registration is required to access the service, and then you can choose your subscription type. A free plan is also available, while paid ones range from 9 euros/month for the Personal profile to 28 euros/month for the Professional one. More details here.
These are the most useful apps and services when it comes to writing LaTeX text from smartphones and tablets. In general, I recommend that you practice as much as possible with this system before deciding whether or not to use it. It’s usually just a matter of habit and time to practice.
How to write in LaTeX on Word
Although the solution of writing in LaTeX on Word is not possible (and practical), there is, however, the possibility of combining the use of the Microsoft text editor with the LaTeX system and inserting mathematical formulas. As I imagine you already know, Word is one of the most traditional tools for writing a thesis, but how do you go about inserting mathematical formulas into LaTeX?
The requirement is that you have a subscription to Microsoft 365, otherwise unfortunately there is currently no feature integrated with other versions of Word.
From the main Microsoft 365 screen, click on the Insert tab, then click on the Equations item and then the Insert New Equation item, then click on the LaTeX button, right next to the Unicode button. Alternatively, you can press the key combination Alt+Shift+[+]+[=].
By doing so, a text box is placed in the body of the text, right where you placed the cursor, where you can write your formula in LaTeX, exactly as I explained in the chapter above. For your convenience, the following image shows the main commands supported.
For example, if you write the following code {{matrix{a&b&cd&e&fg&h&j}} a 3×3 matrix is inserted in the body of the text. But remember that in Word the markers begin{} and end{} are not supported, so you don’t need to use them.
To conclude, I would like to remind you that Microsoft Word allows you to enter formulas even without using the LaTeX system. So, if this way of writing is not for you, I suggest you take a look at my guide on how to write mathematical formulas in Word. Well, all that remains is to wish you good work!