.. index:: table, csv-table, list-table, directive;table, directive;csv-table, directive;list-table

表を書きたい
------------

一番最初に説明されている--や+を使って書くグリッドテーブル方式は確かにテ
キストファイルを見たときに分かりやすいのですが、幅を合わせる必要があり、
書くのが非常に大変です。特に日本語フォントが混じると文字数がずれること
があります。

`CSVテーブル
<http://docutils.sourceforge.net/docs/ref/rst/directives.html#id1>`_
や `Listテーブル
<http://docutils.sourceforge.net/docs/ref/rst/directives.html#list-table>`_ を使った方が楽です。


まずはcsvテーブルです。","で区切ることでテーブルを書きます。
``csv-table::`` と本文の間は一行空けます。これは ``list-table`` も同様
です。

::

  .. csv-table:: Frozen Delights!

     "Treat", "Quantity", "Description"
     "Albatross", 2.99, "On a stick!"
     "Crunchy Frog", 1.49, "If we took the bones out, it wouldn't be
     crunchy, now would it?"
     "Gannet Ripple", 1.99, "On a stick!"
  

こちらは ``list-table`` です。*と-を使ったリストを元にテーブルを書いて
いきます。


::
  
  .. list-table:: Frozen Delights!
  
     * - Treat
       - Quantity
       - Description
     * - Crunchy Frog
       - 1.49
       - If we took the bones out, it wouldn't be
         crunchy, now would it?


適用例
~~~~~~~

CSVテーブルの例
+++++++++++++++++++

.. csv-table:: Frozen Delights!

   "Treat", "Quantity", "Description"
   "Albatross", 2.99, "On a stick!"
   "Crunchy Frog", 1.49, "If we took the bones out, it wouldn't be
   crunchy, now would it?"
   "Gannet Ripple", 1.99, "On a stick!"


リストテーブルの例
+++++++++++++++++++

.. list-table:: Frozen Delights!

   * - Treat
     - Quantity
     - Description
   * - Crunchy Frog
     - 1.49
     - If we took the bones out, it wouldn't be
       crunchy, now would it?


参考
~~~~~~~~~

- :ref:`table-header`