Sphinx Cheatsheet Commands

Collection of default sphinx commands

Text Formatting

Simple text formatting:

italic

bold

Bullet lists:

  • bullet 1

  • bullet 2

  • bullet 3

Numbered lists:

  1. item 1

  2. item 2

  3. item 3

Code for Text Formatting.

*italic*
**bold**

Bullet lists:

* bullet 1
* bullet 2
* bullet 3

Numbered lists:

#. item 1
#. item 2
#. item 3

Headers

Headers can be added by using different underlining. Optionally, an header can have a label. You can make references to a header using its label as follows: Section Heading with label.

Heading Level 1

Heading Level 2

Heading Level 3

Heading Level 4

Heading with label

Code for Headers.

Heading Level 1
================

Heading Level 2
----------------

Heading Level 3
^^^^^^^^^^^^^^^^

Heading Level 4
~~~~~~~~~~~~~~~~

.. _sec-heading:

Heading with label
------------------

Figures

Figure are created using the following code. A figure points to a filename and has a caption. Optionally, you can add a label and set the width, alignment and other common figure properties. You can make references to a figure using its label as follows: Figure Fig. 1.

_images/lake-at-cottage.jpg

Fig. 1 Photo by Kodiak1

Code for Figures.

.. _fig-lake:

.. figure:: _static/lake-at-cottage.jpg
        :width: 400px
        :align: center

        Photo by `Kodiak1 <https://freeimages.com//photographer/Kodiak1-56473>`_

Tables

Tables are created using the following code. A table has a captionfigure points to a filename and has a caption. Optionally, you can add a label. You can make references to a table using its label as follows: Table Table 1.

Table 1 Different wave breaking formulations implemented

Wave breaking formula

Type of waves

keyword

Roelvink (1993a)

Instationary

roelvink1

Roelvink (1993a) extended

Instationary

roelvink2

Daly et al. (2010)

Instationary

roelvink_daly

Baldock et al. (1998)

Stationary

baldock

Janssen & Battjes (2007)

Stationary

janssen

Code for Tables.

.. _tab-wave-breaking:

.. table:: Different wave breaking formulations implemented

        +-----------------------------+-----------------+------------------+
        | Wave breaking formula       | Type of waves   | keyword          |
        +=============================+=================+==================+
        | Roelvink (1993a)            | Instationary    | roelvink1        |
        +-----------------------------+-----------------+------------------+
        | Roelvink (1993a) extended   | Instationary    | roelvink2        |
        +-----------------------------+-----------------+------------------+
        | Daly et al. (2010)          | Instationary    | roelvink_daly    |
        +-----------------------------+-----------------+------------------+
        | Baldock et al. (1998)       | Stationary      | baldock          |
        +-----------------------------+-----------------+------------------+
        | Janssen & Battjes (2007)    | Stationary      | janssen          |
        +-----------------------------+-----------------+------------------+

Equations

Equations can be created using Latex math code or by copying and pasting from MathType. An equation is created using the following code. An equation has a label. You can make references to an equation using its label as follows: Equation (1).

(1)\[\begin{split}\begin{array}{l} {k_{x} =k_{x}^{n-1} +k_{x}^{:} } \\ {k_{y} =k_{y}^{n-1} +k_{y}^{:} } \\ \end{array}\end{split}\]

Inline math can be added as follows: \(k_x\).

Code for Equations.

.. math::
        :label: eikonal

        \begin{array}{l}
        {k_{x} =k_{x}^{n-1} +k_{x}^{:} } \\
        {k_{y} =k_{y}^{n-1} +k_{y}^{:} } \\
        \end{array}

Inline math can be added as follows: :math:`k_x`.

Table of contents

This directive inserts a “TOC tree” at the current location, using the individual TOCs (including “sub-TOC trees”) of the documents given in the directive body. Relative document names (not beginning with a slash) are relative to the document the directive occurs in, absolute names are relative to the source directory. A numeric maxdepth option may be given to indicate the depth of the tree; by default, all levels are included.

Simple Table of contents:

Numbered Table of contents:

Titled Table of contents:

Titled Toctree

Referenced Table of contents Titled Toctree:

Code for Table of contents:

Simple Table of contents:

.. toctree::
        very/index

Numbered Table of contents:

.. toctree::
        :numbered:

        reference

Titled Table of contents:

.. toctree::
        :caption: Titled Toctree

        extensions

Referenced Table of contents :ref:`toc-ref`:

.. toctree::
        :caption: Titled Toctree
        :name: toc-ref

        reference

Citations

Standard reST citations (ref) are supported, with the additional feature that they are “global”, i.e. all citations can be referenced from all files. Use them like so:

Lorem ipsum [Ref] dolor sit amet.

Ref

Book or article reference, URL or whatever.

Citation usage is similar to footnote usage, but with a label that is not numeric or begins with #.

Code for Citations.

Lorem ipsum [Ref]_ dolor sit amet.

.. [Ref] Book or article reference, URL or whatever.