Etiquette and dirty tricks in L A T EX Jephian C.-H. Lin - - PowerPoint PPT Presentation

etiquette and dirty tricks in l a t ex
SMART_READER_LITE
LIVE PREVIEW

Etiquette and dirty tricks in L A T EX Jephian C.-H. Lin - - PowerPoint PPT Presentation

Etiquette and dirty tricks in L A T EX 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 L A T EX


slide-1
SLIDE 1

Etiquette and dirty tricks in L

AT

EX

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 L

A

T EX 1/45 NSYSU

slide-2
SLIDE 2

T EX

◮ A typesetting system create by Donald Knuth ◮ Comes from the Greek root τǫχ, meaning art/craft, also the stem of “technology” ◮ Aim to produce the finest quality of typesetting ◮ Current version number: 3.1415926 ◮ History of T EX on the TeX Users Group web site ◮ Official manual: The T EXbook by Donald Knuth ◮ 大家來學 L

AT

EX by 李果正 Edward G.J. Lee

Etiquette and dirty tricks in L

A

T EX 2/45 NSYSU

slide-3
SLIDE 3

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 L

A

T EX 3/45 NSYSU

slide-4
SLIDE 4

About Knuth

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

Etiquette and dirty tricks in L

A

T EX 3/45 NSYSU

slide-5
SLIDE 5

L

AT

EX

◮ A typesetting system based on T EX ◮ Originally create by Leslie Lamport, now maintained by the L

AT

EX project ◮ contains various macros of T EX ◮ make the writing easier ◮ make the code more readable ◮ L

AT

EX: A Document Preparation System by Leslie Lamport

Etiquette and dirty tricks in L

A

T EX 4/45 NSYSU

slide-6
SLIDE 6

About Lamport

From the personal website of Lamport Etiquette and dirty tricks in L

A

T EX 5/45 NSYSU

slide-7
SLIDE 7

About Lamport

◮ Worked at SRI International and Microsoft Research ◮ Computer scientist, mathematician ◮ Turning Award winner

Etiquette and dirty tricks in L

A

T EX 5/45 NSYSU

slide-8
SLIDE 8

Pros and Cons

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

Etiquette and dirty tricks in L

A

T EX 6/45 NSYSU

slide-9
SLIDE 9

Pros and Cons

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

Etiquette and dirty tricks in L

A

T EX 6/45 NSYSU

slide-10
SLIDE 10

Sample file for L

AT

EX

\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 L

A

T EX 7/45 NSYSU

slide-11
SLIDE 11

Etiquette and Dirty Tricks in L

AT

EX

◮ Respect the original design ◮ Respect the style ◮ Dirty tricks

Etiquette and dirty tricks in L

A

T EX 8/45 NSYSU

slide-12
SLIDE 12

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 L

A

T EX 9/45 NSYSU

slide-13
SLIDE 13

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 L

A

T EX 9/45 NSYSU

slide-14
SLIDE 14

Respect the original design

Etiquette and dirty tricks in L

A

T EX 10/45 NSYSU

slide-15
SLIDE 15

The logo

◮ Type T EX (\TeX) and L

AT

EX (\LaTeX) when possible. ◮ Otherwise, type TeX and LaTeX. This displaced ‘E’ is a reminder that T EX is about typeset- ting, and it distinguishes T EX from other system names. —T EXbook, Chapter 1

Etiquette and dirty tricks in L

A

T EX 11/45 NSYSU

slide-16
SLIDE 16

The logo

◮ Type T EX (\TeX) and L

AT

EX (\LaTeX) when possible. ◮ Otherwise, type TeX and LaTeX. This displaced ‘E’ is a reminder that T EX is about typeset- ting, and it distinguishes T EX from other system names. —T EXbook, Chapter 1

Etiquette and dirty tricks in L

A

T EX 11/45 NSYSU

slide-17
SLIDE 17

The pronunciation

◮ T EX ∼ tech (the ‘ch’ is like that in Bach) ◮ 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. —T EXbook, Chapter 1

Etiquette and dirty tricks in L

A

T EX 12/45 NSYSU

slide-18
SLIDE 18

The pronunciation

◮ T EX ∼ tech (the ‘ch’ is like that in Bach) ◮ 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. —T EXbook, Chapter 1

Etiquette and dirty tricks in L

A

T EX 12/45 NSYSU

slide-19
SLIDE 19

EXERCISE 1.1 (T EXbook, Chapter 1) After you have mastered the material in this book, what will you be: A T EXpert, or a T EXnician?

Etiquette and dirty tricks in L

A

T EX 13/45 NSYSU

slide-20
SLIDE 20

EXERCISE 1.1 (T EXbook, Chapter 1) After you have mastered the material in this book, what will you be: A T EXpert, or a T EXnician? T

  • EXnician. There is no ‘s’ sound!

Etiquette and dirty tricks in L

A

T EX 13/45 NSYSU

slide-21
SLIDE 21

The pronunciation How about L

AT

EX?

One of the hardest things about using L

AT

EX is deciding how to pronounce it. This is also one of the few things I’m not going to tell you about L

AT

EX, since pronunciation is best determined by usage, not fiat. T EX 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. —L

AT

EX: A Document Preparation System, Chapter 1

Etiquette and dirty tricks in L

A

T EX 14/45 NSYSU

slide-22
SLIDE 22

The pronunciation How about L

AT

EX?

One of the hardest things about using L

AT

EX is deciding how to pronounce it. This is also one of the few things I’m not going to tell you about L

AT

EX, since pronunciation is best determined by usage, not fiat. T EX 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. —L

AT

EX: A Document Preparation System, Chapter 1

Etiquette and dirty tricks in L

A

T EX 14/45 NSYSU

slide-23
SLIDE 23

Focus on the writing

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

Etiquette and dirty tricks in L

A

T EX 15/45 NSYSU

slide-24
SLIDE 24

Line break and new paragraph

◮ \\ stands for a line break. ◮ An empty line stands for starting a new paragraph. ◮ 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 L

A

T EX 16/45 NSYSU

slide-25
SLIDE 25
  • beylines

If really necessary, use the obeylines environment. Name: Jephian Lin Major: Mathematics Known for: Shameless \begin{obeylines} Name: Jephian Lin Major: Mathematics Known for: Shameless \end{obeylines}

Etiquette and dirty tricks in L

A

T EX 17/45 NSYSU

slide-26
SLIDE 26

Math vs text

◮ Math is math. For example,

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

◮ Text is text. For example,

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

Etiquette and dirty tricks in L

A

T EX 18/45 NSYSU

slide-27
SLIDE 27

Text in displayed math

You say x > 1 and x < 3, but I say x < 1 or x > 3. You say \[x>1\text{ and }x<3,\] {\it but I say \[x<1\text{ 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 L

A

T EX 19/45 NSYSU

slide-28
SLIDE 28

Letters in the math mode

◮ Letters in math mode are treated as variables. ◮ In the text mode, ‘fi’ or ‘ff’ gets together (called ligature); but in the math mode, ‘fi’ or ‘ff ’ is separate.

◮ sinx (sin x): terrible. You mean s × i × n × x? ◮ sin x (\sin x): good.

◮ 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 n = si ✁ nx

n = six = 6?

Etiquette and dirty tricks in L

A

T EX 20/45 NSYSU

slide-29
SLIDE 29

Letters in the math mode

◮ Letters in math mode are treated as variables. ◮ In the text mode, ‘fi’ or ‘ff’ gets together (called ligature); but in the math mode, ‘fi’ or ‘ff ’ is separate.

◮ sinx (sin x): terrible. You mean s × i × n × x? ◮ sin x (\sin x): good.

◮ 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 n = si ✁ nx

n = six = 6?

Etiquette and dirty tricks in L

A

T EX 20/45 NSYSU

slide-30
SLIDE 30

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 L

A

T EX 21/45 NSYSU

slide-31
SLIDE 31

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

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

Etiquette and dirty tricks in L

A

T EX 22/45 NSYSU

slide-32
SLIDE 32

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

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

Etiquette and dirty tricks in L

A

T EX 22/45 NSYSU

slide-33
SLIDE 33

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

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

Etiquette and dirty tricks in L

A

T EX 22/45 NSYSU

slide-34
SLIDE 34

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

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

Etiquette and dirty tricks in L

A

T EX 22/45 NSYSU

slide-35
SLIDE 35

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

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

Etiquette and dirty tricks in L

A

T EX 22/45 NSYSU

slide-36
SLIDE 36

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

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

Etiquette and dirty tricks in L

A

T EX 22/45 NSYSU

slide-37
SLIDE 37

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

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

Etiquette and dirty tricks in L

A

T EX 22/45 NSYSU

slide-38
SLIDE 38

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

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

Etiquette and dirty tricks in L

A

T EX 22/45 NSYSU

slide-39
SLIDE 39

Accurate spacing

◮ Spaces between words are different from spaces between

  • sentences. The latter one is wider.

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

  • Dr. Lin
  • Dr. Lin
  • Dr. Lin

Dr.~Lin % correct Dr.\ Lin % not recommended

  • Dr. Lin % incorrect

Etiquette and dirty tricks in L

A

T EX 23/45 NSYSU

slide-40
SLIDE 40
  • 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 L

A

T EX 24/45 NSYSU

slide-41
SLIDE 41

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 L

A

T EX 25/45 NSYSU

slide-42
SLIDE 42

How to compile?

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

Etiquette and dirty tricks in L

A

T EX 26/45 NSYSU

slide-43
SLIDE 43

Good attitude

Try to resolve every warning message. Try your best to care about every single details. Be an awesome T EXnician!

Etiquette and dirty tricks in L

A

T EX 27/45 NSYSU

slide-44
SLIDE 44

Good attitude

Try to resolve every warning message. Try your best to care about every single details. Be an awesome T EXnician!

Etiquette and dirty tricks in L

A

T EX 27/45 NSYSU

slide-45
SLIDE 45

Good attitude

Try to resolve every warning message. Try your best to care about every single details. Be an awesome T EXnician!

Etiquette and dirty tricks in L

A

T EX 27/45 NSYSU

slide-46
SLIDE 46

Respect the style

Etiquette and dirty tricks in L

A

T EX 28/45 NSYSU

slide-47
SLIDE 47

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 L

A

T EX 29/45 NSYSU

slide-48
SLIDE 48

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 L

A

T EX 29/45 NSYSU

slide-49
SLIDE 49

Some conventions

Use the default environments. E.g., theorem, proof, . . . Use \emph{} when defining a new term.

Etiquette and dirty tricks in L

A

T EX 30/45 NSYSU

slide-50
SLIDE 50

Some conventions

Use the default environments. E.g., theorem, proof, . . . Use \emph{} when defining a new term.

Etiquette and dirty tricks in L

A

T EX 30/45 NSYSU

slide-51
SLIDE 51

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 L

A

T EX 31/45 NSYSU

slide-52
SLIDE 52

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 L

A

T EX 31/45 NSYSU

slide-53
SLIDE 53

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 L

A

T EX 32/45 NSYSU

slide-54
SLIDE 54

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 L

A

T EX 32/45 NSYSU

slide-55
SLIDE 55

Example (not recommended): Compute x2 − 1 = 0 = ⇒ (x + 1)(x − 1) = 0 = ⇒ x = ±1. Recommended example: Since x2 − 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 L

A

T EX 33/45 NSYSU

slide-56
SLIDE 56

Example (not recommended): Compute x2 − 1 = 0 = ⇒ (x + 1)(x − 1) = 0 = ⇒ x = ±1. Recommended example: Since x2 − 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 L

A

T EX 33/45 NSYSU

slide-57
SLIDE 57

Internal references and external citations

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

Theorem 1

If x = 1, then x + 1 = 2. Theorem 1 is very important. \begin{theorem} \label{thm:CH} If $x=1$, ... \end{theorem} Theorem~\ref{thm:CH} ... Using BibTeX for bibliography is recommended. (This keep the style in the references consistent.)

Etiquette and dirty tricks in L

A

T EX 34/45 NSYSU

slide-58
SLIDE 58

Internal references and external citations

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

Theorem 1

If x = 1, then x + 1 = 2. Theorem 1 is very important. \begin{theorem} \label{thm:CH} If $x=1$, ... \end{theorem} Theorem~\ref{thm:CH} ... Using BibTeX for bibliography is recommended. (This keep the style in the references consistent.)

Etiquette and dirty tricks in L

A

T EX 34/45 NSYSU

slide-59
SLIDE 59

Figures

Use vector graphics whenever possible. You may use the TikZ package, the Ipe extensible drawing editor,

  • r the Adobe Illustrator, and so on, to do so.

Etiquette and dirty tricks in L

A

T EX 35/45 NSYSU

slide-60
SLIDE 60

Figures

Use vector graphics whenever possible. You may use the TikZ package, the Ipe extensible drawing editor,

  • r the Adobe Illustrator, and so on, to do so.

Etiquette and dirty tricks in L

A

T EX 35/45 NSYSU

slide-61
SLIDE 61

◮ Put all figures in the figure environment. ◮ Put proper captions. ◮ 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 L

A

T EX 36/45 NSYSU

slide-62
SLIDE 62

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 L

A

T EX 37/45 NSYSU

slide-63
SLIDE 63

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 L

A

T EX 38/45 NSYSU

slide-64
SLIDE 64

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 L

A

T EX 38/45 NSYSU

slide-65
SLIDE 65

Dirty tricks

Etiquette and dirty tricks in L

A

T EX 39/45 NSYSU

slide-66
SLIDE 66

Strut

Matrix without strut:

  • A

B B⊤ C

  • Matrix with strut:
  • 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 T EXbook.

Etiquette and dirty tricks in L

A

T EX 40/45 NSYSU

slide-67
SLIDE 67

How to type this?

  1 1 1 1 A   \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 L

A

T EX 41/45 NSYSU

slide-68
SLIDE 68

How to type this?

  1 1 1 1 A   \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 L

A

T EX 41/45 NSYSU

slide-69
SLIDE 69

How to type this?

x3 + x2 + x + 1 = x2(x + 1) + (x + 1) = (x + 1)(x2 + 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 L

A

T EX 42/45 NSYSU

slide-70
SLIDE 70

How to type this?

x3 + x2 + x + 1 = x2(x + 1) + (x + 1) = (x + 1)(x2 + 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 L

A

T EX 42/45 NSYSU

slide-71
SLIDE 71

Wrong spacing after the equal signs

x3 + x2 + x + 1 =x2(x + 1) + (x + 1) =(x + 1)(x2 + 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 L

A

T EX 43/45 NSYSU

slide-72
SLIDE 72

Not aligned

x3 + x2 + x + 1 = x2(x + 1) + (x + 1) = (x + 1)(x2 + 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 L

A

T EX 44/45 NSYSU

slide-73
SLIDE 73

Correctly aligned

x3 + x2 + x + 1 = x2(x + 1) + (x + 1) = (x + 1)(x2 + 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 L

A

T EX 45/45 NSYSU

slide-74
SLIDE 74

Correctly aligned

x3 + x2 + x + 1 = x2(x + 1) + (x + 1) = (x + 1)(x2 + 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 L

A

T EX 45/45 NSYSU