In the previous article, we talked about how to install and use the MacTeX that supports Chinese in Mac OS X (the author uses 10.10,hackintosh). In fact, MacTeX has been installed by default to support multiple languages, such as Japanese (due to the presence of Ptex, it may be easier to compose Japanese).
In fact, Latex is a Tex-based typesetting system. Tex was just born, and although it can be written out in very beautiful articles, but its code is also very complex, making it difficult for many people to master. As a result, Latex was born. It is based on Tex and greatly simplifies the code by means of a macro package. In this article, we'll simply describe what was produced in the previous article. The code is roughly the following.
\documentclass{article}\usepackage{ctex}\begin{document}hello,\latex! Hello, \latex!. \end{document}
Although this file has less than 10 lines of code, it uses a lot of basic latex functionality. Let's analyze it gradually.
First, the commands in latex typically begin with \ (backslash). The first line of \documentclass{article} indicates that this is a "article" type of article. "Article" is actually the meaning of "article". In other words, this is an ordinary article. In addition to the "article", Latex also offers many article types, such as book, Report, and so on. Try to understand what kind of situations these article classes should be used on your own. The use of "article" is a good choice if there is no special requirement.
The second line of \usepackage{...} is a command that uses a macro package. It can be said that almost all the functions of latex are composed of macro packages. This may seem like a hassle, but we can implement many features by introducing a variety of macro packages. This means that when we write the Latex code, introducing a macro package is an integral part of it. This is similar to the need to add #include <stdio.h> in the C language program. In this example, the macro package name we introduced is Ctex. It provides a Chinese class framework for Latex. Without it, we could not get the results we wanted even if we had tapped into Chinese in Tex files. In addition to this approach, we can also achieve the same purpose by directly invoking the document class provided by Ctex, that is, replacing the contents of the first line with \documentclass{ctexart} . I used to define the article class as "article" and use the macro package.
The third line is blank. The four-line \begin{document} is very obvious, indicating that the article officially began! Everything up to \end{document} After this line is handled by the compiler as the content of the article. The part before this command is called the introduction area. The name is not clear, in short) equivalent to work behind the scenes.
In the section of the article in addition to some ordinary text, but also appeared \latex such a command. As mentioned later, in order to compose articles containing various content, we will often write some commands. Here, this command will output the rugged latex logo. Of course, we can remove the backslash so that the "latex" five letters will be recognized by latex as normal text. Everyone can try. If you omit the blank line from line 6th when you try to edit the article, you will find that the content has been formatted as a line by latex. In fact, the line breaks in Latex are represented by a line of blank lines. This is different from most programming languages that ignore empty rows. Again, the empty line of latex is equivalent to the line break in the actual article. In addition, in Latex, the multiline empty line is understood as a line, that is, no matter how many lines are typed, the actual article will always be the next line.
This is the end of what this article is about to explain. Thanks for reading! In the next article, we'll explain how to knock out mathematical formulas.
Off Topic
On the website, it is often seen that some people casually make latex or Tex into Latex,tex and so on. None of this is true. In fact, the formal way should be a few letters of the ups and downs, as we did in the article we were studying. But on many occasions, this is not easy. So in addition to this approach, Latex is also recognized for this style of play. Latex is attention to detail, people who want to write latex should also pay attention to the details.
Installing using Latex with support in Chinese under MAC (ii)