Sideway
output.to from Sideway
Draft for Information Only

Content

LaTeX Typesetting Document Features
LaTeX Typeset Document
LaTeX Typeset Structure
    LaTeX Typeset Document Example
Spacing
  Space
    LaTeX Space Example
  Line Break
    LaTeX Line Break Example 1
    LaTeX Line Break Example 2
LaTeX Comment
    LaTeX Comment Example
Special and Reserved Characters
  Reserved Characters
    LaTeX Reserved Character Example
  Special Characters
    LaTeX Special Character Example
  Special Font Encoding
    LaTeX Font Encoding Example
  Special Grouping Characters
    LaTeX Grouping Characters Example
Escape Characters
    LaTeX Escape Characters Example
LaTeX Commands
  Command
   Syntax
  Switch
LaTeX Grouping
  LaTeX Environments
  LaTeX Groups
Unit
Resources and References

LaTeX Typesetting Document Features

LaTeX Typeset Document

$\(\LaTeX\)$, created by Leslie Lamport, is a set of macros used to simplify $\(\TeX\)$ typesetting, whereas $\(\TeX\)$, created by Donald Knuth, is a low-level markup and programming language. $\(\LaTeX\)$ typeset document is a plain text file of rendered source text with $\(\LaTeX\)$ markup.

LaTeX Typeset Structure

$\(\LaTeX\)$ uses a tree like structure to model $\(\LaTeX\)$ typeset document. A $\(\LaTeX\)$ typeset document is mainly divided into two main divisions, the initial and preamble commands division and the document environment division. The document environment division begins with an opening command, "\begin{docunment}" and ends with and closing command, "\end{document}".
LaTeX Typeset Document Example
Code
\documentclass{standalone}
\begin{document} 
Hello world!
\end{document} 
Output
image

Spacing

In $\(\LaTeX\)$ typesetting document, space and line break are used as delimiter. Words are separated by spaces, while paragraphs are separated by blank lines, that is two or more consecutive line breaks. And a single line break alone is equivalent to a space. Although word space, line space, and paragraph space are automatically generated by $\(\LaTeX\)$ engine, these spacing can be specified through typesetting commands.

Space

Similar to other markup language, all whitespace characters are treated as a space. Several consecutive spaces are treated as one single space. Opening space of a line is always ignored. Word space, line space, and paragraph space
LaTeX Space Example
Code
\documentclass[variwidth]{standalone}
\begin{document} 
               Hello                         world!
\end{document} 
Output
image

Line Break

A single line break always yields a space. However, more then one consecutive line breaks, empty lines, may imply the end of a paragraph if applicable.
LaTeX Line Break Example 1
Code
\documentclass[varwidth]{standalone}
\begin{document} 
   Hello world! 
    Hello world!       Hello world! 
       
Hello world!
  
     
    Hello world!\par    Hello    world!



\end{document} 
Output
image
LaTeX Line Break Example 2
Code
\documentclass{standalone}
\begin{document} 
   Hello world! 
    Hello world!       Hello world! 
       
Hello world!
  
     
    Hello world!\par    Hello    world!



\end{document} 
Output
image

LaTeX Comment

$\(\LaTeX\)$ ignores the % character and the rest characters of the current line, including the line break. All whitespaces at the beginning of the next line will also be ignored because opening space of a line is always ignored.
LaTeX Comment Example
Code
%LaTeX Comment
\documentclass{standalone}
\begin{document} 
%LaTeX Comment
Hello world!
\end{document} 
Output
image

Special and Reserved Characters

Some symbols that are either having a special meaning in $\(\LaTeX\)$ or unavailable in all the fonts, are defined as reserved characters. These symbols are %, \, #, {, }, $, ^, _, ~, &, :, *, <, >, |, ', [, ], (, and ).

Reserved Characters

Some Characters are reserved for initializing a typesetting mechanism in $\(\LaTeX\)$.
CharacterDescription #to initiate a parameter $⋯$to initiate an inline math environment withn the running text. %to initiate a comment; both % and the rest of the line are ignored &to initiate an alignment tab {⋯}to initiate a text block, or arguments \to initiate a command or a literal mask. _to initiate an index in math mode. ^to initiate an exponent in math mode. ~to initiate a no break space
LaTeX Reserved Character Example
Code
%Reserved Characters
\documentclass[varwidth]{standalone}
\usepackage{varwidth}
\newcommand\cmd[1]{#1}
\begin{document}
\begin{varwidth}{2.5cm}
$aaaa^2_i$ aaaa~hhhh hhh hh\\
$aaaa^2_i$ aaaa hhhh hhh hh
\end{varwidth}
\begin{tabular}{c c}
\#1 & \#2\\
\end{tabular}
\end{document} 
Output
image

Special Characters

The typesetting text for some characters are difference in text mode and math mode.
CharacterDescriptionText ModeMath Mode :is used as punctuation colon in text mode, and used as a relation colon symbol in math mode.\begin{align}\text{H:M}\end{align}\begin{align}H:M\end{align} *is used as asterisk symbol in text mode, and used as multiplication times sign in math mode\begin{align}\text{H*M}\end{align}\begin{align}H*M\end{align} <is used as inverted exclamation mark in text mode, and used as less than symbol in math mode.\begin{align}\text{H¡M}\end{align}\begin{align}H<M\end{align} >is used as inverted question mark in text mode, and used as greater than symbol in math mode.\begin{align}\textrm{H¿M}\end{align}\begin{align}H>M\end{align} |is used as long horizontal line in text mode, and used as vertical line in math mode.\begin{align}\textrm{H—M}\end{align}\begin{align}H|M\end{align} 'is used as single quotation mark in text mode, and used as single quotation mark in math mode.\begin{align}\text{H'M}\end{align}\begin{align}H'M\end{align}
LaTeX Special Character Example
Code
\documentclass[varwidth]{standalone}
\begin{document}
\begin{tabular}{ccc}
Character & Text Mode & Math Mode\\
: & H:M & $H:M$\\
** & H*M & $H*M$\\
\textless & H<M & $H<M$\\
\textgreater & H>M & $H>M$\\
\textbar & H|M & $H|M$\\
\`{} & H`M & $H`M$\\
\end{tabular}
\end{document}
Output
image

Special Font Encoding

The two major font encodings, used for Latin languages are OT1 (Donald Knuth’s 7-bit encoding) and T1 (the new 8-bit ‘Cork’ encoding). LaTeX2e has support for both OT1 and T1 built-in. However, these two font encodings do not share the same set of characters.
CharacterDescriptionOT1 Font EncodingT1 Font Encoding <is used as inverted exclamation mark in text mode, and used as less than symbol in math mode.¡< >is used as inverted question mark in text mode, and used as greater than symbol in math mode.¿> |to initiate optional arguments in command syntax|
LaTeX Font Encoding Example
Code
\documentclass[varwidth]{standalone}
\usepackage{multirow}
\begin{document}
\begin{tabular}{c|ccc}
Mode & Character & OT1  encoding & T1  encoding\\
\hline
\multirow{3}{*}{text mode}&\textless & H<M & {\fontencoding{T1}\selectfont H<M}\\
&\textgreater & H>M & {\fontencoding{T1}\selectfont H>M}\\
&\textbar & H|M & {\fontencoding{T1}\selectfont H|M}\\
\hline
\multirow{3}{*}{math mode}&\textless & $H<M$ & ${\fontencoding{T1}\selectfont H<M}$\\
&\textgreater & $H>M$ & ${\fontencoding{T1}\selectfont H>M}$\\
&\textbar & $H|M$ & ${\fontencoding {T1}\selectfont H|M}$\\
\end{tabular}
\end{document}
Output
image

Special Grouping Characters

Character PairCodeDescription [,][⋯]to initiate optional arguments in command syntax [,]\[⋯\]to initiate a displaymath environment in the running text. (,)\(⋯\)to initiate an inline math environment in the running text.
LaTeX Grouping Characters Example
Code
\documentclass[varwidth]{standalone}
%  varwidth option
\begin{document}
aadkljfdsklfj \[x^2\] dfkdlfjslk \(x^2\) sd;fldskjfkds \[x^2\]
\end{document}


Output
image

Escape Characters

Escaped Characters can be used to represent reserved characters and to invoke an alternative interpretation on the following characters in a character sequence Escape CharacterCharacterRemarks \##"#" reserved to reference an arguments for a user defined command \$$"$" reserved to start and finish math mode \%%"%" reserved to specify a comment \&&"&" reserved as the alignment character \{{"{" reserved as an open delimiter to group and separate commands from its surroundings \}}"}" reserved as a close delimiter to group and separate commands from its surroundings \\a new paragraph"\" reserved to specify a command \textbackslash\ $\backslash$\ \_H_H"_"reserved to specify a subscript in math mode $H_{H}$HH \^HH"^" reserved to specify a superscript in math mode \^{}H^H \textasciicircum^ $\hat{}$^ $\^{H}$HH \~HH"~" reserved as an unbreakable space \~{}H~H \textasciitilde~ \texttildelow~ $\tilde{\ }$~ $\sim$~ $_\textrm{\symbol{126}}$~ $\|$ |an em dash (—). $|$| \textbar| $\vert$| $\mid$|
LaTeX Escape Characters Example
Code
\documentclass{standalone}
\usepackage{multirow}
\usepackage{makecell}
\def\arraystretch{1.3}
\begin{document}
\begin{tabular}{c|c|>{\centering\arraybackslash}p{12mm}|>{\centering\arraybackslash}p{12mm}|l}
Character&\thead{Escape\\Character}&\thead{text\\mode} &\thead{math\\ mode}&Remarks\\
\hline
\# & \textbackslash\# & \# & $\#$\\
\$ & \textbackslash\$ & \$ & $\$$\\
\% & \textbackslash\% & \% & $\%$\\
\& & \textbackslash\& & \& & $\&$\\
\{ & \textbackslash\{ & \{ & $\{$\\
\} & \textbackslash\} & \} & $\}$\\
\hline
\multirow{3}{*}{\textbackslash} & endline\textbackslash\textbackslash\ newline& \makecell{endline\\ newline} & $\makecell{endline\\ newline}$\\
& \textbackslash textbackslash & \textbackslash && text mode\\
& \$\textbackslash backslash\$ & & $\backslash$ & math mode\\
\hline
\multirow{2}{*}{\_} & H\textbackslash\_\{H\} & H\_{H} & $H\_{H}$ &\\
& \$H\_\{H\}\$ &  & $H_{H}$ & math mode\\
\hline
\multirow{4}{*}{\^} &\textbackslash\textasciicircum H & \^H & & text mode\\
&\textbackslash\^{}\{\}H & \^{}H &  & text mode\\
&\textbackslash textasciicircum & \textasciicircum & & text mode\\
&\$\textbackslash hat\{\}\$ & & $\hat{}$ & math mode\\
&\$H\textasciicircum\{H\}\$ & & $H^{H}$ & math mode\\
\hline
\multirow{9}{*}{\~} &\textbackslash\textasciitilde H & \~H & & text mode\\
&\textbackslash\~{}\{\}H & \~{}H & & text mode\\
&\textbackslash textasciitilde & \textasciitilde & & text mode\\Y
&\textbackslash texttildelow & \texttildelow & & text mode\\
&\$\textbackslash tilde\{\textbackslash\ \}\$ &  & $\tilde{\ }$ & math mode\\
&\$\textbackslash sim\$ &  & $\sim$ & math mode\\
&\$\_\textbackslash textrm\{\textbackslash symbol\{126\}\}\$ &  & $_\textrm{\symbol{126}}$ & math mode\\
&aaa\textasciitilde hhhh aaa hhhh & aaa~hhhh aaa hhhh & $aaaa~hhhh aaaa hhhh$\\
\hline
\multirow{5}{*}{\textbar} & \textbar & | & $|$ \\
&\textbackslash textbar & \textbar & & text mode\\
&\$\textbackslash vert\$ & & $\vert$ & math mode\\
&\$\textbackslash mid\$ & & $\mid$ & math mode\\
&\textbackslash\textbar & & $\|$ & math mode\\
\end{tabular}
\end{document}
Output
image

LaTeX Commands

Command

The syntax of $\(\LaTeX\)$ command is
\commandname [option1,option2,...]{argument1}{argument2}...

Syntax

\commandname
$\(\LaTeX\)$ commands are case sensitive, and have two types of formats.
  • Starting with a backslash \ and commandname has a name consisting of letters only. In other words, commandname is terminated by a space, a number or any other non-letter.
  • Starting with a backslash \ and commandname has exactly one non-letter. In other words, commandname is terminated after that non-letter.
[option1,option2,...]
Some commands support optional parameters, which are added in square brackets [...] after the commandname.
{argument1}{argument2}...
some commands need an argument, which has to be given between curly braces {...} after the commandname.

Switch

A $\(\LaTeX\)$ command applys only to the specified arguments. Most standard $\(\LaTeX\)$ commands have a switch equivalent. Switches have no arguments, but apply on the rest of the scope, in other words the current group or environment. A switch should almost never be called outside of any scope, otherwise it will apply on the rest of the document.
\emph{emphasized text} % a command with argument
{\em emphasized text} % a switch
    

LaTeX Grouping

LaTeX Environments

Environment is the fundeamental $\(\LaTeX\)$ structural component. Environments form an implicit group to define a block sturcture of a $\(\LaTeX\)$ typeset document. Usually, a special layout is defined for the text inside an environment.
\begin{environmentname}
text ...
\end{environmentname}
Specific environment begins to change after \begin{environmentname} and specific environment will be ended after \end{environmentname} Similar to group, environments must be correctly nested. Besides, environments can also accept arguments.

LaTeX Groups

A group is created by putting text within braces, or curly brackets. The most common usage is to group the individual arguments of a $\(\LaTeX\)$ command. In general, $\(\LaTeX\)$ grouping is used to limit the scope of a specific local state by enclosing the part in curly braces. Groups must be correctly nested Control sequences \bgroup and \egroup can also be used to begin and end a group respectively. These control sequences allow to group a part when using braces won't be possible. Besides, pairs of single dollar signs $...$ and double dollar signs $$...$$ that used to delimit math mode are also define groups.

Unit

The recognized units recognized by $\(\LaTeX\)$ are
pt  point         (1 in = 72.27 pt)
pc  pica          (1 pc = 12 pt)
in  inch          (1 in = 25.4 mm)
bp  big point     (1 in = 72 bp)
cm  centimetre    (1 cm = 10 mm)
mm  millimetre
dd  didot point   (1157 dd = 1238 pt)
cc  cicero        (1 cc = 12 dd)
sp  scaled point  (65536 sp = 1 pt)

Resources and References


©sideway

ID: 200501402 Last Updated: 2/26/2022 Revision: 1


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019