LaTex2Web logo

Documents Live, a web authoring and publishing system

If you see this, something is wrong

Collapse and expand sections

To get acquainted with the document, the best thing to do is to select the "Collapse all sections" item from the "View" menu. This will leave visible only the titles of the top-level sections.

Clicking on a section title toggles the visibility of the section content. If you have collapsed all of the sections, this will let you discover the document progressively, from the top-level sections to the lower-level ones.

Cross-references and related material

Generally speaking, anything that is blue is clickable.

Clicking on a reference link (like an equation number, for instance) will display the reference as close as possible, without breaking the layout. Clicking on the displayed content or on the reference link hides the content. This is recursive: if the content includes a reference, clicking on it will have the same effect. These "links" are not necessarily numbers, as it is possible in LaTeX2Web to use full text for a reference.

Clicking on a bibliographical reference (i.e., a number within brackets) will display the reference.

Speech bubbles indicate a footnote. Click on the bubble to reveal the footnote (there is no page in a web document, so footnotes are placed inside the text flow). Acronyms work the same way as footnotes, except that you have the acronym instead of the speech bubble.

Discussions

By default, discussions are open in a document. Click on the discussion button below to reveal the discussion thread. However, you must be registered to participate in the discussion.

If a thread has been initialized, you can reply to it. Any modification to any comment, or a reply to it, in the discussion is signified by email to the owner of the document and to the author of the comment.

Publications

The blue button below that says "table of contents" is your tool to navigate in a publication.

The left arrow brings you to the previous document in the publication, and the right one brings you to the next. Both cycle over the publication list.

The middle button that says "table of contents" reveals the publication table of contents. This table is hierarchical structured. It has sections, and sections can be collapsed or expanded. If you are a registered user, you can save the layout of the table of contents.

Table of contents

First published on Friday, Jan 10, 2025 and last modified on Tuesday, Jan 21, 2025

LaTeX for the non mathematician

François Chaplais

Using LaTeX as a document authoring tool is beneficial even if you never use equations.

LaTeX is especially useful if

  • Your document has a hierarchical structure, featuring sections, subsections, etc.

  • there are lots of cross references in the document, meaning that you often mention some part of the document within another part of the document.

Moreover, using LaTeX2Web lets you publish your document into a mobile-friendly web page.

Most of the content in a LaTeX document is just plain text. LaTeX2Web natively supports non-English characters, such as Latin accented characters, Cyrillic text, and text in many other language systems. Paragraphs are created when encountering a blank line.

The rest of LaTeX is comprised of LaTeX commands and LaTeX environments. Environments are specialized commands that mark the beginning and the end of content blocks that have special meaning, depending on the name of the environment.

Before going on, check if you know how to type a backslash character on your keyboard, because it is used all the time in LaTeX.

1 The structure of LaTeX commands

If you use just plain text (with multibyte encoding in LaTeX2Web), just type your text and you are good to go. Paragraphs are created each time a blank line is encountered.

Beyond this, you will have to use LaTeX commands. A LaTex command is built with the following contiguous components:

  • the command name: the command name is characterized by the fact that it begins with a backslash character. So you will use this character often in a LaTeX document.

  • optional parameter(s): each optional parameter is enclosed in brackets: [optional parameter]. Since these parameters are optional, they can be omitted in the command.

  • mandatory parameter(s): each parameter is enclosed in curly braces: {mandatory parameter}

As a summary, here is pseudo-code that represents a valid LaTeX command structure:

\name[optional]{mandatory}

2 Sectioning commands

The sectioning commands define the structure of your document. There are 7 of them, going from the highest level to the lowest one:

  • \part

  • \chapter

  • \section

  • \subsection

  • \subsubsection

  • \paragraph

  • \subparagraph

\part and \chapter should used only in long documents, like a memoir or a book.

Each sectioning command has one mandatory parameter, which is the title of the section. The title may include LaTeX code. If a star * character is added at the end of the sectioning command, the section will not be numbered. Here is an example of a sectioning command:

\section{Introduction}

In print, the sectioning commands are only used to produce a title with specific formatting. In LaTeX2Web, they are first-class citizens. They do not only create titles, but they also have content. LaTeX2Web documents are thus explicitly organized hierarchically.

3 Cross references

LaTeX is especially good at referencing content. This is done in two steps.

3.1 Create the label

First, a label is attached to the content that should be referenced. This label must be unique in order for the reference to work. It is created using the \label command. For instance, the following code :

\section{Introduction}\label{introductionSection}

will attach the introductionSection label to the introduction.

The parameter of the \label command is the name of the label.

3.2 Reference the content

To reference content, you use the \ref command, its (mandatory) parameter being the name of the label. The command can be used in any text content.

Here is a usage example:

As we said in the introduction \ref{introductionSection}, .....

What will happen then? It depends on how you use LaTeX

  • in print, the \ref command produces the number attached to the content. For instance, if the introduction is the first section, the command will put the number 1 in the flow of the text. This gives: As we said in the introduction 1, ......

  • in PDF, the \ref command also insert the number 1, but clicking on the number will bring focus to the introduction.

  • In LaTeX2Web, when you click on the number 1, the content (here the introduction) is displayed as close as possible to the referencing text. This way, you both see the referencing and the referenced content.

4 Paragraph/inline content

While sections define the hierarchy of a document, inline content is the basic building block of document content. Inline content is essentially text with some possible variations.

Environments, that we shall discover later on, are blocks of content, which do not wrap along the vertical limits of the document. Environments may include inline text, but the converse is false.

4.1 Text styling

There are eight text styling commands, which can also be viewed as a change in font usage. The commands have a two-letter name, and the parameter is the text to which the styling should be applied. Here is a table.

CommandStyle
\rmRoman, i.e. normal text
\emEmphasized, used for true italics
\bfBold
\itItalic, see \em
\slSlanted, aka false italics
\sfSans Serif
\scSmall Capitals
\ttMonospace (\tt stands for typewriter)

4.2 Paragraphs

Paragraphs consist of inline text that stands between two blocks of empty lines. One blank line can be omitted if the paragraph is at the beginning or end of a section or environment.

4.3 Other commands for inline text

4.3.1 Footnotes

The LaTeX command

\footnote{content}

wil produce a footnote where content can be any inline text.

In print, the footnote is displayed at the bottom of the page. In LaTeX2Web, since there is no kind of page, the footnote is indicated by a speech bubble. The footnote content is revealed by clicking on the bubble.

4.3.2 HTML links

There are two commands to embed HTML links

\href{URL}{displayed text}

will display displayed text as a link to URL.

\url{URL}

is a shortcut for \href{URL}{URL}.

4.3.3 Horizontal separator

\rule

will display a horizontal divider.

4.3.4 Margin note

\marginpar{content}

will display the content as a side note.

4.3.5 Framed text

\fbox{content}

will draw a rectangle border around the content.

5 Environments

Environments define a scope which, in many cases, is semantically meaningful. If name is the name of the environment, the general syntax for an environment is the following :

\begin{name}
... content ...
\end{name}

Environments are a block of content that cannot split across lines. In general, environments can be numbered and have a label.

We give now some information about basic environments, from the most general to the most particular. This classification means that environments that precede another environment can contain this lower-level environment.

5.1 Theorems

While theorems are generally part of mathematical content, they are actually general blocks with a special place in the document hierarchy.

Theorems are general-purpose containers that can include almost anything, except sections and other theorems. Theorems are great to focus on specific content of varied nature, which can be used for reference in the rest of the document.

Theorems contain important stuff.

There can be multiple types of theorems, which semantically categorize the kind of content they have.

Theorems have typically a label attached to them.

5.1.1 Theorem definition

A theorem class is defined as follows:

\newtheorem{theoremName}{Displayed name of the theorem}

5.1.2 Usage

Example usage

\begin{theoremName}[optional specific name for this theorem]\label{youShouldUseALabel}
... content ...
\end{theoremName}

The output will typically look like

Displayed name of the theorem 1
.. content ...

If you have specified an optional name for this theorem instance, the result will look like:
Displayed name of the theorem 1 (optional specific name for this theorem)
.. content ...

5.1.3 Usage example

We define the summary theorem class:

\newtheorem{summary}{Summary}

and use it like this:

\begin{summary}[Theorems]\label{theoremSummary}
Theorems are general purpose container that can include about anything, except sections and other theorems. Theorems are great to focus on specific content of varied nature, which be used for reference in the rest of the document. Theorems contain \em{important} stuff.

There can be multiple types of theorems, which semantically categorize which kind of content they have.

Theorems have typically a label attached to it.
\end{summary}

will yield
Summary 1 (Theorems)
Theorems are general purpose container that can include about anything, except sections and other theorems. Theorems are great to focus on specific content of varied nature, which be used for reference in the rest of the document. Theorems contain important stuff.

There can be multiple types of theorems, which semantically categorize which kind of content they have.

Theorems have typically a label attached to it.

5.2 Quotations

There are three environment for quotation-like content: quote, quotation and verse. In LaTeX2Web, the three are the same.

The code

\begin{quote}
We must let go of the life we have planned, so as to accept the one that is waiting for us.

Joseph Campbell
\end{quote}

gives

We must let go of the life we have planned, so as to accept the one that is waiting for us.

Joseph Campbell

5.3 Lists

Lists are environments that produce ... lists. Lists consist of a succession of items. Items are separated by \item commands. The \item command has no mandatory parameter. It can have an optional parameter, whose value will replace the list item beginning, which is usually a bullet or a number.

Lists can contain other lists (recursivity) and include anything except sections and theorem (hierarchy).

The environment is itemize for un-numbered lists, and enumerate is for numbered lists. For instance,

\begin{itemize}
\item I am the first
\begin{itemize}
\item No, it's me
\end{itemize}
\item I am at the end
\end{itemize}

will yield

  • I am the first

    • No, it's me

  • I am at the end

5.4 Tables and tabular

A table environment contains two things

  • a caption specified by the mandatory argument of a \caption command

  • the table itself, which is contained in a tabular environment.

We shall not go into the details of the tabular environment syntax, since it is quite complicated. We advise the reader to use the LaTeX2Web specific environment named csv, which imports a CSV (produced by Excel, for instance) directly into the web page.

5.5 Figure and images

A figure environment contains two things

  • a caption specified by the mandatory argument of a \caption command

  • an \includegraphics command, whose mandatory parameter specifies the location of the image.

The location can point to a local graphic file (which typically has been uploaded as part of the document project). Additionally, in LaTeX2Web, the location may consist of a valid URL that points to the graphic file on the internet.

Here is an example code for a remote image:

\begin{figure}\label{remoteImage}
\includegraphics{https://www.dropbox.com/scl/fi/zm0i4nqqd63ughip9a64l/old-press-printing-machine-2023-11-27-05-34-50-utc.jpg?rlkey=vbyeznilb16hww8kmafmyriz9&raw=1}
\caption{A printing machine}
\end{figure}

The image files must be in one of the folllowing formats

  • png

  • jpg

  • gif (included animated gif)

  • svg

6 LaTeX2Web specific environments and commands

6.1 CSV tables

CSV tables are tables that are imported directly from a CSV file. The columns of the table are sortable.

Here is an example code:

\begin{csv}
\label{csvTable}
\caption{A sample table parsed from a CSV file.}
\url{test.csv}
\end{csv}

Here \url points to a local file, but a valid URL can be used to fetch a remote CSV file.

Optionally, you can use the \delimiter command to specify the column delimitor (it defaults to comma), and the \separator command to specify the string that represents the decimal separator (it default to period).

6.2 The slider environment

This environment is useful to display a slideshow in your page. Each slide can contain just about anything, except a slider or a section.

The syntax is very simple:

\begin{slider}\label{optional label for the slider}
\caption{optional caption for the slider}
\begin{slide}
... content ...
\end{slide}
\begin{slide}
... more content ....
\end{slide}
... maybe more slides
\end{slider}

You can put anything into a slide except

  • another slider

  • a section

The slider environment is great if you want to make a presentation.

6.3 The grid environment

The LaTeX grid environment lets you put successive blocks of content one after another, in such a way that this "line" of blocks wrap around the page when necessary.

Syntaxically, the grid environment is very similar to the slider environment. It works like this :

\begin{grid}
\begin{gridItem}
... content ...
\end{gridItem}
\begin{gridItem}
... more content ....
\end{gridItem}
... maybe more grid blocks
\end{grid}

You can put anything into a grid except

  • another grid

  • a theorem

  • a slider

  • a section

6.4 Videos

Video objects can be incorporated in LaTeX2Web.

The videos can be of two types:

  • standalone videos in the mp4 format

  • YouTube videos

The syntax is the following:

\begin{video}\label{}
\url{the URL to your video}
\caption{}
\type{}
\height{}
\theme{}
\end{video}

If the label is specified, there will be a number attached to the video. caption works like for images or tables.

If the type is not specified, it defaults to mp4. The other type is youtube.

The height is an integer specifying the height of the video in pixels. If not specified, the height defaults to 700.

If specified, a theme can be applied to the video player. There are four available:

  • city

  • fantasy

  • forest

  • sea

6.5 Image links

In LaTeX2Web, images can be turned into links.

The images can be remote or local. Here is an example

\begin{imageLink}
\url{https://latex2web.app/}
\imageUrl{https://www.dropbox.com/scl/fi/9fya4wgacqow8enzfks7q/Logo-LaTeX2Web.jpeg?rlkey=0g316mrra2mo2ciicvuc1yv30&raw=1}
\alt{The LaTeX2Web logo}
\end{imageLink}

This code displays the LaTeX2Web logo, and when you click on it, you are redirected to the LaTeX2Web home page.

\imageUrl contains either a valid link to an image, or the name of an image file that belongs to your LaTeX2Web project.

\alt is the text that will be displayed if the image is missing.

6.6 The \refInput command

The \refInput command is designed to import a part of an external document into the current document flow. This is possible only if you are the owner or the co-author of a document.

The command is designed to create composite documents that have parts that come from other documents.

\refinput commands are placed inside an import environment.

The mandatory parameter of the \refinput command is the identifier of the remote document block.

This identifier consists of two parts

  • the identification of the document

  • the identifier of the block within this document

This document identifier is the last component of the URL that is used for displaying a document. The block identifier can be two things:

  • if a label command has been use to reference the block, the command parameter (aka label) will be used

  • if no label has been defined by the \label command, a generic label will be generated by LaTeX2Web for the block. Be aware that this label is valid as long as the hierarchy of abjects that contain the block has not been changed. So, you are an author and plan to share some content, you should rather use the \label command.

6.6.1 Example

\begin{import}
\refInput{Empirical-averaging-in-deterministic-optimal-control/kJdefinition}
\refInput{Empirical-averaging-in-deterministic-optimal-control/mainAssumption}
\refInput{Empirical-averaging-in-deterministic-optimal-control/Empirical-averaging-in-deterministic-optimal-control/section-5/section-1}
\end{import}

6.6.2 How to get an object identifier

To fetch the identifier of a box, check the Fetch labels option in the status bar at the bottom of the page. After that, clicking anywhere in the document will propose you a list of objects for which you can fetch a label. When a genuine label exists, the object is followed by the 🏷️ tag emoji. After you select an object, its identifier is put into the clipboard.

When your done, uncheck the Fetch labels options in the status bar.