| 1 |
.. |
| 2 |
Copyright (c) 2021 Pradyun Gedam |
| 3 |
Licensed under Creative Commons Attribution-ShareAlike 4.0 International License |
| 4 |
SPDX-License-Identifier: CC-BY-SA-4.0 |
| 5 |
|
| 6 |
====== |
| 7 |
Tables |
| 8 |
====== |
| 9 |
|
| 10 |
Grid Tables |
| 11 |
----------- |
| 12 |
|
| 13 |
Here's a grid table followed by a simple table: |
| 14 |
|
| 15 |
+------------------------+------------+----------+----------+ |
| 16 |
| Header row, column 1 | Header 2 | Header 3 | Header 4 | |
| 17 |
| (header rows optional) | | | | |
| 18 |
+========================+============+==========+==========+ |
| 19 |
| body row 1, column 1 | column 2 | column 3 | column 4 | |
| 20 |
+------------------------+------------+----------+----------+ |
| 21 |
| body row 2 | Cells may span columns. | |
| 22 |
+------------------------+------------+---------------------+ |
| 23 |
| body row 3 | Cells may | - Table cells | |
| 24 |
+------------------------+ span rows. | - contain | |
| 25 |
| body row 4 | | - body elements. | |
| 26 |
+------------------------+------------+----------+----------+ |
| 27 |
| body row 5 | Cells may also be | | |
| 28 |
| | empty: ``-->`` | | |
| 29 |
+------------------------+-----------------------+----------+ |
| 30 |
|
| 31 |
===== ===== ====== |
| 32 |
Inputs Output |
| 33 |
------------ ------ |
| 34 |
A B A or B |
| 35 |
===== ===== ====== |
| 36 |
False False False |
| 37 |
True False True |
| 38 |
False True True |
| 39 |
True True True |
| 40 |
===== ===== ====== |
| 41 |
|
| 42 |
Giant Tables |
| 43 |
^^^^^^^^^^^^ |
| 44 |
|
| 45 |
+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+ |
| 46 |
| Header 1 | Header 2 | Header 3 | Header 1 | Header 2 | Header 3 | Header 1 | Header 2 | Header 3 | Header 1 | Header 2 | Header 3 | |
| 47 |
+============+============+===========+============+============+===========+============+============+===========+============+============+===========+ |
| 48 |
| body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | |
| 49 |
+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+ |
| 50 |
| body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | |
| 51 |
+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+ |
| 52 |
| body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | |
| 53 |
+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+ |
| 54 |
| body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | body row 1 | column 2 | column 3 | |
| 55 |
+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+------------+------------+-----------+ |
| 56 |
|
| 57 |
Table containing code |
| 58 |
--------------------- |
| 59 |
|
| 60 |
==================================== =========================================== |
| 61 |
Version Installing |
| 62 |
==================================== =========================================== |
| 63 |
Pradyun's pip fork and installer .. code-block:: bash |
| 64 |
|
| 65 |
pip install "pip @ git+https://github.com/pradyunsg/pip#20.3.3" "installer @ git+https://github.com/pradyunsg/installer" |
| 66 |
|
| 67 |
PyPI .. code-block:: bash |
| 68 |
|
| 69 |
pip install pip installer |
| 70 |
|
| 71 |
==================================== =========================================== |
| 72 |
|
| 73 |
List Tables |
| 74 |
----------- |
| 75 |
|
| 76 |
.. list-table:: List tables can have captions like this one. Fixed widths, *both* header row and header column. |
| 77 |
:widths: 10 5 10 50 |
| 78 |
:header-rows: 1 |
| 79 |
:stub-columns: 1 |
| 80 |
|
| 81 |
* - List table |
| 82 |
- Header 1 |
| 83 |
- Header 2 |
| 84 |
- Header 3 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Link: https://www.sphinx-doc.org/ |
| 85 |
* - Stub Row 1 |
| 86 |
- Row 1, Col 1 |
| 87 |
- Row 1, Col 2 |
| 88 |
- Row 1, Col 3 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Link: https://www.sphinx-doc.org/ |
| 89 |
* - Stub Row 2 |
| 90 |
- Row 2, Col 1 |
| 91 |
- Row 2, Col 2 |
| 92 |
- Row 2, Col 3 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Link: https://www.sphinx-doc.org/ |
| 93 |
* - Stub Row 3 |
| 94 |
- Row 3, Col 1 |
| 95 |
- Row 3, Col 2 |
| 96 |
- Row 3, Col 3 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Link: https://www.sphinx-doc.org/ |
| 97 |
|
| 98 |
.. list-table:: A list table with a header *row*, auto-width. |
| 99 |
:header-rows: 1 |
| 100 |
|
| 101 |
* - Header 1 |
| 102 |
- Header 2 |
| 103 |
- Header 3 |
| 104 |
- Header 4 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet mauris arcu. |
| 105 |
* - Row 1, Col 1 |
| 106 |
- Row 1, Col 2 |
| 107 |
- Row 1, Col 3 |
| 108 |
- Row 1, Col 4 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet mauris arcu. |
| 109 |
* - Row 2, Col 1 |
| 110 |
- Row 2, Col 2 |
| 111 |
- Row 2, Col 3 |
| 112 |
- Row 2, Col 4 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet mauris arcu. |
| 113 |
* - Row 3, Col 1 |
| 114 |
- Row 3, Col 2 |
| 115 |
- Row 3, Col 3 |
| 116 |
- Row 3, Col 4 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet mauris arcu. |
| 117 |
|
| 118 |
.. list-table:: A list table with a header ("stub") *column*, auto-width. |
| 119 |
:stub-columns: 1 |
| 120 |
|
| 121 |
* - Stub Row 1 |
| 122 |
- Row 1, Col 1 |
| 123 |
- Row 1, Col 2 |
| 124 |
- Row 1, Col 3 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet mauris arcu. |
| 125 |
* - Stub Row 2 |
| 126 |
- Row 2, Col 1 |
| 127 |
- Row 2, Col 2 |
| 128 |
- Row 2, Col 3 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet mauris arcu. |
| 129 |
* - Stub Row 3 |
| 130 |
- Row 3, Col 1 |
| 131 |
- Row 3, Col 2 |
| 132 |
- Row 3, Col 3 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet mauris arcu. |
| 133 |
* - Stub Row 4 |
| 134 |
- Row 4, Col 1 |
| 135 |
- Row 4, Col 2 |
| 136 |
- Row 4, Col 3 long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sit amet mauris arcu. |
| 137 |
|
| 138 |
.. list-table:: This is a list table with images in it. |
| 139 |
|
| 140 |
* - .. figure:: https://picsum.photos/200/200 |
| 141 |
|
| 142 |
This is a short caption for a figure. |
| 143 |
|
| 144 |
- .. figure:: https://picsum.photos/200/200 |
| 145 |
|
| 146 |
This is a long caption for a figure. Lorem ipsum dolor sit amet, consectetur adipiscing elit. |
| 147 |
Donec porttitor dolor in odio posuere, vitae ornare libero mattis. In lobortis justo vestibulum nibh aliquet, non. |