0% found this document useful (0 votes)
122 views

LaTeX Etiquette - Good Practices

Good practices when writing LaTeX documents

Uploaded by

MarceloGelati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

LaTeX Etiquette - Good Practices

Good practices when writing LaTeX documents

Uploaded by

MarceloGelati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 74

Etiquette and dirty tricks in LATEX

Jephian C.-H. Lin 林晉宏

Department of Applied Mathematics, National Sun Yat-sen University

May 21, 2019


Practice of Applied Mathematics, Kaohsiung, Taiwan

Etiquette and dirty tricks in LATEX 1/45 NSYSU


TEX

I A typesetting system create by Donald Knuth


I Comes from the Greek root τ χ, meaning art/craft, also the
stem of “technology”
I Aim to produce the finest quality of typesetting
I Current version number: 3.1415926
I History of TEX on the TeX Users Group web site
I Official manual: The TEXbook by Donald Knuth
I 大家來學 LATEX by 李果正 Edward G.J. Lee

Etiquette and dirty tricks in LATEX 2/45 NSYSU


About Knuth

By Flickr user Jacob Appelbaum, uploaded to en.wikipedia by users BeSherman, Duozmo - Flickr.com

(via en.wikipedia), CC BY-SA 2.5, https://commons.wikimedia.org/w/index.php?curid=1303242

Etiquette and dirty tricks in LATEX 3/45 NSYSU


About Knuth

I Professor emeritus at Stanford University


I Computer scientist, mathematician
I Turing Award winner
I Author of Art of Computer Programming
I Chinese name: 高德納 (Suggested by Frances Yao)
I Pay finder fee $2.56 for catching a typo, and $0.32 for
valuable suggestion.
I The Electronic Coach on YouTube

Etiquette and dirty tricks in LATEX 3/45 NSYSU


LATEX

I A typesetting system based on TEX


I Originally create by Leslie Lamport, now maintained by the
LATEX project
I contains various macros of TEX
I make the writing easier
I make the code more readable
I LATEX: A Document Preparation System by Leslie Lamport

Etiquette and dirty tricks in LATEX 4/45 NSYSU


About Lamport

From the personal website of Lamport

Etiquette and dirty tricks in LATEX 5/45 NSYSU


About Lamport

I Worked at SRI International and Microsoft Research


I Computer scientist, mathematician
I Turning Award winner

Etiquette and dirty tricks in LATEX 5/45 NSYSU


Pros and Cons
Pros:
I Easy to type mathematics formulas
I Easy to do internal references
I Easy to maintain the bibliography
I Easy to set macros
I Focus on writing
I Fast and high-quality typesetting for everyone
I Finest spacing
I Hyphenation and justification
Cons:
I Take some efforts to learn (but it is worthy, for sure!)
I No graphic preview before compiling (but why you need it?)
Etiquette and dirty tricks in LATEX 6/45 NSYSU
Pros and Cons
Pros:
I Easy to type mathematics formulas
I Easy to do internal references
I Easy to maintain the bibliography
I Easy to set macros
I Focus on writing
I Fast and high-quality typesetting for everyone
I Finest spacing
I Hyphenation and justification
Cons:
I Take some efforts to learn (but it is worthy, for sure!)
I No graphic preview before compiling (but why you need it?)
Etiquette and dirty tricks in LATEX 6/45 NSYSU
Sample file for LATEX

\documentclass[a4paper]{article}
% article, report, or book
% some journal has its own class

%%% PREAMBLE %%%


\usepackage{amsmath, amssymb, amsthm}
\usepackage{tikz}

\newcommand{\rbf}[1]{\textbf{\color{red}#1}}

\begine{document}
I \rbf{love} \LaTeX{}!!!
\end{document}

Etiquette and dirty tricks in LATEX 7/45 NSYSU


Etiquette and Dirty Tricks in LATEX

I Respect the original design


I Respect the style
I Dirty tricks

Etiquette and dirty tricks in LATEX 8/45 NSYSU


Etiquette

. . . the basic rule of typography is: “Every rule can be


broken, as long as you are aware that you are breaking a
rule.”
—TikZ & PGF Manual by Till Tantau, Chapter 7

Etiquette and dirty tricks in LATEX 9/45 NSYSU


Etiquette

. . . the basic rule of typography is: “Every rule can be


broken, as long as you are aware that you are breaking a
rule.”
—TikZ & PGF Manual by Till Tantau, Chapter 7

Etiquette and dirty tricks in LATEX 9/45 NSYSU


Respect the original design

Etiquette and dirty tricks in LATEX 10/45 NSYSU


The logo

I Type TEX (\TeX) and LATEX (\LaTeX) when possible.


I Otherwise, type TeX and LaTeX.

This displaced ‘E’ is a reminder that TEX is about typeset-


ting, and it distinguishes TEX from other system names.
—TEXbook, Chapter 1

Etiquette and dirty tricks in LATEX 11/45 NSYSU


The logo

I Type TEX (\TeX) and LATEX (\LaTeX) when possible.


I Otherwise, type TeX and LaTeX.

This displaced ‘E’ is a reminder that TEX is about typeset-


ting, and it distinguishes TEX from other system names.
—TEXbook, Chapter 1

Etiquette and dirty tricks in LATEX 11/45 NSYSU


The pronunciation
I TEX ∼ tech (the ‘ch’ is like that in Bach)
I Definitely no ‘s’ sound at the end

It’s the ‘ch’ sound in Scottish words like loch or German


words like ach; it’s a Spanish ‘j’ and a Russian ‘kh’. When
you say it correctly to your computer, the terminal may
become slightly moist.
—TEXbook, Chapter 1
Etiquette and dirty tricks in LATEX 12/45 NSYSU
The pronunciation
I TEX ∼ tech (the ‘ch’ is like that in Bach)
I Definitely no ‘s’ sound at the end

It’s the ‘ch’ sound in Scottish words like loch or German


words like ach; it’s a Spanish ‘j’ and a Russian ‘kh’. When
you say it correctly to your computer, the terminal may
become slightly moist.
—TEXbook, Chapter 1
Etiquette and dirty tricks in LATEX 12/45 NSYSU
EXERCISE 1.1 (TEXbook, Chapter 1)
After you have mastered the material in this book, what will you
be: A TEXpert, or a TEXnician?

Etiquette and dirty tricks in LATEX 13/45 NSYSU


EXERCISE 1.1 (TEXbook, Chapter 1)
After you have mastered the material in this book, what will you
be: A TEXpert, or a TEXnician?

TEXnician. There is no ‘s’ sound!

Etiquette and dirty tricks in LATEX 13/45 NSYSU


The pronunciation

How about LATEX?

One of the hardest things about using LATEX is deciding how


to pronounce it. This is also one of the few things I’m not
going to tell you about LATEX, since pronunciation is best
determined by usage, not fiat. TEX is usually pronounced
teck, making lah-teck, lah-teck, and lay-teck the logical
choices; but language is not always logical, so lay-tecks is
also possible.
—LATEX: A Document Preparation System, Chapter 1

Etiquette and dirty tricks in LATEX 14/45 NSYSU


The pronunciation

How about LATEX?

One of the hardest things about using LATEX is deciding how


to pronounce it. This is also one of the few things I’m not
going to tell you about LATEX, since pronunciation is best
determined by usage, not fiat. TEX is usually pronounced
teck, making lah-teck, lah-teck, and lay-teck the logical
choices; but language is not always logical, so lay-tecks is
also possible.
—LATEX: A Document Preparation System, Chapter 1

Etiquette and dirty tricks in LATEX 14/45 NSYSU


Focus on the writing

I TEX is a markup language.


I You mark each class, and set up the style.
I For example, use \emph{} rather than \textit{}.
I For example, use the \begin{proof}...\end{proof} rather
than type \textbf{Proof}\\ every time.
I Be aware of unnecessary styling. (Color, bold, italic. . .)
I Be aware of unnecessary space adjustment. (\vspace{} or
\hspace{}. . .)

Etiquette and dirty tricks in LATEX 15/45 NSYSU


Line break and new paragraph

I \\ stands for a line break.


I An empty line stands for starting a new paragraph.
I For writing an article, you will almost never need to enforce a
line break. (Except for creating a table, an array, or a matrix.)

Etiquette and dirty tricks in LATEX 16/45 NSYSU


obeylines

If really necessary, use the obeylines environment.

Name: Jephian Lin \begin{obeylines}


Major: Mathematics Name: Jephian Lin
Known for: Shameless Major: Mathematics
Known for: Shameless
\end{obeylines}

Etiquette and dirty tricks in LATEX 17/45 NSYSU


Math vs text

I Math is math. For example,


I i, j−entry ($i,j-$entry): terrible.
I i, j-entry ($i,j$-entry): good.

I Text is text. For example,


I f (x) = 0 if x = 0 ($f(x)=0~if~x=0$): terrible.
I f (x) = 0 if x = 0 ($f(x)=0$ if $x=0$): good.

Etiquette and dirty tricks in LATEX 18/45 NSYSU


Text in displayed math

You say You say


\[x>1\text{ and }x<3,\]
x > 1 and x < 3,
{\it but I say
but I say \[x<1\text{ or }x>3.\]
}
x < 1 or x > 3.

\text{} is a macro defined in the amsmath package. Texts in


\text{} will adopt the surrounding style.

Etiquette and dirty tricks in LATEX 19/45 NSYSU


Letters in the math mode

I Letters in math mode are treated as variables.


I In the text mode, ‘fi’ or ‘ff’ gets together (called ligature); but
in the math mode, ‘fi’ or ‘ff ’ is separate.
I sinx (sin x): terrible. You mean s × i × n × x?
I sin x (\sin x): good.
I Most of the functions has a corresponding control-sequence.
For example, \det, \ln, \log, \max, \min, and so on.
Otherwise, create you own operator, e.g.,
\operatorname{tr}.

sinx si nx
=  = six = 6?
n n

Etiquette and dirty tricks in LATEX 20/45 NSYSU


Letters in the math mode

I Letters in math mode are treated as variables.


I In the text mode, ‘fi’ or ‘ff’ gets together (called ligature); but
in the math mode, ‘fi’ or ‘ff ’ is separate.
I sinx (sin x): terrible. You mean s × i × n × x?
I sin x (\sin x): good.
I Most of the functions has a corresponding control-sequence.
For example, \det, \ln, \log, \max, \min, and so on.
Otherwise, create you own operator, e.g.,
\operatorname{tr}.

sinx si nx
=  = six = 6?
n n

Etiquette and dirty tricks in LATEX 20/45 NSYSU


Accurate quotation marks

The quotation marks should be like ‘this’ or “this”.

Here ‘ is the key on the below Esc, while ’ is the key left to Enter

Etiquette and dirty tricks in LATEX 21/45 NSYSU


Hyphen, en-dash, em-dash, and minus sign

I Hyphen - (-): Used in compound words.


e.g. Chin-Hung Lin, nine-year-old boy, one-to-one function, . . .
I En-dash – (--): Used in number ranges, or for combining
names.
e.g. Pages 2–5 of TEXbook, Cauchy–Schwartz inequality,
Cayley–Hamilton theorem, . . .
I Em-dash — (---): Used for punctuation in sentences.
e.g. I love NSYSU—it is the best university over the world!
I Minus sign − ($-$): Used in math formulas.
e.g. x − y , Z− , −A, . . .

Etiquette and dirty tricks in LATEX 22/45 NSYSU


Hyphen, en-dash, em-dash, and minus sign

I Hyphen - (-): Used in compound words.


e.g. Chin-Hung Lin, nine-year-old boy, one-to-one function, . . .
I En-dash – (--): Used in number ranges, or for combining
names.
e.g. Pages 2–5 of TEXbook, Cauchy–Schwartz inequality,
Cayley–Hamilton theorem, . . .
I Em-dash — (---): Used for punctuation in sentences.
e.g. I love NSYSU—it is the best university over the world!
I Minus sign − ($-$): Used in math formulas.
e.g. x − y , Z− , −A, . . .

Etiquette and dirty tricks in LATEX 22/45 NSYSU


Hyphen, en-dash, em-dash, and minus sign

I Hyphen - (-): Used in compound words.


e.g. Chin-Hung Lin, nine-year-old boy, one-to-one function, . . .
I En-dash – (--): Used in number ranges, or for combining
names.
e.g. Pages 2–5 of TEXbook, Cauchy–Schwartz inequality,
Cayley–Hamilton theorem, . . .
I Em-dash — (---): Used for punctuation in sentences.
e.g. I love NSYSU—it is the best university over the world!
I Minus sign − ($-$): Used in math formulas.
e.g. x − y , Z− , −A, . . .

Etiquette and dirty tricks in LATEX 22/45 NSYSU


Hyphen, en-dash, em-dash, and minus sign

I Hyphen - (-): Used in compound words.


e.g. Chin-Hung Lin, nine-year-old boy, one-to-one function, . . .
I En-dash – (--): Used in number ranges, or for combining
names.
e.g. Pages 2–5 of TEXbook, Cauchy–Schwartz inequality,
Cayley–Hamilton theorem, . . .
I Em-dash — (---): Used for punctuation in sentences.
e.g. I love NSYSU—it is the best university over the world!
I Minus sign − ($-$): Used in math formulas.
e.g. x − y , Z− , −A, . . .

Etiquette and dirty tricks in LATEX 22/45 NSYSU


Hyphen, en-dash, em-dash, and minus sign

I Hyphen - (-): Used in compound words.


e.g. Chin-Hung Lin, nine-year-old boy, one-to-one function, . . .
I En-dash – (--): Used in number ranges, or for combining
names.
e.g. Pages 2–5 of TEXbook, Cauchy–Schwartz inequality,
Cayley–Hamilton theorem, . . .
I Em-dash — (---): Used for punctuation in sentences.
e.g. I love NSYSU—it is the best university over the world!
I Minus sign − ($-$): Used in math formulas.
e.g. x − y , Z− , −A, . . .

Etiquette and dirty tricks in LATEX 22/45 NSYSU


Hyphen, en-dash, em-dash, and minus sign

I Hyphen - (-): Used in compound words.


e.g. Chin-Hung Lin, nine-year-old boy, one-to-one function, . . .
I En-dash – (--): Used in number ranges, or for combining
names.
e.g. Pages 2–5 of TEXbook, Cauchy–Schwartz inequality,
Cayley–Hamilton theorem, . . .
I Em-dash — (---): Used for punctuation in sentences.
e.g. I love NSYSU—it is the best university over the world!
I Minus sign − ($-$): Used in math formulas.
e.g. x − y , Z− , −A, . . .

Etiquette and dirty tricks in LATEX 22/45 NSYSU


Hyphen, en-dash, em-dash, and minus sign

I Hyphen - (-): Used in compound words.


e.g. Chin-Hung Lin, nine-year-old boy, one-to-one function, . . .
I En-dash – (--): Used in number ranges, or for combining
names.
e.g. Pages 2–5 of TEXbook, Cauchy–Schwartz inequality,
Cayley–Hamilton theorem, . . .
I Em-dash — (---): Used for punctuation in sentences.
e.g. I love NSYSU—it is the best university over the world!
I Minus sign − ($-$): Used in math formulas.
e.g. x − y , Z− , −A, . . .

Etiquette and dirty tricks in LATEX 22/45 NSYSU


Hyphen, en-dash, em-dash, and minus sign

I Hyphen - (-): Used in compound words.


e.g. Chin-Hung Lin, nine-year-old boy, one-to-one function, . . .
I En-dash – (--): Used in number ranges, or for combining
names.
e.g. Pages 2–5 of TEXbook, Cauchy–Schwartz inequality,
Cayley–Hamilton theorem, . . .
I Em-dash — (---): Used for punctuation in sentences.
e.g. I love NSYSU—it is the best university over the world!
I Minus sign − ($-$): Used in math formulas.
e.g. x − y , Z− , −A, . . .

Etiquette and dirty tricks in LATEX 22/45 NSYSU


Accurate spacing

I Spaces between words are different from spaces between


sentences. The latter one is wider.
I Spaces after . ? ! are treated as inter-sentence spaces, unless
the ending letter is upper case. (How smart?)
I Use tie (~) or the space command (\␣) to force a regular
space.
I Use \@ to avoid the upper case check.

Dr. Lin Dr.~Lin % correct


Dr. Lin Dr.\ Lin % not recommended
Dr. Lin Dr. Lin % incorrect

Etiquette and dirty tricks in LATEX 23/45 NSYSU


Electron. J. Combin.
Electron. J. Combin.
Electron. J. Combin.

Electron.~J. Combin. % not recommended


Electron.\ J. Combin. % correct
Electron. J. Combin. % incorrect

Etiquette and dirty tricks in LATEX 24/45 NSYSU


Here is NSYSU. I love it.
Here is NSYSU. I love it.
Here is NSYSU. I love it.
Here is NSYSU. I love it.

Here is NSYSU.~I love it. % incorrect


Here is NSYSU.\ I love it. % incorrect
Here is NSYSU. I love it. % incorrect
Here is NSYSU\@. I love it. % correct

Etiquette and dirty tricks in LATEX 25/45 NSYSU


How to compile?

I The default output of latex command is a DVI file.


Previously, people generate the DVI file and then convert it to
a PDF file.
I Nowaday, it is more often to use pdflatex to generate a PDF
file.
I The first round of compiling records the numbers for each
label to a *.aux file.
I The second round fills in these numbers for internal references
and citations.
I If you use BibTeX, which is awesome, you need to do bibtex
*.aux before the second round.

Etiquette and dirty tricks in LATEX 26/45 NSYSU


Good attitude

Try to resolve every warning message.


Try your best to care about every single details.
Be an awesome TEXnician!

Etiquette and dirty tricks in LATEX 27/45 NSYSU


Good attitude

Try to resolve every warning message.


Try your best to care about every single details.
Be an awesome TEXnician!

Etiquette and dirty tricks in LATEX 27/45 NSYSU


Good attitude

Try to resolve every warning message.


Try your best to care about every single details.
Be an awesome TEXnician!

Etiquette and dirty tricks in LATEX 27/45 NSYSU


Respect the style

Etiquette and dirty tricks in LATEX 28/45 NSYSU


Follow journal’s style guideline

Carefully read at least one journal’s Author Guidelines. Also, read


the guidelines for the journal your are going to submit your paper
to.

Some journal will do typesetting for you, while most of electronic


journals ask you to typeset your own paper.

Etiquette and dirty tricks in LATEX 29/45 NSYSU


Follow journal’s style guideline

Carefully read at least one journal’s Author Guidelines. Also, read


the guidelines for the journal your are going to submit your paper
to.

Some journal will do typesetting for you, while most of electronic


journals ask you to typeset your own paper.

Etiquette and dirty tricks in LATEX 29/45 NSYSU


Some conventions

Use the default environments. E.g., theorem, proof, . . .

Use \emph{} when defining a new term.

Etiquette and dirty tricks in LATEX 30/45 NSYSU


Some conventions

Use the default environments. E.g., theorem, proof, . . .

Use \emph{} when defining a new term.

Etiquette and dirty tricks in LATEX 30/45 NSYSU


Complete each sentence

Example:
Let f be a linear transformation. The nullspace of f is

{x ∈ Rn : f (x) = 0},

and the range of f is

{f (x) : x ∈ Rn }.

Remember to put correct punctuation marks.

Etiquette and dirty tricks in LATEX 31/45 NSYSU


Complete each sentence

Example:
Let f be a linear transformation. The nullspace of f is

{x ∈ Rn : f (x) = 0},

and the range of f is

{f (x) : x ∈ Rn }.

Remember to put correct punctuation marks.

Etiquette and dirty tricks in LATEX 31/45 NSYSU


Wrong example:
The equation implies x = 1; Which is positive.

Correct example:
The equation implies x = 1, which is positive.

Etiquette and dirty tricks in LATEX 32/45 NSYSU


Wrong example:
The equation implies x = 1; Which is positive.

Correct example:
The equation implies x = 1, which is positive.

Etiquette and dirty tricks in LATEX 32/45 NSYSU


Example (not recommended):
Compute

x 2 − 1 = 0 =⇒ (x + 1)(x − 1) = 0 =⇒ x = ±1.

Recommended example:
Since x 2 − 1 = 0, which can be factored as (x + 1)(x − 1) = 0, this
leads to the conclusion that x = ±1.

Etiquette and dirty tricks in LATEX 33/45 NSYSU


Example (not recommended):
Compute

x 2 − 1 = 0 =⇒ (x + 1)(x − 1) = 0 =⇒ x = ±1.

Recommended example:
Since x 2 − 1 = 0, which can be factored as (x + 1)(x − 1) = 0, this
leads to the conclusion that x = ±1.

Etiquette and dirty tricks in LATEX 33/45 NSYSU


Internal references and external citations

Always use the internal reference feature. Never type the number
by yourself.

Theorem 1 \begin{theorem}
If x = 1, then x + 1 = 2. \label{thm:CH}
If $x=1$, ...
\end{theorem}

Theorem 1 is very important. Theorem~\ref{thm:CH} ...

Using BibTeX for bibliography is recommended. (This keep the


style in the references consistent.)

Etiquette and dirty tricks in LATEX 34/45 NSYSU


Internal references and external citations

Always use the internal reference feature. Never type the number
by yourself.

Theorem 1 \begin{theorem}
If x = 1, then x + 1 = 2. \label{thm:CH}
If $x=1$, ...
\end{theorem}

Theorem 1 is very important. Theorem~\ref{thm:CH} ...

Using BibTeX for bibliography is recommended. (This keep the


style in the references consistent.)

Etiquette and dirty tricks in LATEX 34/45 NSYSU


Figures

Use vector graphics whenever possible.

You may use the TikZ package, the Ipe extensible drawing editor,
or the Adobe Illustrator, and so on, to do so.

Etiquette and dirty tricks in LATEX 35/45 NSYSU


Figures

Use vector graphics whenever possible.

You may use the TikZ package, the Ipe extensible drawing editor,
or the Adobe Illustrator, and so on, to do so.

Etiquette and dirty tricks in LATEX 35/45 NSYSU


I Put all figures in the figure environment.
I Put proper captions.
I Label all figures.
Example:

\begin{figure}
\begin{center}
\includegraphics[scale=0.5]{nsysulogo}
\end{center}

\caption{The logo of National Sun Yat-sen University}


\label{fig:nsysulogo}
\end{figure}

Etiquette and dirty tricks in LATEX 36/45 NSYSU


Macros

Defining a macro avoids introducing unexpected typos. It is also


easier to change the style later.

Example:
tr(A> A) = tr(AA> )

\newcommand{\tr}{\operatorname{tr}}
\newcommand{\trans}{^\top}

$\tr(A\trans A) = \tr(AA\trans)$

Etiquette and dirty tricks in LATEX 37/45 NSYSU


Keep improving

Avoid unnecessary styling. Known the functions of each packages,


and remove unnecessary packages.

There is no universal rules, but learn to deliver the information in


an efficient way. Learn to appreciate or give comments to people’s
work and keep improving.

Etiquette and dirty tricks in LATEX 38/45 NSYSU


Keep improving

Avoid unnecessary styling. Known the functions of each packages,


and remove unnecessary packages.

There is no universal rules, but learn to deliver the information in


an efficient way. Learn to appreciate or give comments to people’s
work and keep improving.

Etiquette and dirty tricks in LATEX 38/45 NSYSU


Dirty tricks

Etiquette and dirty tricks in LATEX 39/45 NSYSU


Strut

Matrix without strut: Matrix with strut:


 
A B " #
B> C A B
B> C

\newcommand\topstrut{\rule{0pt}{1.2em}}

\[\left[\begin{array}{c|c}
A & B \\
\hline
\topstrut B\trans & C
\end{array}\right]\]
PS This is not dirty at all. In fact, this is also suggested by the
TEXbook.
Etiquette and dirty tricks in LATEX 40/45 NSYSU
How to type this?

 
0 1 1
 1 
A
1

\newcommand{\floating}[1]
{\smash{\raisebox{.5\normalbaselineskip}{#1}}}

\[\left[\begin{array}{c|cc}
0 & 1 & 1 \\
\hline
1 & & \\
1 & \multicolumn{2}{c}{\floating{$A$}}
\end{array}\right]\]

Etiquette and dirty tricks in LATEX 41/45 NSYSU


How to type this?

 
0 1 1
 1 
A
1

\newcommand{\floating}[1]
{\smash{\raisebox{.5\normalbaselineskip}{#1}}}

\[\left[\begin{array}{c|cc}
0 & 1 & 1 \\
\hline
1 & & \\
1 & \multicolumn{2}{c}{\floating{$A$}}
\end{array}\right]\]

Etiquette and dirty tricks in LATEX 41/45 NSYSU


How to type this?

x3 + x2 + x + 1
= x 2 (x + 1) + (x + 1)
= (x + 1)(x 2 + 1)

\[\begin{aligned}
&\mathrel{\phantom{=}}x^3 + x^2 + x + 1 \\
&= x^2(x+1) + (x+1) \\
&= (x+1)(x^2+1)
\end{aligned}\]

Etiquette and dirty tricks in LATEX 42/45 NSYSU


How to type this?

x3 + x2 + x + 1
= x 2 (x + 1) + (x + 1)
= (x + 1)(x 2 + 1)

\[\begin{aligned}
&\mathrel{\phantom{=}}x^3 + x^2 + x + 1 \\
&= x^2(x+1) + (x+1) \\
&= (x+1)(x^2+1)
\end{aligned}\]

Etiquette and dirty tricks in LATEX 42/45 NSYSU


Wrong spacing after the equal signs

x3 + x2 + x + 1
=x 2 (x + 1) + (x + 1)
=(x + 1)(x 2 + 1)

\[\begin{aligned}
&x^3 + x^2 + x + 1 \\
=& x^2(x+1) + (x+1) \\
=& (x+1)(x^2+1)
\end{aligned}\]

Etiquette and dirty tricks in LATEX 43/45 NSYSU


Not aligned

x3 + x2 + x + 1
= x 2 (x + 1) + (x + 1)
= (x + 1)(x 2 + 1)

\[\begin{aligned}
&\phantom{=}x^3 + x^2 + x + 1 \\
&= x^2(x+1) + (x+1) \\
&= (x+1)(x^2+1)
\end{aligned}\]

Etiquette and dirty tricks in LATEX 44/45 NSYSU


Correctly aligned

x3 + x2 + x + 1
= x 2 (x + 1) + (x + 1)
= (x + 1)(x 2 + 1)

\[\begin{aligned}
&\mathrel{\phantom{=}}x^3 + x^2 + x + 1 \\
&= x^2(x+1) + (x+1) \\
&= (x+1)(x^2+1)
\end{aligned}\]

Etiquette and dirty tricks in LATEX 45/45 NSYSU


Correctly aligned

x3 + x2 + x + 1
= x 2 (x + 1) + (x + 1)
= (x + 1)(x 2 + 1)

\[\begin{aligned}
&\mathrel{\phantom{=}}x^3 + x^2 + x + 1 \\
&= x^2(x+1) + (x+1) \\
&= (x+1)(x^2+1)
\end{aligned}\]

Enjoy! Thanks!
Etiquette and dirty tricks in LATEX 45/45 NSYSU

You might also like