LATEX Character Basics - Part 2
We covered a lot of ground in part 1 of this series on LATEX character basics.
With LATEX there always seems to be more. So, don’t expect to learn everything.
Hopefully, you will have covered the ground you need to cover to be
able to accomplish some useful work. I don’t think anyone knows it all. Just learn enough to be productive.
Producing Different Types of Dashes
No muss, no fuss! Or is it no fuss, no muss? Anyway, LATEX has a “dash”
for you. Pay attention. They are not all the same.
A single - produces an intra-word dash or hyphen as can be seen in
“intra-word.”
A -- produces the kind of dash that can be used in number ranges:
“30–90 days!”
A --- produces the triple dash or punctuation dash — how is that?
A | also produces —.
A $-$ produces a minus or negative sign in math mode as in 5−7 = −2.
The $ symbol is one way to toggle in and out of math mode. It’s not
the only way.
Special Characters Without Packages or Math Mode
There are more special characters that can be used with LATEX than you will
ever possibly need. The list is almost endless. First, I’ll show you a few that
can be used without going into math mode or importing packages.
\dag
\textdagger
\copyright
\textvisiblespace
As you can see from the top two items listed, it is often possible to use more
than one command to achieve the same result.
You may be wondering how \textvisiblespace at the bottom of the
list is used. Even though it’s really just another printable character, it’s
often used in LATEX tutorials and documentation to make it clear that a
space character is needed or used where the symbol appears. It’s a way
of presenting the invisible in a visible way. And that brings us to the next
subsection where we take a look at spaces.
How Spaces are Handled by LATEX
You could have one or one hundred spaces between words and LATEX would
not know the difference as it sees both as a single space. If you threw in some
tab characters, you would still get the same result. Spaces, tabs and newline
characters can all be considered to be basic examples of what is referred to
as “whitespace” by typesetters and programmers. However, newlines are not
handled the same as spaces and tabs by LATEX.
If one or more newline characters are embedded in a pile of tab and space
characters, it will force a paragraph break. So, that’s how new paragraphs
are started in LATEX.
Using \ When Is Not Good Enough
\ is used to put a space where you need it. Can’t you just type a space? You
would think so but it doesn’t always work that way. I will demonstrate.
For this demonstration, I’ll be using the LATEX logo. Hopefully you can
see the difference between LaTeX and LATEX. The fancier LATEX is produced
with the \LaTeX command.
\LaTeX Type ) LATEXType
\LaTeX Type ) LATEXType
\LaTeX\ Type ) LATEX Type
\LaTeX. Type ) LATEX. Type
If you look at lines 1 and 2 above, you will see that LATEX treats one space
the same as four spaces. In both cases, there is no space in the output. Why
is that? It is because if there was no space separating \LaTeX from Type,
you would have \LaTeXType which LATEXwould assume is a command And
it would either do something unwanted or generate an error. It’s necessary
to separate \LaTeX from Type. After you separate them, LATEX has no way
of knowing if you actually want the space in your output. To make it clear,
use Line 3 shows the solution. Line 4 is not a problem because the space
follows a period and not the \LaTeX command.
It’s what is in your input file before and not after the space that controls
the behavior. Look at the following to see how LATEX behaves:
\LaTeX \LaTeX ) LATEXLATEX
\LaTeX \LaTeX ) LATEXLATEX
\LaTeX\ \LaTeX ) LATEX LATEX
\LaTeX. \LaTeX ) LATEX. LATEX
LATEX Tutorial Series - ZONE STOMPER
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 Modications - Pay attention to lines with comments. Don't type
the comments. Just follow along with the modications. 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
code blocks using pdfLATEX. An automated process was used to avoid typos or coding errors.
Enjoy!
For more tutorials on typesetting, LaTeX, TeX, and TikZ, be sure to subscribe and mash the notifications bell icon.