s i s t e m a o p e r a c i o n a l m a g n u x l i n u x | ~/ · documentação · suporte · sobre |
Next
Previous
Contents
3. TeX commands.Preparing documents for TeX typesetting is easy. Make sure there's a blank line between the paragraphs of a plain text file, and run file through the TeX program with the command tex your_text_fileThe result will be a file of the same base name and the extension .dvi . TeX formats the text in 10-point, Computer Modern
Roman, single-spaced, with justified left and right margins. If you
receive error messages from special characters like dollar signs,
escape them with a backslash character, \ , and run TeX
on the file again. You should be able to process the resulting file
with the .dvi file translator of your choice (see above) to
get printed output.
One peculiarity of TeX input is that you must use opening and closing quotes, which are denoted in the input file with the grave accent and single quote characters. Emacs' TeX mode does this for you automatically. "These are ASCII-type quotes." ``These are `TeX-style' quotes.''
3.1 Command overview.Commands in TeX start with a backslash (``\''). For example, the command to change the spacing between lines is \baselineskip=24pt The baseline is the bottom of the characters on a line, not counting
descenders. The distance between the baseline of one line and the
next is the Measurements or dimensions in TeX are often given in the following units: pt % Point 1/72 in. pc % Pica: 12 pt. in % Inch: 72.27 pt. cm % Centimeter: 2.54 cm = 1 in. mm % Millimeter: 10 mm = 1 cm. Some commands do not take assignments. For example: \smallskip % Approximately 3 pt. \medskip % Two \smallskips. \bigskip % Two \medskips. A \hsize=6.5inThis command sets the line length to a width of 6.5 inches. TeX tries to fill the line by adjusting the spacing between words, and some letters. If TeX cannot fill a line to within its tolerances, it produces a warning message, and adjusts the horizontal spacing within the line as best it can. Formatting tolerances are discussed in Section Tolerances. There are many other commands that specify horizontal and vertical dimensions and tolerances, and the most commonly use commands are described below.
3.2 Font commands.In TeX, the default font is 10 pt. Computer Modern Roman. To specify a typeface, like italic, bold, or monospaced, use the following commands. \rm % Roman (the default). \it % Italics. \bf % Bold. \tt % Monospaced (teletype). \sl % Oblique (slanted).The commands change the typeface where they appear in the text, as in this example. This text is Roman, \it and this text is italic. \bf This text is bold, and \rm this text is in Roman again. To specify a font for your document, use the \font\romantwelve=cmr12This creates the font command \romantwelve , which, when
used in the text, changes the font to Computer Modern Roman, 12 point.
\romantwelve This is the Computer Modern Roman font at 12 points.For information about the fonts in the teTeX distribution look at the file: /usr/lib/teTeX/texmf/doc/fonts/fontname/fontname.dvi If you want to print a sample of a font, TeX the file /usr/lib/teTeX/texmf/tex/plain/base/fontchart.texand fill in the name of the font you want to print at the prompt. You can also change the size of a font to get different effects.
Font magnification is exponential, and specified with the
\font\sfmedium=cmss12 scaled \magstep 1This command will give you a sans serif font that is 120 percent the size of the 12-point Computer Modern sans serif font. Fonts can be magnified in steps from 0 to 5. Each step provides and additional 120 percent magnification.
3.3 Paragraph styles and dimensions.As mentioned above, TeX typesets text in 10-point Computer Modern
Roman by default. The length of a line is the value of
\hsize=5.5in In TeX a dimension is an adjustable unit of length, either
horizontal or vertical. The amount by which a dimension can be
increased or decreased can be specified in its definition. Closely
related to a dimension is a skip, which is a dimension that
is placed in one of TeX's internal registers. Skips are defined with
the \newskip\smallskipamount \smallskipamount=3pt plus 1pt minus 1ptThe \smallskip command is shorthand for:
\vskip\smallskipamount There are a number of dimensions that control the page layout. They are summarized in Section Page layout. TeX formats paragraphs with justified left and right margins. If you want the text to be left justified only, use this command: \raggedright To typeset a line that is justified to the right margin, use the
\rightline{This is the line to be typeset.} The \line{This text will be spaced to fit the entire line.} The \line{\hfilThis line will be right justified.} To typeset a line that is centered, use the \centerline{This is the line to be centered.} To change the left margin, set the value of \hoffset=1.5in The \parindent=.5in Two other dimensions, \leftskip=.5in \rightskip=.5inThe control word \narrower is equivalent to:
\leftskip=\parindent \rightskip=\parindentThat is, \narrower narrows the paragraph margins by the
value of \parindent
As mentioned in the previous section, the \baselineskip=\baselineskip*1.6 The \parskip=\baselineskip
Tolerances. (What are those black rectangles after every line?)TeX normally formats text to strict tolerances. If, for some reason,
text cannot be formatted to within those tolerances, TeX produces a
warning message and formats the text the best it can. If the text
must be stretched too much to fit the line, TeX warns you that the
For each overfull The fit of the text within its specified dimensions is measured by its
badness, which is a number between 0 and 10000. A badness of
0 is a perfect fit, and a badness of 10000 means that the line
probably will never fit. The default value of Sometimes TeX allows a line to extend past the right margin. This is
an aesthetic decision on the part of TeX's author. The amount is
determined by the
3.4 Page layout.In addition to the left margin and line length dimensions that are described in the previous section, TeX also lets you specify top and bottom margins, and vertical spacing. Like the Normally, teTeX places the beginning of the first line of text 1 in. below the top of the paper and 1 in. from the left edge. You can start the text closer to the top of the page with the command: \voffset=-0.5in If you want to add vertical space in a document, the commands
The \vskip 10pt The commands The TeX fills the If you want TeX to be more flexible about its vertical page sizing,
place the
3.5 Page numbers, headers, and footers.teTeX by default places the page number at the bottom center of the
page. If you want to change the location and style of the page
number, you can specify alternate headers and footers by changing
definitions of The \pageno=10 \pageno=-1 The command \headline={\hfil} \footline={\hfil} The default footline also contains the font command
\font\twelvrm=cmr12 \footline={\hss\twelvrm\folio\hss} You can put a rule, a horizontal line, at the top of each
page by redefining \headline={\hrulefill} To specify different headers for even and odd pages use the
\ifodd[condition][true-action]\else[false-actionAn example \headline that uses different headers for
even and odd pages would be:
\headline={\ifodd\pageno odd-page-header \else even-page-header}The \ifodd statement uses the first argument if the page
number is odd, and the second argument otherwise.
3.6 Titles and macros.TeX provides only the The LaTeX chapter and section commands described below add section numbering, and will print the section names and numbers in the page headings, and automatically add the sections to the Table of Contents. In plain TeX, you must write these functions yourself. The
\font\chapterfontsans=cmss12 scaled \magstep 4You can use the \chapterfontsans command anywhere you want
to switch to this font, which is approximately 24 points in height.
However, in this example, it will be used primarily in the command
\chaptertitlesans . Here is its definition:
\def\chaptertitlesans#1{\hbox{}\bigskip\bigskip \noindent{\leftline{\chapterfontsans#1}} \par\bigskip\bigskip\noindent}The first line, \hbox{}\bigskip , anchors a 12-point
space at the top of the page by placing an empty \hbox{}
there. The line with the chapter title is not indented, nor is the
paragraph which immediately follows it. If you place a blank line
between the \sschaptertitle macro and the next
paragraph, the final \noindent applies to the blank
line, not the text of the following paragraph. To format correctly,
use the \sschaptertitle as in this example:
The \chaptertitlesans{Chapter 1} This is the starting text of the first paragraph of the chapter. The paragraph will not be indented. The chapter's title is "Chapter 1."
Next Previous Contents |