LATEX Character Basics Tutorial - Part 3

Опубликовано: 08 Октябрь 2024
на канале: Zone Stomper
32
3

LATEX Character Basics - Part 3
Hopefully, you already reviewed parts 1 & 2 in this series on LATEX character
basics. In this tutorial, I will cover some issues involving spaces.
Spaces Between Words & Spaces Between Sentences
LATEX interprets a space ( ) followed by a period (.), a question mark (?)
or an exclamation mark (!) which follows a lowercase letter to be the end
of a sentence. As you might expect, there is more space displayed between
sentences than is displayed between words. But because of the way LATEX
identifies the ends of sentences, it may not give you the results that you want.
For example, there will be too much space following the period (.) in
“Mr. Smith” because LATEX sees the period as ending a sentence. Let’s look
at some options:
‘‘Mr. Smith’’
Looking at the output from 2 and 3, you can see that the spacing was reduced
by following the period with either the tilde or a backslash/space combination.
Using the Tilde (˜) Character
As you have seen, inserting a tilde can help to control the spacing in your
output. It actually does more than that. It will prevent LATEX from breaking
a line at the place where it is used. So, if ‘‘Mr.~Smith’’ is inserted in
the middle of a paragraph, you won’t need to worry about the line breaking
where the tilde is located.
Handling Sentences That End With a Capital Letter
What if you have a sentence that uses a capital letter before the period
that ends the sentence? To ensure that LATEX sees the period as ending the
sentence, precede it with \@. Let’s take a look:
Sentence ONE. Sentence TWO. ) Sentence ONE. Sentence TWO.
Sentence ONE\@. Sentence TWO. ) Sentence ONE. Sentence TWO.
Looking at 1, you can see the output spacing is too small. At 2, the spacing
was adjusted to what it should be between sentences.
The concept is the same for sentences that end with question marks or
exclamation points.
French Spacing
What’s known as french spacing can be useful if you have a lot of content with
single periods, question marks or exclamation points that are sandwiched
between lowercase letters to the left and spaces to the right yet there are
no sentence ending periods, question marks or exclamation marks. French
spacing is used where you don’t want such occurances to be interpreted as
sentence ending. Let’s look at the defualt behavior of LATEX:
Mr. & Mrs. Griffith
Mr. & Mrs. Flintstone
Mr. & Mrs. DeWitte
Mr. & Mrs. Smith
Mr. & Mrs. Jones
Mr. & Mrs. Nick
Mr. & Mrs. Hammer
Mr. & Mrs. Shtunkle
Mr. & Mrs. Fubar
Mr. & Mrs. Shakes
Mr. & Mrs. Hippity
Mr. & Mrs. Hoppity
Mr. & Mrs. McFitch
Mr. & Mrs. Gravel
Mr. & Mrs. Lucky
As you can see, all of the periods are interpreted as sentence ends which
is not what you would want. There is just too much space added after them.
Turning French Spacing On and Off
We use \frenchspacing to turn french spacing on and \nonfrenchspacing
to turn it off. Look at the following LATEX code block here and next I will
show you the reduced space following the periods.
\frenchspacing
\begin{itemize}
\item Mr. \& Mrs. Griffith
\item Mr. \& Mrs. Flintstone
\item Mr. \& Mrs. DeWitte
\item Mr. \& Mrs. Smith
\item Mr. \& Mrs. Jones
\item Mr. \& Mrs. Nick
\item Mr. \& Mrs. Hammer
\item Mr. \& Mrs. Shtunkle
\item Mr. \& Mrs. Fubar
\item Mr. \& Mrs. Shakes
\item Mr. \& Mrs. Hippity
\item Mr. \& Mrs. Hoppity
\item Mr. \& Mrs. McFitch
\item Mr. \& Mrs. Gravel
\item Mr. \& Mrs. Lucky
\end{itemize}
\nonfrenchspacing
You can see in the following list that using french spacing has reduced
the spacing to what it should be:
Mr. & Mrs. Griffith
Mr. & Mrs. Flintstone
Mr. & Mrs. DeWitte
Mr. & Mrs. Smith
Mr. & Mrs. Jones
Mr. & Mrs. Nick
Mr. & Mrs. Hammer
Mr. & Mrs. Shtunkle
Mr. & Mrs. Fubar
Mr. & Mrs. Shakes
Mr. & Mrs. Hippity
Mr. & Mrs. Hoppity
Mr. & Mrs. McFitch
Mr. & Mrs. Gravel
Mr. & Mrs. Lucky
LATEX Tutorial Series - ZONE STOMPER
LATEX Character Basics Tutorial - Part 3
Code Guide:
Experiment - The best way to learn coding is with a keyboard. If you can learn how to type, you
can learn how to code. Use any text editor. I recommend TEXworks.
Own It - If you want to learn typesetting, you probably have something to say. It will be easier for
you to understand the markup if you apply it to your own ideas. Try injecting those ideas into
your documents. Typesetting is all about improving the appearance of content.
File Extension - Always use the .tex file extension. Example: hello world.tex
Code Modifications - Pay attention to lines with comments. Don't type
the comments. Just follow along with the modifications. Typing will help you learn coding.
Line Numbers - Don't type the line numbers into your LATEX code or it will not compile. Line
numbers are for reference only.

Code Demos - All code blocks are followed by resized images of .pdf documents produced from those


Be sure to subscribe for more video tutorials on typesetting, LaTeX, TeX, and TikZ.