(click anywhere to close)

# [LaTeX] Basic Syntax II

category: Writing | course: LaTeX | difficulty:

Continuing on last chapter, I’ll discuss some of the basic syntax that will become important, especially later on.

## Environments

Often, we want a certain typesetting or command sequence to apply to a big block of text and nested commands, and that’s when we use an environment. Environments need to be opened and closed, using:

\begin{environmentName} text and commands… \end{environmentName}

For example, lists are environments, as well as tables and figures.

## Switch Variation

Most commands with a single required argument have an alternative syntax, that is sometimes much easier to use, which is called the switch. Such a syntax doesn’t need its required arguments stated right after it, but rather applies the command to the whole block or environment that it’s in.

{ \switchCommand text }

is the same as

\command{text}

I’ll try to provide the switch alternative as well, whenever I introduce a new command throughout this course.

Some \emph{emphasized text}. {Some \em emphasized text}

## Star Variation

Most commands also have a star variation, which simply means appending an asterisk to the command name.

\command*[optionalArgument]{requiredArgument}

This usually changes the command’s behaviour to something that is more desired in only some of the use cases.

\section{I am a section}
\section*{Me too!}
\section{And three make a crowd.}

The only thing that doesn’t use the regular command syntax, are comments. But that’s only logical – comments are not interpreted and not used in the final document, so the computer doesn’t need to see them. Comments are only there for you to tell yourself what certain parts of the code do.

Single line comments are created with % comment.

This is %an inline comment
cool!

If you hadn’t noticed already: LaTeX is case-sensitive, and nearly all commands are lowercase. So if an error occurs, an uppercase letter might have accidentally slipped in.

CONTINUE WITH THIS COURSE
Do you like my tutorials?
To keep this site running, donate some motivational food!
Crisps
(€2.00)
Chocolate Milk
(€3.50)
Pizza
(€5.00)