Sphinxチートシート

セクションの目次(Table of Contents)

.. contents:: 目次
    :local:
    :backlinks: none
    :depth: 2

セクション(Sections)

セクションは記号が出現した順番でレベル分けされる。次の順番でレベルを分ける。

Section H1(ページタイトル)
==========================

Section H2
-----------

Section H3
~~~~~~~~~~

.. rubric:: 小見出し(ドキュメントのセクションと関係のない見出し)

通常テキスト

Section H3

小見出し(ドキュメントのセクションと関係のない見出し)

通常テキスト

コンパウンド(Compound)

.. compound::

    複数の要素をまとめる、複合する。

    .. code-block:: text

        コードブロック

    定義リスト
        リストの説明

複数の要素をまとめる、複合する。

コードブロック
定義リスト

リストの説明

改行、改段(Line breaks, Paragraphs)

| このように
| 改行する。

改段は空行をいれる。

空行を入れたあと。
このように
改行する

改段は空行をいれる。

空行を入れたあと。

引用(Block quote)

インデントを入れて引用する。

インデントを入れて引用する。

引用(Pull quote)

.. pull-quote::

    引用文

引用文

文字の装飾、インラインマークアップ(Inline markup)

- 通常 abc
- **太字 abc**
- *イタリック abc*
- ``インラインリテラル abc``
- キーボード :kbd:`Esc`
- ボタン :menuselection:`Install`
- メニュー選択 :menuselection:`File --> Exit`
  • 通常 abc

  • 太字 abc

  • イタリック abc

  • インラインリテラル abc

  • キーボード Esc

  • ボタン Install

  • メニュー選択 File ‣ Exit

箇条書きリスト(Lists)

- tea

    - green tea
    - black tea

        - earl gray
        - darjeeling

- coefee

#. men

    #. ramen

        #. miso
        #. shio

#. gohan
  • tea

    • green tea

    • black tea

      • earl gray

      • darjeeling

  • coefee

  1. men

    1. ramen

      1. miso

      2. shio

  2. gohan

フィールドリスト(Field Lists)

:たまねぎ: 1個
:にんじん:
    2本。
    新鮮なもの。
:ドレッシング:
    - オリーブオイル 大さじ1
    - 塩少々
たまねぎ:

1個

にんじん:

2本。 新鮮なもの。

ドレッシング:
  • オリーブオイル 大さじ1

  • 塩少々

定義リスト(Definition Lists)

たまねぎ
    Onion
にんじん
    Carrot
たまねぎ

Onion

にんじん

Carrot

用語集(Glossary)

.. glossary::

    たまねぎ
        Onion

    にんじん
        Carrot

:term:`たまねぎ` へのリンク。
たまねぎ

Onion

にんじん

Carrot

たまねぎ へのリンク。

オプションリスト(Option list)

  • オプションと説明の間はスペースを2ついれる

-h  Show help
-f file  Select file
--help  Show help
-h

Show help

-f file

Select file

--help

Show help

置換(Substitutions, replace)

- foo_
- |foo|  : 置換
- |foo|_ : ハイパーリンクターゲットの参照

.. _foo: https://www.vmc-motion.com/
.. |foo| replace:: VMC
  • foo

  • VMC : 置換

  • VMC : ハイパーリンクターゲットの参照

コードブロック

.. code-block:: python
    :linenos:
    :caption: コードブロック
    :name: codeMyCode

    import agx

    def print():
        print("hoge")


:numref:`codeMyCode` へのリンク。
リスト 8 コードブロック
1import agx
2
3def print():
4    print("hoge")

リスト 8 へのリンク。

表(Table)

リストテーブル(List Table)

.. list-table:: レシピ
    :widths: 2,1
    :header-rows: 1
    :name: tblRecipe

    * - 材料
      - 数
    * - たまねぎ
      - 1
    * - にんじん
      - 2

| :numref:`tblRecipe` へのリンク。
| tblRecipe_ へのリンク。
| `レシピ <tblRecipe_>`_ へのリンク。
表 2 レシピ

材料

たまねぎ

1

にんじん

2

表 2 へのリンク。
tblRecipe へのリンク。
レシピ へのリンク。

CSVテーブル(CSV Table)

.. csv-table::
    :encoding: utf-8
    :header-rows: 1
    :widths: 2,1
    :file: _assets/csvtable.csv
表 3 レシピ

材料

たまねぎ

1

にんじん

2

.. csv-table:: レシピ
    :encoding: utf-8
    :header: "材料", "数"
    :widths: 2,1

    "たまねぎ", 1
    "にんじん", 2
表 4 レシピ

材料

たまねぎ

1

にんじん

2

図、画像(Images)

image

.. image:: _assets/vmc.png
    :width: 720px
    :name: figVMC

figVMC_ へのリンク。
../../_images/vmc.png

figVMC へのリンク。

figure(キャプション付き)

.. figure:: _assets/vmc.png
    :width: 720px
    :name: figVMC2

    ブイエムシー

:numref:`figVMC2` へのリンク。
../../_images/vmc.png

図 19 ブイエムシー

図 19 へのリンク。

外部サイトの画像の表示

.. figure:: https://www.vmc-inc.co.jp/blog/2016/04/01/images/%E6%A1%9C%E3%80%80%E5%85%A8%E4%BD%93%E5%83%8F.jpg

    山崎川の桜
https://www.vmc-inc.co.jp/blog/2016/04/01/images/%E6%A1%9C%E3%80%80%E5%85%A8%E4%BD%93%E5%83%8F.jpg

図 20 山崎川の桜

数式(Math)

インライン表記

:math:`\pi = 3.14`。

\(\pi = 3.14\)

数式モード表記

.. math::
    :label: eqMyEq

    f(x) = ax^2 + bx + c

:eq:`eqMyEq` へのリンク。
(50)\[f(x) = ax^2 + bx + c\]

式(50) へのリンク。

サンプル

.. math::

    v, \bm{v}, \boldsymbol{v}, \bf{v}  \\
    V, \bf{V}
(51)\[\begin{split}v, \bm{v}, \boldsymbol{v}, \bf{v} \\ V, \bf{V}\end{split}\]
.. math::

    \begin{aligned}
    a&=b+c \\
    d+e&=f
    \end{aligned}
(52)\[\begin{split}\begin{aligned} a&=b+c \\ d+e&=f \end{aligned}\end{split}\]
.. math::
    \bf{I} =
    \begin{bmatrix}
        1 & 0 & \cdots  & 0 \\
        0 & 1 & \cdots  & 0 \\
        \vdots & \vdots & \ddots & \vdots  \\
        0 & 0 & \cdots  & 1 \\
    \end{bmatrix}
(53)\[\begin{split}\bf{I} = \begin{bmatrix} 1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \\ \end{bmatrix}\end{split}\]
.. math::

    \bf{A} =
    \underbrace{ \left.
    \begin{pmatrix}
        a_{11} & 0      & 0      & \cdots & 0 \\
        0      & a_{22} & 0      & \cdots & 0 \\
        0      & 0      & a_{33} & \cdots & 0 \\
        \vdots &        &        & \ddots &   \\
        0      & 0      & 0      & \cdots & a_{MN}
    \end{pmatrix}
    \right
    \}}_{\text{$N$ 列}}
    \,\text{$M$ 行}
(54)\[\begin{split}\bf{A} = \underbrace{ \left. \begin{pmatrix} a_{11} & 0 & 0 & \cdots & 0 \\ 0 & a_{22} & 0 & \cdots & 0 \\ 0 & 0 & a_{33} & \cdots & 0 \\ \vdots & & & \ddots & \\ 0 & 0 & 0 & \cdots & a_{MN} \end{pmatrix} \right \}}_{\text{$N$ 列}} \,\text{$M$ 行}\end{split}\]

注釈(Paragraph-level markup)

.. note:: 注釈タイトル

    これは注釈です!

.. warning:: 警告タイトル

    これは警告です!

.. deprecated:: 2.45

    代りにxxxxを利用する。

.. seealso:: 参考タイトル

    これを参考にしてください。

.. admonition:: admonitionタイトル

    これはadmonitionです。

注釈

注釈タイトル

これは注釈です!

警告

警告タイトル

これは警告です!

バージョン 2.45 で非推奨: 代りにxxxxを利用する。

参考

参考タイトル

これを参考にしてください。

admonitionタイトル

これはadmonitionです。

脚注(Footnotes)

これ [#f1]_ [#f1]_ とこれ [#f2]_ が脚注。

.. [#f1] ここに脚注が表示される。
.. [#f2]

    ここに脚注が表示される。

これ [1] [1] とこれ [2] が脚注。