How to write in LaTeX

Have you finally come to the end of a long course of study and you just have to finalize it with the writing of your thesis? Or maybe 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 way. If so, your own professor may have specifically suggested that you write it all using the markup language Latex: Ma how to write in LaTeX?




Don't worry: it is a completely legitimate and understandable question, given that 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 for 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 to focus more on the text to be written. Furthermore, the texts can be immediately processed in PDF format. Later I will tell you about the basic functions of the system and which are the best computer programs, as well as some excellent applications for smartphones and tablets, which allow you to make texts with this system. Ready to get started? Well then I wish you good reading and good work!

Index

What is LaTeX and basic formatting

How to write in LaTeX


First of all I would say to clarify what is meant by the word Latex and above all, what exactly it is. Well, LaTeX is a markup (or marking) language created for the preparation of documents which, unlike those created with programs such as Microsoft Word or LibreOffice Writer, uses only plain text (oplain text), i.e. in simple bytes.



Unlike the most popular text programs that use the "What You See is What You Get" system, which reproduce the text on the screen as it would appear once printed, the LaTeX system shows only simple alphanumeric characters and basic symbols without any representation. graphics.

To write in LaTeX, therefore, textual codes are used which represent rules for formatting the text according to specific conventions language. By placing these markers, the rules for formatting the text are established, so once 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 the formulas and other elements displayed in a clear and readable format for all.

If the most common writing programs can represent the most practical and direct solution for drafting 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 in any case "bad" results to see).

How to write in LaTeX

If this is your first experience with LaTeX writing, before moving on to talk about the programs to use I want to focus on the basic formatting functions.For example, it is of fundamental importance to insert these markers at the beginning of each of your documents.



documentclass[a4paper,12pt]{article}
begin {document}
text of the document
end {document}

The first of these is used to set the page format (A4) and the size of the characters, while the part inside the brace indicates the type of article: in this case article (also suitable for writing a thesis), but you can also set book e report as a typology.



The begin {document} and end {document} markers delimit the content of the main body of the text, so it is essential that you write your text between these two markers.

Again to give a structure to your text, the section {chapter title} marker is certainly useful as it is used to create a new chapter in the text, in the same way subsection {paragraph title} adds a paragraph, or subsubsection a sub paragraph. So, as an example, the following code.

  • section {Method of investigation}
  • subsection {Main methods}
  • subsubection {Description of main methods}

Generates the chapter "Survey method", followed by the paragraph "Main methods" and finally the paragraph "Description of the main methods". The paragraph tag and the subparagraph tag are used in the same way. While in the type of document book e report 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, as follows: pagenumbering {arabic} and pagenumbering {roman}.

Finally, if you want to insert an index, you can use this tableofcontenents marker which will produce an index of the chapters, paragraphs, sub-chapters and sub-paragraphs that you have inserted in the document at the point where you find it.


But what are the tags to use for example, to make the bold? If you are wondering how to bold LaTeX, the marker is textbf {bold text}, so to use this way textbf {Salvatore} to write my name in bold in LaTeX. The same type of usage applies to how to italicize LaTeX but using the marker textit {italicized text} for example like this textit {lorem ipsum}. The use of the marker for the text does not differ stressed, or underline {underlined text}, to be used for example underline {nota bene} to underline the words "nota bene".


A considerable advantage of the LaTeX writing system, however, is the possibility of inserting formulas in the text, how to write equations in LaTeX, or how to write arrays in LaTeX.


To proceed in this sense, you must use the math mode. Its activation is very simple: just insert 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.

How to write in LaTeX

Doubling the symbols $ at the beginning and end of the equation, the formula will be moved to the center, making it more prominent than the body of the text. If you want to insert more equations you can use the function of sequence of equations: begin {eqnarray} [insert equations here] end {eqnarray}.

These commands are obviously the simplest ones, for a basic use of LaTeX, because especially for mathematical functions there are a great variety of methods. If you want to learn more about LaTeX and mathematics, my suggestion is to consult the Wikibook LaTeX Mathematics page, as it is a complete source of practical examples on how to write functions in LaTeX and many other information on this language.

Applications for writing in LaTeX

Now that you know what the basic commands are, it's time to recommend some of the best programs for writing in LaTeX, so that you can prepare yourself for how to write thesis in LaTeX or in any case to create any document you need to prepare using this language.

MikTeX (Windows/macOS/Linux)

How to write in LaTeX

To start writing in LaTeX, one of the programs that I most recommend is MiKTeX. Among its advantages there is certainly the compatibility with Windows, macOS and Linux operating systems, moreover this program has been optimized for a practical and direct use of the LaTeX system to the user.

MiKTeX is a modern TeX distribution able to manage the installation of the components necessary for the functioning of the writing system without necessarily installing unnecessary components compared to the use made by the user.

To download MiKTeX connected 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, subsequently, on the button Download.

Once the download is complete, to proceed with the installation of the version Windows, double-click the executable file just downloaded, check the box I accept the MiKTeX copying conditions, then click on the button NEXT and do it again for the next three times, then press the button Start.

At the end of the process click on the button NEXT for two more consecutive times and to conclude uncheck the Tell me more box and click the button Close. After this step, you can move on to using the program.

If you use a MacInstead, open the package .dmg obtained, click on the button Agree and copy the icon of MiKTeX in the folder Applications macOS, then start the software and answer affirmatively to the warning that appears.

So now, what to do to start writing a document in LaTeX? Well, in the MikTeX console a simple and practical editor is included, oriented to the creation of PDF documents with LaTeX system. Is called TeXworks and you can start it from the console by clicking on the icon depicting a letter T.

As you can see for yourself, the TeXworks screen is quite elementary as it is characterized by a menu bar and one of the commands at the top, an empty area in the center where the documents are shown and finally a status bar at the bottom that informs on the type of formatting, the encoding of the text and the position of the cursor (line and column) in the text.

How to write in LaTeX

In short, whenever you want to start creating a new text in LaTeX, click on the button New (whose icon is a blank white page with a yellow dot at the top right). Then start writing the text following the LaTeX rules and when you are done, click on the green arrow at the top left, that is the key Composition so as to start processing the document and export it also in PDF format.

I suggest you create a folder for each document in LaTeX, this is because more files are created for each one by the program. This is all for the basic functioning of TeXworks, you just have to deepen the language in markup and other peculiarities of the LaTeX system to get familiar with its use and create all the documents you want.

If, on the other hand, you would 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

How to write in LaTeX

If the program mentioned above didn't fully convince you, you could try other solutions to write 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 some other good programs for producing text in LaTeX.

  • TeXstudio (Windows / macOS / Linux) - a program for writing and creating documents in LaTeX born with the aim of making this writing system accessible and simple. To put this goal into practice, TeXstudio integrates tools such as syntax highlighting (for example by assigning specific colors to functions scattered throughout the text), text auto-completion, an integrated viewer, a text control system and some virtual assistants to the writing.
  • Luxury (Windows / macOS / Linux) - a program particularly appreciated for the attention placed on the interface, designed to remember the classic text editors such as Word, but also for the optimization of useful tools for mathematical formulas. LyX also includes advanced markers for writing texts such as theses, for example thanks to the appropriate bibliography tool.
  • texmaker (Windows / macOS / Linux) - a valid software for writing in LaTeX, it is no coincidence that it has also become one of the most popular. Its strong points include the very intuitive basic configuration page, as well as the integrated grammar check system. Moreover, thanks to the “Structure View” tool, it allows quick access to the various contents included in the document, divided by category.

App for writing in latex on smartphones and tablets

How to write in LaTeX

Maybe you didn't know it yet, but writing with the LaTeX system from smartphones and tablets is possible. There are some apps that allow you to write with this system and although they are not many, there are really complete ones and with little or nothing to envy to programs that can be installed on computers. Here are which ones I recommend.

  • VerbTeX (Android / iOS / iPadOS) - A truly comprehensive LaTeX writing app full of features and tools. In addition to the editing and creation of documents, it also integrates tools for viewing, editing and managing other already created ones. Among the most appreciable tools there is the PDF file creator (PdfTeX or XeTeX), automatic synchronization with DropBox account and the presence of two modes: Local mode and Cloud mode. While the first allows you to work disconnected from the web and save everything on your device, the other takes advantage of the cloud technology of various services to also allow multiple users to collaborate on the same documents at the same time (like Google Drive or Microsoft 365 for be clear).
  • texpad (iOS / iPadOS) - a reference tool for creating text in LaTeX directly from Apple-branded devices. The app includes a checking tool that highlights the syntax, an error reporting system geared even to less experienced users and a tool for rendering the file to PDF in real time (during the drafting itself).
  • Overleaf (Web) - this last tool I am talking about is actually a service easily accessible from any web browser. It is therefore a cloud service accessible from any place and device (including smartphones and tablets), complete with every function for editing in LaTeX, including a collaboration tool and a real-time text preview tool. To access the service you need to register, and then choose the type of subscription. The free plan is also available, while the 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 to use it or not. It is usually just a matter of getting used to and taking the time to practice.

How to write in LaTeX on Word

How to write in LaTeX

Although the solution of write in LaTeX on Word it is not possible (and practical), but there is 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 to insert mathematical formulas in LaTeX?

The requirement is that you have subscribed to Microsoft 365, otherwise unfortunately there is currently no integrated function with other versions of Word.

From the Microsoft 365 home screen, click on the tab Inserisci, then click on the item Equations and then on the voice Insert new equation, then click on the button Latex, right next to that Unicode. Alternatively, you can press the key combination Alt+Shift+[+]+[=].

Doing so is placed in the body of the text, right where you placed the cursor a text box where you can write your formula in LaTeX, exactly as I explained to you in the chapter above. For convenience, I report the main supported commands in the following image.

How to write in LaTeX

For example, if you write the following code {matrix {a & b & c d & e & f g & h & j}} a 3 × 3 matrix is ​​inserted into the body of the text. However, remember that the begin {} and end {} markers are not supported in Word, so you don't need to use them.

Finally, I remind you that Microsoft Word allows you to enter formulas even without resorting to the LaTeX system. So, if just this way of writing is not for you, I suggest you read my guide on how to write math formulas in Word. Well, I just have to wish you good work!

add a comment of How to write in LaTeX
Comment sent successfully! We will review it in the next few hours.