is usually pretty good at figuring out the spacing between words. However, there are some special cases where you must help.
After Punctuation: The command (where represents a space) produces normal interword spacing, and indicates normal intersentence spacing. always assumes that . ends a sentence unless it immediately follows an uppercase letter. In this case, assumes that the period is part of an abbreviation and not a sentence ending. Here are some examples.
Extra Space: The command , is used to provide a small extra space where would not normally put one, for example, to separate adjacent quotation marks. A special spacing command / is used to insert extra space between italics and roman characters and does nothing if it follows a roman letter. Here are some examples.
Lock Space: Normally a space indicates a separation between words and is a place where may break a line. However, sometimes you may wish to prevent a space being used as a line break. To avoid a bad line break, simply “lock” the two words together with ˜ as in D.˜Knuth or Fig.˜3. Notice that the lock space character ˜ also prevents the . in Fig. being treated as the end of a sentence.
To make break a line of text use the
ewline
command or its shorthand equivalent \. The resulting broken line will be left justified, leaving a ragged right. The \* form of the line break command inhibits page breaking between the broken line and the following line. Both the \ and \* commands take an optional argument to increase (or decrease) the normal interline spacing following a broken line. Thus \[.25in] inserts a quarter-inch vertical space after the forced line break.
is very fussy about breaking lines. For an overfilled line, you can suggest where a line break should be (while still maintaining right justification) by placing linebreak[n]
at the desired break point. The integer n is in the range from 1 to 4, 1 being the mildest suggestion to and 4 being compulsory. Similarly, the
olinebreak[n]
inhibits a line break.
When many bad line breaks occur (for example, after turning off hyphenation in a narrow column of text), invoking the sloppy
command will allow to use more interword space to avoid bad line breaks. The command fussy
returns to its normal word spacing standards.
Typeset documents should be single spaced. However, extra space between text lines is sometimes needed, such as in draft manuscripts or to meet requirements imposed by others. The line spacing for a document is, by default, single space. To change to space and a half, for example, include the following line in the document preamble.
enewcommand{aselinestretch}{l. 5}
Sometimes in a nonsingle-spaced document, you will want to return temporarily to single spacing (for example, for quoted material or captions in figures and tables). To do this while maintaining the same font size (here
ormalsize
), insert the following line just before the portion of the text that you want to be put into single space
enewcommand{aselinestretch}{l} iny ormalsize
To return to space and a half, set the aselinestretch
to a value of 1.5 using the previous construction. The double change of font size is needed to force to make the line spacing change even though the size of the font is not being changed.
If you are going to switch frequently between single space and space and a half, place the following two macros in the preamble of your document.
ewcommand{DS}{
enewcommand{aselinestretch}{l. 5}
iny
ormalsize }
ewcommand{SS}{
enewcommand{aselinestretch}{l}
iny
ormalsize }
The new command DS
will then cause the current paragraph and all subsequent text output to have space and a half line spacing. The command SS
likewise will cause to begin using single line spacing.
To force a footnote to have single spacing in a double-spaced document, you do not need the double font-size change since the footnote automatically undergoes a font-size change. Thus, you can enter
he saw an elephant%
enewcommand{aselinestretch}{l}footnote{a rather large
mammal}
enewcommand{aselinestretch}{2}
and many gnus during his travels.
Again a simple macro can make this awkward construction much easier. In the preamble, define the following new command.
ewcommand{SSfootnote}[1]{
enewcommand{aselinestretch}{1}%
footnote{#1}
enewcommand{aselinestretch}{2}}
Then the above example could be written more easily as
he saw an elephantSSfootnote{a rather large mammal} and many …
by default uses right justification and automatic word hyphenation to produce good line breaks for a paragraph. On rare occasions you may have to intervene and help with the hyphenation. Here are some tricks.
Although almost never hyphenates incorrectly, it does sometimes miss spots in a word where a hyphen could go. This is particularly true of foreign words. You can suggest hyphenation points in such a word by using - in the word, for example, brems -strahl-ung
. If troublesome words are to be used often in a document, you can tell their hyphenation for every occurrence with the hyphenation
command. For example, to tell the hyphenation of the words “bremsstrahlung” and “phlogiston,” put the following statement in the preamble:
hyphenation{brems-strahl-ung phlo-gis-ton}
If you encounter a hyphenated word such as “radiation-induced” and you want to break the line at the hyphen, do not use --
since this will give you two hyphens. The trick is to specify
adiation-linebreak[1]induced
.
To prevent from hyphenating a particular word at a line break, place the word in an mbox{}
, for example mbox{bremsstrahlung}
.
Sometimes you may wish to avoid hyphenating words at the end of all lines. One method to turn off hyphenation while preserving right justification is to set the hyphenation penalties to very large values by placing in the preamble
hyphenpenalty=10000 exhyphenpenalty=10000
Although this approach will usually produce right-justified lines, some lines may become too long because of large words near the line breaks. These bad line breaks can be ameliorated somewhat by issuing the sloppy
command to allow to use more than the normal interword spacing.
Normally a typeset document should have the lines right justified. This is the default for . However, there may be reasons you want to avoid right justification.
Occasionally, you may want to turn off both the hyphenation for a document (or part of a document) and also the right justification of the lines. For example, some journals actually require manuscripts to have this format. To do this in , embed the text in the flushleft
environment, that is, between the commands egin{flushleft} … end{flushleft}
. This will turn off hyphenation and produce lines with ragged right margins as in this paragraph. Also this procedure appears to set the parindent
to zero, but you may reset it with setlength{parindent}{.25in}
.
Some manuscripts are required by publishers to use ragged-right justification but also to use some hyphenation to avoid inordinately short lines. Here is a macro for that allows you to adjust the degree of raggedness and hyphenation. It even works when the font size is substantially changed.
To use this line formatting style, place this macro in a style file for your document (see Section 7.3), or, equivalently, place this macro in your document preamble between the makeatletter
and makeatother
commands. Then place the command
aggedright
after the egin{document}
statement. If you want to restrict
aggedright
to only a portion of your document, place that portion with the declaration
aggedright
inside a minipage
environment.
Sectioning commands, i.e., part
, chapter
, section
, subsection
, subsub-section
, paragraph
, and subparagraph
, are used to produce titles for the various parts of a document. These commands generally produce a title with the appropriate number as a prefix, make an entry in the table of contents, and also take an optional argument for the table of contents entry if different from the section title. The general form is
section[table-of-contents entry] {heading for text}
automatically numbers section titles down to some specified level of sectioning below which no numbers are affixed to the title. Parts are level -1 (0 for article style); chapters, level 0; sections, level 1; subsections, level 2; and so on. Section numbers are generated down to a level determined by the counter secnumdepth whose default value is 2 (3 for article style). Thus, to number only chapters and sections (that is, down to section depth 1), put the following statement in the document preamble.
setcounter{secnumdepth}{1}
To produce a title without any numbers, incrementing of counters, or an entry in the table of contents, use the form
section*{heading for section}
If you give a long section title, will try to break it into multiple lines using hyphenation and right justification. You can force breaks in the heading by using protect
ewline
. For example, the preceding heading was produced by
subsection[Breaking a Long Heading]{Breaking a Long Heading
Where You Want protect
ewline The Heading Broken}
Generally, underlining is not used in a typeset document; however, for those occasions when underlining is necessary care must be taken. For example, the input
underline{Here is a test.} underline{Here is a good test.}
produces Here is a test. Here is a good test.
This ugly result arises because the argument of the second underline
has a descender (the g) and the first doesn’t. Hence the second underline will be lower. You can make all the underlines act as if they had descenders by inserting a strut
command. The above example can be fixed by writing
underline{strut Here is a test.}
underline{strut Here is a good test.}
to give Here is a test. Here is a good test.
Techniques for underlining and striking through large portions of the text can be done better with a macro given in Section 9.2.2.
To move a block of text (for example, a list) down (or up) the page, use the vspace{dist}
command, where positive (or negative) dist is the amount of vertical movement desired, for example, .2in
or -3cm. Thus to squeeze more onto a page, you could reduce the amount of vertical space between a section heading and the first paragraph by placing vspace{-.1in}
before the paragraph. To make a vertical space at the top of a page, use the vspace*{dist}
form of the command, since vspace
without the * is ignored at the top of a page.
Horizontal movement on a line is controlled with the hspace{dist}
command, where positive (negative) dist is the amount of right (left) shifting desired. At the beginning of a line, use hspace*{dist}
.
Another useful trick for controlling horizontal spacing is provided by the “rubber length” fill
, which expands to fill all remaining space on a line. The first line of this paragraph is produced by
oindent Another useful trick hspace{fill} for
controlling horizontal\space is provided by the…
A short form of the hspace{fill}
command is hfill
. Often, when gives a warning of an underfilled hbox
on some page, the warning can be avoided by using an hfill
command to fill up the offending line. Similarly, vspace{fill}
, or its equivalent vfill
, is used to expand vertical space on a page.
The hfill
command is also very useful for producing three-part headers, such as
Left Title CENTER TITLE Right Title
This was produced with
{f Left Title} hfill {Large CENTER TITLE} hfill {f Right Title}
Also commands dotfill
and hrulefill
fill the stretchable space with dots or a rule. For example,
{f Left Part of Text} dotfill {f Right Part of Text}
{f Left Part of Text} hrulefill {f Right Part of Text}
produces
Left Part of Text ........................................................... Right Part of Text
Left Part of Text Right Part of Text
In many instances, you will want to constrain text to a block. has the following two commands:
parbox[position]{width}{text string}
egin{minipage}[position]{width} … end{minipage}
The parbox
command is only for simple text (no commands
), whereas the more robust minipage environment allows commands to be included. The optional vertical placement parameter position is omitted if the box is to be centered vertically with the line, or use t (b) for top (bottom) alignment with the line.
Text (or a block of text in a parbox
) can be put into a ruled or unruled box with the commands
makebox[width] [position]{text string}
framebox[width] [position] {text string}
aisebox{upshift}[boxheight][boxdepth]{text string}
In the makebox
and framebox
(or fbox
for short) the position parameter is omitted for centering the contents in the box or specified as 1
(r
) for left (right) justification. In the
aisebox
command, the optional parameters boxheight and boxdepth are the height and depth of the box above and below the baseline of text, while upshift is the upward displacement of the text (positive or negative).
For example, text can or or raised or lowered with the statements
even be
put into
a box
For example, parbox[t]{.5in}{text can even be put into a box}
or framebox{parbox[t]{0.9in}{into a box with a frame}} or
aisebox{.4ex}{em raised} or
aisebox{-.6ex}{em lowered} with the statements
To adjust the separation between the frame and a box’s contents, change the fbox
parameter, for example, setlength{fboxsep}{.3in}
. The rule width can also be altered with, for example, setlength{f boxrule}{3pt}
.
One difficulty with using a parbox
is that its horizontal placement must be obtained by trial and error. Only if the line is blank to the left of the parbox
is it possible to specify the absolute position of the right or left margin.
This small block of text is right justified on the page with a width of 3 inches on a page with a normal text width of 6 inches. This format is useful, for example, if you want to leave a space for a small paste-in figure.
This structure was produced by
hspace{fill} parbox{3in}{This small block of text …
Sometimes you will not know how wide to make a box. Here is an example that uses the
ightline
command to right justify a block of text so that the longest line is placed adjacent to the right margin
Prof. Tom Thumb
Dept. of Milli Engineering
Micro State University
NanoCity, PicoState 66502
This was produced with
Hanging Indent: Sometimes you may want to create a labeled paragraph like this that has a hanging indent of arbitrary length. This cannot be done with the parbox
command since you do not know a priori the width of the paragraph to be set after the hanging indent. Rather you must use a solution and define a macro for such a paragraph.
The Method: To create paragraphs like these, place lethangafterhangfrom
in your style file (or between makeatletter
and makeatother
in your document’s preamble). Then, to create a paragraph like the first one in this section, use
hangafter{Hanging Indent: }Sometimes you may want to …
An alternative to the use of parbox
to redefine the left and right margins for the text is to use the list environment to customize how the blocks of text should be placed on the page. This can be accomplished most easily by defining a new environment (such as that below for indenting text) in the preamble of your document.
ewenvironment{inmargins}[1]{egin{list}{}{
leftmargin=#l
ightmargin=#l parsep=0pt
partopsep=Opt}item[]}end{list}}
This environment can be invoked whenever you wish to move both the left and the right margins in from their normal values for an entire paragraph. Simply put the desired text between egin{inmargins{indent}
and end{inmargins}
, where indent is the desired left and right margin indentations. This technique is preferable to using a parbox
since commands can now be embedded in the text.
This is an example paragraph that has been indented with the used of the inmargins environment. It is produced by
egin{inmargins}{1.00in}
This is an example paragraph that has been indented …
end{inmargins}
Section 9.2.6 provides a more complex macro that allows independent right and left margin indentation, as well as nesting of the indentation environments.
Blocks of text (and entities such as tables and figures) are easily centered horizontally on a page with the egin{center} . . . end{center}
commands. Here is an example:
This is a small box
of text that is centered.
These centering commands can be used in most environments.
Blocks of text (and entities such as tables and figures) are easily centered horizontally on a page with the verb|egin{center}| verb| … | verb|end{center}| commands. Here is an example : egin{center}
parbox{lin}{This is a small
box of text that is
centered.}
end{center}
These centering commands can be used in most environments.
A box of text (or any other entity) with the following construct.
ewpage
vspace*{fill}
.... text or item to be vertically centered ...
vspace{fill}
ewpage
In many documents, you will want to present a list of indented or itemized sentences or phrases. provides the following three environments for making lists. These environments can be nested inside each other.
The itemize
environment is used to make a list with each item set off by a bullet (or other symbol for an inner-nested itemize
environment).
Here is an “itemized” list with another embedded one.
— The’item’ command
— The’end’ command
Here is an ”itemized” list with another embedded one. egin{itemize}
item Itemized lists are handy
for listing key points
item However, don’t forget:
egin{itemize}
item The ’item’ command
item The ’end’ command
end{itemize}
end{itemize}
The symbols that begin each item in the itemize environment are controlled by four parameters: labelitemi, labelitemii, labelitemiii
, and labelitemiv
. Thus, to change the default bullet to a right arrow for the first level of itemization, put in the preamble
enewcommand{labelitemi}{$ ightarrow$} °/, first level
Similarly, for higher levels of itemization,
enewcommand{labelitemii}{$aast$} % second level
enewcommand{labelitemiii}{$Box$} % third level
enewcommand{labelitemivH$
hd$} % fourth level
Nested list environments and boxes can be combined to produced customized lists. Here is a two-column itemized list nested within another itemized list.
• |
Item 1 |
|
|
- Subitem 1 |
description of subitem 1-1 |
|
- Subitem 2 |
description of subitem 1-2 |
• |
Item 2 |
|
|
- Subitem 1 |
description of subitem 2-1 which is a long subitem extending over several lines to test the indentation |
|
- Subitem 2 |
description of subitem 2-2 |
This example was produced with the following input. Note especially the parbox
used to keep the long description of subitem 2-1 within column 2. Also this parbox
has to be followed by vspace{2itemsep}
to produce the correct vertical spacing before the next subitem.
egin{itemize}
item Item 1
egin{itemize}
item makebox[1.3in] [1] {Subitem 1} description of subitem 1-1
item makebox[1.3in] [l]{Subitem 2} description of subitem 1-2
end{itemize}
item Item 2
egin{itemize}
item makebox[1.3in][1]{Subitem 1}
parbox[t]{3.0in}{description of subitem 2-1
which is a long subitem extending over several lines
to test the indentation} vspace{2itemsep}
item makebox[1.3in][l]{Subitem 2} description of subitem 2-2
end{itemize}
end{itemize}
also has an enumerate environment that numbers each item. The numbers are indented from the left margin.
Here is a simple example of an enumer-Here is a simple example of ated list:an enumerated list:
1. Each item is sequentially assignedegin{enumerate} a number identifier
2. Don’t forget the’begin’ and’end’ commands
Here is a sample example of an enumerated list:
egin{enumerate}
item Each item is sequentially assigned a number identifier
item Don’t forget the ’begin’ and ’end’ commmands
end{enumerate}
Enumerate
environments can be nested, and each level usually has a different style of item counter. The default counters for each level are as follows: level 1, arabic numbers; level 2, alphabetic characters; level 3, roman numerals; and level 4, uppercase alphabetic characters.
These default counters can be changed. For example, to use [i], [ii], … for the first level enumerate environment, define heenumi
counter as
def heenumi{ oman{enumi}}
Then redefine the label-making command, labelenumi
, to put square brackets around the number:
deflabelenumi{[ heenumi]}
In the same way, the style for the counters enumii, enumiii
, and enumiv
can also be modified.
also has a description environment that allows a title or key word to be outdented for each indented paragraph (item).
Here is a simple example of a short description list. Note the lack of indentation at the left page margin.
itemize: Bullets are used to emphasize each item of the list in this environment.
enumerate: Each item is numbered.
description: Each item has a key word (or phrase) to identify it.
Here is a simple example of a short description list. Note the lack of indentation at the left page margin.
egin{de s eripti on}
item[itemize:] Bullets are used to emphasize each item of the list in this environment.
item[enumerate:] Each item is numbered.
item[description:] Each item has a key word (or phrase)to identify it.
end{description}
You can format a list in a great variety of ways by using the list
environment. The syntax for this environment is
egin{list}{ default label}ideclarations} list of itemsend{list}
Here list of items is the items to be listed, default label is the item label to be used if an item does not have the optional argument, as in item [item label]
, and declarations are commands that change the formatting of the list. There are many list
formatting parameters; these are defined in Appendix B and are shown graphically in Fig. 2.1.
Here is a simple example that changes the list symbol and spacing between items.
This is the first item in the new list environment.
This is a second item.
And now back to the main text that follows the list.
… spacing between items.
egin{list}{$Box$}{parsep Oin
itemsep .2cm}
item This is the first item in
the new list environment.
item This is a second item.
end{list}
And now back to the main text …
Here is an example that shows how to use your own numbering scheme for items in a list.
**(i)** This is the first item.
**(ii)** This is the second item.
**(iii)** This is the third item.
**(iv)** This is the fourth item.
For this last example, the counter mynum
must first defined in the preamble with the statement
ewcounter{mynum}
.
egin {list}{**(
oman {mynum})**}%
{usecounter{mynum} itemsep 0in
labelwidth .5in leftmargin .7in}
item This is the first item.
item This is the second item.
item This is the third item.
item This is the fourth item.
end{list}
Once you have created a customized list, it is a good idea to turn it into a special environment so that you can reuse it throughout your document without having to redefine the list each time you use it. The
ewenvironment
command is designed for this task. The syntax is
ewenvironemnt{name}[args]{begdef}{enddef}
where name is the name you wish to give your environment, the optional [args] is the number of arguments (1 to 9), and begdef or enddef is the text to be substituted each time you invoke egin
{name} or end
{name}.
To make an environment for the roman numeral list shown in the preceding example, you would place the following in the preamble of your document.1
1 There cannot be spaces between the arguments of the
ewenvironment
command (or of any other command); hence the use of %
at some of the line ends of this macro to avoid inserting an end-of-line space.
%---- define a roman numeral list environment
ewenvironment{romanlist}%
{egin{list}{**(
oman{mynum})**}%
{usecounter{mynum} itemsep 0in
labelwidth .5in leftmargin .7in}}%
{end{list}}
Here is the same roman numeral list created by using the romanlist environment.
**(i)** This is the first item.
**(ii)** This is the second item.
**(iii)** This is the third item.
**(iv)** This is the fourth item.
Here is the same roman numeral
list created by using the
verb|romanlist| environment.
egin{romanlist}
item This is the first item.
item This is the second item.
item This is the third item.
item This is the fourth item
end{romanlist}
Reference Listing Environment
Here is an example macro to create an environment, called reflist
, that produces an indented list with the first line of each item outdented slightly.
%------ environment for outdenting 1st line of each paragraph
% ***** NOTE insert blank line after egin{reflist}
ewenvironment{reflist}{egin{list}{}{listparindent -.25in
leftmargin .5in} item vspace{-.35in} }{end{list}}
The references are then placed between egin{reflist}…end{reflist}
, each as a separate paragraph begun by a blank line. This environment produces lists such as
J. K. Shultis and T. R. Hill, “The Discrete Eigenvalue Problem for Azimuthally Dependent Transport Theory, Nucl. Sci. Engg., 59, 53-56 (1976).
J. P. Odom and J. K. Shultis, “Anisotropic Multigroup Neutron Transport without Legendre Expansions,” Trans. Am. Nucl. Soc, 21, 530 (1975).
S. Lindahl and J. K. Shultis,”Fast Neutron Transmission Near Cross Section Minima,” Trans. Am. Nucl. Soc, 22, 809 (1975).
This list is produced by
egin{reflist}
reference 1 ...
reference 2 ...
reference 3 ...
end{reflist}
Note that no item
command is needed. In effect this environment treats all the references as a single item in which each is a separate paragraph.
Aligned List Environment
Sometimes you may wish that a “description” list have the descriptions all aligned on the left. As an example, consider
This is the description of the first item, which may extend over two or more lines, as this particular item does. | |
Second Item: |
This is the second item. It is short. |
Third Item: |
This is a third item, which is intermediate in length between the first and second items. |
This aligned description list environment deflist
is very similar to ’s list
environment. It is defined by placing the following in the preamble (or style file):
ewlength{defitemindent} setlength{defitemindent}{.25in}
ewcommand{deflabel}[1]{hspace{defitemindent}f #1hfill}
ewenvironment{defdef} [1] %
{egin{list}{}
{itemsep=10pt parsep=5pt opsep=0pt parskip=10pt
settowidth{labelwidth}{hspace{defitemindent}f #1}%
setlength{leftmargin}{labelwidth}%
addtolength{leftmargin}{labelsep}%
enewcommand{makelabel}{def label}}}%
{end{list}}%
The parameters controlling the spacing between items and the indentation of the descriptions are easily changed. Also, the style used for the descriptors can be modified by changing the preceding deflabel
and settowidth
statements. The deflabel
environment is used as follows:
egin{deflist}{Longest Descriptor}
item[descriptor 1] text for first item
item[descriptor 2] text for second item
....
end{deflist}
Verbatim
EnvironmentThe verbatim
environment uses the fixed pitch typewriter font t
to produce an exact listing of the input. makes no effort to interpret any of the input placed between egin{verbatim}
and end{verbatim}
. With this environment computer code listings or output containing commands and special characters can be produced. The verbatim
environment can handle only a few pages of input before runs out of memory. If a very long listing is to be made, break the listing into several sequential verbatim
environments and use vspace{-xxin}
to eliminate the break normally produced between adjacent verbatim
outputs. In Section 8.2, a better way for producing long verbatim lists is discussed.
For verbatim text in normal lines of text, use the command verb
| verbatim text|. The delimiter | can be any character (other than *) that is not contained in verbatim text. Beware that such in-line verbatim text is not broken by at the end of lines; to avoid this, several sequential verb
|…| should be used for lengthy verbatim text to allow to create proper line breaks.
There are also the command variations egin{verbatim*}
and verb*
that cause a space in the verbatim input to be printed as rather than as a normal space.