How to use LaTex(1)

5 (100%) 1 vote

WHAT IS LATEX(1)

LaTex is a widely used tool for scientific documents, like mathematics, computer science, physics and so on. For us students, we may use it when we write some papers.  Latex uses Tex typesetting program for formatting its output, and is itself written in the TeX macro language.

How To Install Latex

Until now, Latex has lots of distributions, like TexLive for three platforms, CTex for windows and MaxTex for Mac. You can choose any distribution you like, just like choosing one distribution of Linux. I will show you the demo with TexLive

Then, choosing an editor. Ctex has a default editor WinEdt, and mac, TexShop. Here I will use TeXworks.

Starting TeXworks

It is quite simple, <Win> + R and enter texworks, and then enter again.

If it doesn’t show up, then you can go to the start menu or the path Tex System installed.

Once you start, you will see something like this.

By default, Texworks will use UTF8 coding. TeXworks provide lots of typesetting tools for us, like pdfTex, pdfLaTex, XeTex and so on. As we are beginners now, we can ignore this, and use pdfLaTex by default.

Try first

hello world!

In the editing area, we enter:

 1 2 3 4 5 \documentclass{article} \begin{document} Hello, world! \end{document}

After compilation, the result is:

It is easy to find that five lines of text entered in the edit box and only 1 lines are displayed in the final output PDF file. Now, let me explain these code.

A control sequence (or a command / tag) is included in the first line of \\documentclass{article} here. The so-called control sequence that begins with a backslash \, a string of text to end the first blank or non alphanumeric characters, they are not output, but they will affect the effect of the output document. The control sequence here is documentclass. The {article} behind it represents a necessary parameter for the control sequence, and the value of the parameter is article. The function of this control sequence is to call a document class named “article”.

Attention: LaTex is case sensitive when we are talking about control sequence.

The second line here begins with%. In the TeX style document, from “%” to the end of the line, all characters at the end of the line will be ignored by the TeX system, only as an annotation for human reading. So if you want print a ‘%’， then you should add a ‘\’, that is ‘\%’.

Then the control sequence begin appeared, and the control sequence always appeared in pairs. The two control sequences and their middle contents are called the “environment”; the first necessary parameters after them are always consistent and are called environmental names.

Only content in the “document” environment can be normally exported to a document or as a control sequence to influence the document. In other words, it is not valid to insert anything after \end{document}.

The part between the \begin{document} and the \documentclass{article} is called the introduction area. The control sequence in the introduction usually affects the entire output document.

Above is the basic information of LaTex.