summaryrefslogtreecommitdiffstats
path: root/tests/roots/test-latex-table
diff options
context:
space:
mode:
Diffstat (limited to 'tests/roots/test-latex-table')
-rw-r--r--tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t1
-rw-r--r--tests/roots/test-latex-table/complex.rst58
-rw-r--r--tests/roots/test-latex-table/conf.py0
-rw-r--r--tests/roots/test-latex-table/expects/complex_spanning_cell.tex69
-rw-r--r--tests/roots/test-latex-table/expects/gridtable.tex73
-rw-r--r--tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex73
-rw-r--r--tests/roots/test-latex-table/expects/longtable.tex70
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_align.tex69
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_caption.tex71
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex76
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex81
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_verbatim.tex70
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_widths.tex73
-rw-r--r--tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex76
-rw-r--r--tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex70
-rw-r--r--tests/roots/test-latex-table/expects/simple_table.tex40
-rw-r--r--tests/roots/test-latex-table/expects/table_having_caption.tex44
-rw-r--r--tests/roots/test-latex-table/expects/table_having_problematic_cell.tex47
-rw-r--r--tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex49
-rw-r--r--tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex26
-rw-r--r--tests/roots/test-latex-table/expects/table_having_verbatim.tex41
-rw-r--r--tests/roots/test-latex-table/expects/table_having_widths.tex46
-rw-r--r--tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex47
-rw-r--r--tests/roots/test-latex-table/expects/tabular_having_widths.tex40
-rw-r--r--tests/roots/test-latex-table/expects/tabularcolumn.tex41
-rw-r--r--tests/roots/test-latex-table/expects/tabulary_having_widths.tex40
-rw-r--r--tests/roots/test-latex-table/index.rst8
-rw-r--r--tests/roots/test-latex-table/longtable.rst156
-rw-r--r--tests/roots/test-latex-table/tabular.rst173
29 files changed, 1728 insertions, 0 deletions
diff --git a/tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t b/tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t
new file mode 100644
index 0000000..e2cb1db
--- /dev/null
+++ b/tests/roots/test-latex-table/_mytemplates/latex/longtable.tex_t
@@ -0,0 +1 @@
+SALUT LES COPAINS
diff --git a/tests/roots/test-latex-table/complex.rst b/tests/roots/test-latex-table/complex.rst
new file mode 100644
index 0000000..d648ff1
--- /dev/null
+++ b/tests/roots/test-latex-table/complex.rst
@@ -0,0 +1,58 @@
+complex tables
+==============
+
+grid table
+----------
+
+.. rst-class:: nocolorrows
+
++---------+---------+---------+
+| header1 | header2 | header3 |
++=========+=========+=========+
+| cell1-1 | cell1-2 | cell1-3 |
++---------+ +---------+
+| cell2-1 | | cell2-3 |
++ +---------+---------+
+| | cell3-2-par1 |
++---------+ |
+| cell4-1 | cell3-2-par2 |
++---------+---------+---------+
+| cell5-1 |
++---------+---------+---------+
+
+grid table with tabularcolumns having no vline
+----------------------------------------------
+
+.. tabularcolumns:: TTT
+
++---------+---------+---------+
+| header1 | header2 | header3 |
++=========+=========+=========+
+| cell1-1 | cell1-2 | cell1-3 |
++---------+ +---------+
+| cell2-1 | | cell2-3 |
++ +---------+---------+
+| | cell3-2-par1 |
++---------+ |
+| cell4-1 | cell3-2-par2 |
++---------+---------+---------+
+| cell5-1 |
++---------+---------+---------+
+
+complex spanning cell
+---------------------
+
+table having ...
+
+* consecutive multirow at top of row (1-1 and 1-2)
+* consecutive multirow at end of row (1-4 and 1-5)
+
+.. rst-class:: standard
+
++-----------+-----------+-----------+-----------+-----------+
+| | | cell1-3 | | |
+| | +-----------+ | cell1-5 |
+| cell1-1 | cell1-2 | | cell1-4 | |
+| | | cell2-3 | +-----------+
+| | | | | cell3-5 |
++-----------+-----------+-----------+-----------+-----------+
diff --git a/tests/roots/test-latex-table/conf.py b/tests/roots/test-latex-table/conf.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/roots/test-latex-table/conf.py
diff --git a/tests/roots/test-latex-table/expects/complex_spanning_cell.tex b/tests/roots/test-latex-table/expects/complex_spanning_cell.tex
new file mode 100644
index 0000000..d2d6189
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/complex_spanning_cell.tex
@@ -0,0 +1,69 @@
+\label{\detokenize{complex:complex-spanning-cell}}
+\sphinxAtStartPar
+table having …
+\begin{itemize}
+\item {}
+\sphinxAtStartPar
+consecutive multirow at top of row (1\sphinxhyphen{}1 and 1\sphinxhyphen{}2)
+
+\item {}
+\sphinxAtStartPar
+consecutive multirow at end of row (1\sphinxhyphen{}4 and 1\sphinxhyphen{}5)
+
+\end{itemize}
+
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\sphinxthistablewithstandardstyle
+\centering
+\begin{tabulary}{\linewidth}[t]{|T|T|T|T|T|}
+\sphinxtoprule
+\sphinxtableatstartofbodyhook\sphinxmultirow{3}{1}{%
+\begin{varwidth}[t]{\sphinxcolwidth{1}{5}}
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+&\sphinxmultirow{3}{2}{%
+\begin{varwidth}[t]{\sphinxcolwidth{1}{5}}
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}3
+&\sphinxmultirow{3}{4}{%
+\begin{varwidth}[t]{\sphinxcolwidth{1}{5}}
+\sphinxAtStartPar
+cell1\sphinxhyphen{}4
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+&\sphinxmultirow{2}{5}{%
+\begin{varwidth}[t]{\sphinxcolwidth{1}{5}}
+\sphinxAtStartPar
+cell1\sphinxhyphen{}5
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+\\
+\sphinxvlinecrossing{1}\sphinxcline{3-3}\sphinxvlinecrossing{4}\sphinxfixclines{5}\sphinxtablestrut{1}&\sphinxtablestrut{2}&\sphinxmultirow{2}{6}{%
+\begin{varwidth}[t]{\sphinxcolwidth{1}{5}}
+\sphinxAtStartPar
+cell2\sphinxhyphen{}3
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+&\sphinxtablestrut{4}&\sphinxtablestrut{5}\\
+\sphinxvlinecrossing{1}\sphinxvlinecrossing{2}\sphinxvlinecrossing{3}\sphinxcline{5-5}\sphinxfixclines{5}\sphinxtablestrut{1}&\sphinxtablestrut{2}&\sphinxtablestrut{6}&\sphinxtablestrut{4}&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}5
+\\
+\sphinxbottomrule
+\end{tabulary}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/gridtable.tex b/tests/roots/test-latex-table/expects/gridtable.tex
new file mode 100644
index 0000000..407abe7
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/gridtable.tex
@@ -0,0 +1,73 @@
+\label{\detokenize{complex:grid-table}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\sphinxthistablewithnocolorrowsstyle
+\centering
+\begin{tabulary}{\linewidth}[t]{|T|T|T|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header3
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&\sphinxmultirow{2}{5}{%
+\begin{varwidth}[t]{\sphinxcolwidth{1}{3}}
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}3
+\\
+\sphinxcline{1-1}\sphinxcline{3-3}\sphinxfixclines{3}\sphinxmultirow{2}{7}{%
+\begin{varwidth}[t]{\sphinxcolwidth{1}{3}}
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+&\sphinxtablestrut{5}&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}3
+\\
+\sphinxcline{2-3}\sphinxfixclines{3}\sphinxtablestrut{7}&\sphinxstartmulticolumn{2}%
+\sphinxmultirow{2}{9}{%
+\begin{varwidth}[t]{\sphinxcolwidth{2}{3}}
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2\sphinxhyphen{}par1
+
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2\sphinxhyphen{}par2
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+\sphinxstopmulticolumn
+\\
+\sphinxcline{1-1}\sphinxfixclines{3}
+\sphinxAtStartPar
+cell4\sphinxhyphen{}1
+&\multicolumn{2}{l|}{\sphinxtablestrut{9}}\\
+\sphinxhline\sphinxstartmulticolumn{3}%
+\begin{varwidth}[t]{\sphinxcolwidth{3}{3}}
+\sphinxAtStartPar
+cell5\sphinxhyphen{}1
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+\sphinxstopmulticolumn
+\\
+\sphinxbottomrule
+\end{tabulary}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex b/tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex
new file mode 100644
index 0000000..c77b990
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/gridtable_with_tabularcolumn.tex
@@ -0,0 +1,73 @@
+\label{\detokenize{complex:grid-table-with-tabularcolumns-having-no-vline}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\sphinxthistablewithnovlinesstyle
+\centering
+\begin{tabulary}{\linewidth}[t]{TTT}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header3
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&\sphinxmultirow{2}{5}{%
+\begin{varwidth}[t]{\sphinxcolwidth{1}{3}}
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}3
+\\
+\sphinxcline{1-1}\sphinxcline{3-3}\sphinxfixclines{3}\sphinxmultirow{2}{7}{%
+\begin{varwidth}[t]{\sphinxcolwidth{1}{3}}
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+&\sphinxtablestrut{5}&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}3
+\\
+\sphinxcline{2-3}\sphinxfixclines{3}\sphinxtablestrut{7}&\sphinxstartmulticolumn{2}%
+\sphinxmultirow{2}{9}{%
+\begin{varwidth}[t]{\sphinxcolwidth{2}{3}}
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2\sphinxhyphen{}par1
+
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2\sphinxhyphen{}par2
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+}%
+\sphinxstopmulticolumn
+\\
+\sphinxcline{1-1}\sphinxfixclines{3}
+\sphinxAtStartPar
+cell4\sphinxhyphen{}1
+&\multicolumn{2}{l}{\sphinxtablestrut{9}}\\
+\sphinxhline\sphinxstartmulticolumn{3}%
+\begin{varwidth}[t]{\sphinxcolwidth{3}{3}}
+\sphinxAtStartPar
+cell5\sphinxhyphen{}1
+\par
+\vskip-\baselineskip\vbox{\hbox{\strut}}\end{varwidth}%
+\sphinxstopmulticolumn
+\\
+\sphinxbottomrule
+\end{tabulary}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/longtable.tex b/tests/roots/test-latex-table/expects/longtable.tex
new file mode 100644
index 0000000..1fe1022
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/longtable.tex
@@ -0,0 +1,70 @@
+\label{\detokenize{longtable:longtable}}
+
+\begin{savenotes}
+\sphinxatlongtablestart
+\sphinxthistablewithglobalstyle
+\sphinxthistablewithborderlessstyle
+\makeatletter
+ \LTleft \@totalleftmargin plus1fill
+ \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
+\makeatother
+\begin{longtable}{ll}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endfirsthead
+
+\multicolumn{2}{c}{\sphinxnorowcolor
+ \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}%
+}\\
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endhead
+
+\sphinxbottomrule
+\multicolumn{2}{r}{\sphinxnorowcolor
+ \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}%
+}\\
+\endfoot
+
+\endlastfoot
+\sphinxtableatstartofbodyhook
+
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{longtable}
+\sphinxtableafterendhook
+\sphinxatlongtableend
+\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/longtable_having_align.tex b/tests/roots/test-latex-table/expects/longtable_having_align.tex
new file mode 100644
index 0000000..4a4df18
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/longtable_having_align.tex
@@ -0,0 +1,69 @@
+\label{\detokenize{longtable:longtable-having-align-option}}
+
+\begin{savenotes}
+\sphinxatlongtablestart
+\sphinxthistablewithglobalstyle
+\makeatletter
+ \LTleft \@totalleftmargin plus1fill
+ \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax
+\makeatother
+\begin{longtable}{|l|l|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endfirsthead
+
+\multicolumn{2}{c}{\sphinxnorowcolor
+ \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}%
+}\\
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endhead
+
+\sphinxbottomrule
+\multicolumn{2}{r}{\sphinxnorowcolor
+ \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}%
+}\\
+\endfoot
+
+\endlastfoot
+\sphinxtableatstartofbodyhook
+
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{longtable}
+\sphinxtableafterendhook
+\sphinxatlongtableend
+\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/longtable_having_caption.tex b/tests/roots/test-latex-table/expects/longtable_having_caption.tex
new file mode 100644
index 0000000..a1aa65d
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/longtable_having_caption.tex
@@ -0,0 +1,71 @@
+\label{\detokenize{longtable:longtable-having-caption}}
+
+\begin{savenotes}
+\sphinxatlongtablestart
+\sphinxthistablewithglobalstyle
+\makeatletter
+ \LTleft \@totalleftmargin plus1fill
+ \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
+\makeatother
+\begin{longtable}{|l|l|}
+\sphinxthelongtablecaptionisattop
+\caption{caption for longtable\strut}\label{\detokenize{longtable:id1}}\\*[\sphinxlongtablecapskipadjust]
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endfirsthead
+
+\multicolumn{2}{c}{\sphinxnorowcolor
+ \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}%
+}\\
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endhead
+
+\sphinxbottomrule
+\multicolumn{2}{r}{\sphinxnorowcolor
+ \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}%
+}\\
+\endfoot
+
+\endlastfoot
+\sphinxtableatstartofbodyhook
+
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{longtable}
+\sphinxtableafterendhook
+\sphinxatlongtableend
+\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex
new file mode 100644
index 0000000..240a760
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/longtable_having_problematic_cell.tex
@@ -0,0 +1,76 @@
+\label{\detokenize{longtable:longtable-having-problematic-cell}}
+
+\begin{savenotes}
+\sphinxatlongtablestart
+\sphinxthistablewithglobalstyle
+\makeatletter
+ \LTleft \@totalleftmargin plus1fill
+ \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
+\makeatother
+\begin{longtable}{|*{2}{\X{1}{2}|}}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endfirsthead
+
+\multicolumn{2}{c}{\sphinxnorowcolor
+ \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}%
+}\\
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endhead
+
+\sphinxbottomrule
+\multicolumn{2}{r}{\sphinxnorowcolor
+ \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}%
+}\\
+\endfoot
+
+\endlastfoot
+\sphinxtableatstartofbodyhook
+\begin{itemize}
+\item {}
+\sphinxAtStartPar
+item1
+
+\item {}
+\sphinxAtStartPar
+item2
+
+\end{itemize}
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{longtable}
+\sphinxtableafterendhook
+\sphinxatlongtableend
+\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex
new file mode 100644
index 0000000..897830b
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/longtable_having_stub_columns_and_problematic_cell.tex
@@ -0,0 +1,81 @@
+\label{\detokenize{longtable:longtable-having-both-stub-columns-and-problematic-cell}}
+
+\begin{savenotes}
+\sphinxatlongtablestart
+\sphinxthistablewithglobalstyle
+\makeatletter
+ \LTleft \@totalleftmargin plus1fill
+ \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
+\makeatother
+\begin{longtable}{|*{3}{\X{1}{3}|}}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header3
+\\
+\sphinxmidrule
+\endfirsthead
+
+\multicolumn{3}{c}{\sphinxnorowcolor
+ \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}%
+}\\
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header3
+\\
+\sphinxmidrule
+\endhead
+
+\sphinxbottomrule
+\multicolumn{3}{r}{\sphinxnorowcolor
+ \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}%
+}\\
+\endfoot
+
+\endlastfoot
+\sphinxtableatstartofbodyhook
+\sphinxstyletheadfamily \begin{itemize}
+\item {}
+\sphinxAtStartPar
+instub1\sphinxhyphen{}1a
+
+\item {}
+\sphinxAtStartPar
+instub1\sphinxhyphen{}1b
+
+\end{itemize}
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+instub1\sphinxhyphen{}2
+&
+\sphinxAtStartPar
+notinstub1\sphinxhyphen{}3
+\\
+\sphinxhline\sphinxstyletheadfamily
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}3
+\\
+\sphinxbottomrule
+\end{longtable}
+\sphinxtableafterendhook
+\sphinxatlongtableend
+\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex
new file mode 100644
index 0000000..b9f7512
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/longtable_having_verbatim.tex
@@ -0,0 +1,70 @@
+\label{\detokenize{longtable:longtable-having-verbatim}}
+
+\begin{savenotes}
+\sphinxatlongtablestart
+\sphinxthistablewithglobalstyle
+\makeatletter
+ \LTleft \@totalleftmargin plus1fill
+ \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
+\makeatother
+\begin{longtable}{|*{2}{\X{1}{2}|}}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endfirsthead
+
+\multicolumn{2}{c}{\sphinxnorowcolor
+ \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}%
+}\\
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endhead
+
+\sphinxbottomrule
+\multicolumn{2}{r}{\sphinxnorowcolor
+ \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}%
+}\\
+\endfoot
+
+\endlastfoot
+\sphinxtableatstartofbodyhook
+
+\begin{sphinxVerbatimintable}[commandchars=\\\{\}]
+\PYG{n}{hello} \PYG{n}{world}
+\end{sphinxVerbatimintable}
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{longtable}
+\sphinxtableafterendhook
+\sphinxatlongtableend
+\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths.tex b/tests/roots/test-latex-table/expects/longtable_having_widths.tex
new file mode 100644
index 0000000..24dad79
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/longtable_having_widths.tex
@@ -0,0 +1,73 @@
+\label{\detokenize{longtable:longtable-having-widths-option}}
+
+\begin{savenotes}
+\sphinxatlongtablestart
+\sphinxthistablewithglobalstyle
+\makeatletter
+ \LTleft \@totalleftmargin plus1fill
+ \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
+\makeatother
+\begin{longtable}{|\X{30}{100}|\X{70}{100}|}
+\noalign{\phantomsection\label{\detokenize{longtable:namedlongtable}}\label{\detokenize{longtable:mylongtable}}}%
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endfirsthead
+
+\multicolumn{2}{c}{\sphinxnorowcolor
+ \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}%
+}\\
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endhead
+
+\sphinxbottomrule
+\multicolumn{2}{r}{\sphinxnorowcolor
+ \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}%
+}\\
+\endfoot
+
+\endlastfoot
+\sphinxtableatstartofbodyhook
+
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{longtable}
+\sphinxtableafterendhook
+\sphinxatlongtableend
+\end{savenotes}
+
+\sphinxAtStartPar
+See {\hyperref[\detokenize{longtable:mylongtable}]{\sphinxcrossref{mylongtable}}}, same as {\hyperref[\detokenize{longtable:namedlongtable}]{\sphinxcrossref{\DUrole{std,std-ref}{this one}}}}.
diff --git a/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex
new file mode 100644
index 0000000..b4758ca
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/longtable_having_widths_and_problematic_cell.tex
@@ -0,0 +1,76 @@
+\label{\detokenize{longtable:longtable-having-both-widths-and-problematic-cell}}
+
+\begin{savenotes}
+\sphinxatlongtablestart
+\sphinxthistablewithglobalstyle
+\makeatletter
+ \LTleft \@totalleftmargin plus1fill
+ \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
+\makeatother
+\begin{longtable}{|\X{30}{100}|\X{70}{100}|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endfirsthead
+
+\multicolumn{2}{c}{\sphinxnorowcolor
+ \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}%
+}\\
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endhead
+
+\sphinxbottomrule
+\multicolumn{2}{r}{\sphinxnorowcolor
+ \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}%
+}\\
+\endfoot
+
+\endlastfoot
+\sphinxtableatstartofbodyhook
+\begin{itemize}
+\item {}
+\sphinxAtStartPar
+item1
+
+\item {}
+\sphinxAtStartPar
+item2
+
+\end{itemize}
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{longtable}
+\sphinxtableafterendhook
+\sphinxatlongtableend
+\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex
new file mode 100644
index 0000000..4c380fe
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/longtable_with_tabularcolumn.tex
@@ -0,0 +1,70 @@
+\label{\detokenize{longtable:longtable-with-tabularcolumn}}
+
+\begin{savenotes}
+\sphinxatlongtablestart
+\sphinxthistablewithglobalstyle
+\sphinxthistablewithvlinesstyle
+\makeatletter
+ \LTleft \@totalleftmargin plus1fill
+ \LTright\dimexpr\columnwidth-\@totalleftmargin-\linewidth\relax plus1fill
+\makeatother
+\begin{longtable}{|c|c|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endfirsthead
+
+\multicolumn{2}{c}{\sphinxnorowcolor
+ \makebox[0pt]{\sphinxtablecontinued{\tablename\ \thetable{} \textendash{} continued from previous page}}%
+}\\
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\endhead
+
+\sphinxbottomrule
+\multicolumn{2}{r}{\sphinxnorowcolor
+ \makebox[0pt][r]{\sphinxtablecontinued{continues on next page}}%
+}\\
+\endfoot
+
+\endlastfoot
+\sphinxtableatstartofbodyhook
+
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{longtable}
+\sphinxtableafterendhook
+\sphinxatlongtableend
+\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/simple_table.tex b/tests/roots/test-latex-table/expects/simple_table.tex
new file mode 100644
index 0000000..7bd85c7
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/simple_table.tex
@@ -0,0 +1,40 @@
+\label{\detokenize{tabular:simple-table}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\centering
+\begin{tabulary}{\linewidth}[t]{|T|T|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{tabulary}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/table_having_caption.tex b/tests/roots/test-latex-table/expects/table_having_caption.tex
new file mode 100644
index 0000000..f2ce553
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/table_having_caption.tex
@@ -0,0 +1,44 @@
+\label{\detokenize{tabular:table-having-caption}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\centering
+\sphinxcapstartof{table}
+\sphinxthecaptionisattop
+\sphinxcaption{caption for table}\label{\detokenize{tabular:id1}}
+\sphinxaftertopcaption
+\begin{tabulary}{\linewidth}[t]{|T|T|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{tabulary}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex b/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex
new file mode 100644
index 0000000..7d7ad4b
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/table_having_problematic_cell.tex
@@ -0,0 +1,47 @@
+\label{\detokenize{tabular:table-having-problematic-cell}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\centering
+\begin{tabular}[t]{|*{2}{\X{1}{2}|}}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook\begin{itemize}
+\item {}
+\sphinxAtStartPar
+item1
+
+\item {}
+\sphinxAtStartPar
+item2
+
+\end{itemize}
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{tabular}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex
new file mode 100644
index 0000000..fbd797a
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/table_having_stub_columns_and_problematic_cell.tex
@@ -0,0 +1,49 @@
+\label{\detokenize{tabular:table-having-both-stub-columns-and-problematic-cell}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\centering
+\begin{tabular}[t]{|*{3}{\X{1}{3}|}}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header3
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook\sphinxstyletheadfamily \begin{itemize}
+\item {}
+\sphinxAtStartPar
+instub1\sphinxhyphen{}1a
+
+\item {}
+\sphinxAtStartPar
+instub1\sphinxhyphen{}1b
+
+\end{itemize}
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+instub1\sphinxhyphen{}2
+&
+\sphinxAtStartPar
+notinstub1\sphinxhyphen{}3
+\\
+\sphinxhline\sphinxstyletheadfamily
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}3
+\\
+\sphinxbottomrule
+\end{tabular}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex b/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex
new file mode 100644
index 0000000..9acd9a8
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/table_having_threeparagraphs_cell_in_first_col.tex
@@ -0,0 +1,26 @@
+\label{\detokenize{tabular:table-with-cell-in-first-column-having-three-paragraphs}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\centering
+\begin{tabulary}{\linewidth}[t]{|T|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1\sphinxhyphen{}par1
+
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1\sphinxhyphen{}par2
+
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1\sphinxhyphen{}par3
+\\
+\sphinxbottomrule
+\end{tabulary}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/table_having_verbatim.tex b/tests/roots/test-latex-table/expects/table_having_verbatim.tex
new file mode 100644
index 0000000..a002de5
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/table_having_verbatim.tex
@@ -0,0 +1,41 @@
+\label{\detokenize{tabular:table-having-verbatim}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\centering
+\begin{tabular}[t]{|*{2}{\X{1}{2}|}}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\begin{sphinxVerbatimintable}[commandchars=\\\{\}]
+\PYG{n}{hello} \PYG{n}{world}
+\end{sphinxVerbatimintable}
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{tabular}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/table_having_widths.tex b/tests/roots/test-latex-table/expects/table_having_widths.tex
new file mode 100644
index 0000000..fe5f4c4
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/table_having_widths.tex
@@ -0,0 +1,46 @@
+\label{\detokenize{tabular:table-having-widths-option}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\sphinxthistablewithbooktabsstyle
+\sphinxthistablewithcolorrowsstyle
+\centering
+\phantomsection\label{\detokenize{tabular:namedtabular}}\label{\detokenize{tabular:mytabular}}\nobreak
+\begin{tabular}[t]{\X{30}{100}\X{70}{100}}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{tabular}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
+
+\sphinxAtStartPar
+See {\hyperref[\detokenize{tabular:mytabular}]{\sphinxcrossref{\DUrole{std,std-ref}{this}}}}, same as {\hyperref[\detokenize{tabular:namedtabular}]{\sphinxcrossref{namedtabular}}}.
diff --git a/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex b/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex
new file mode 100644
index 0000000..1baf92c
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/table_having_widths_and_problematic_cell.tex
@@ -0,0 +1,47 @@
+\label{\detokenize{tabular:table-having-both-widths-and-problematic-cell}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\centering
+\begin{tabular}[t]{|\X{30}{100}|\X{70}{100}|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook\begin{itemize}
+\item {}
+\sphinxAtStartPar
+item1
+
+\item {}
+\sphinxAtStartPar
+item2
+
+\end{itemize}
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{tabular}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/tabular_having_widths.tex b/tests/roots/test-latex-table/expects/tabular_having_widths.tex
new file mode 100644
index 0000000..15321d6
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/tabular_having_widths.tex
@@ -0,0 +1,40 @@
+\label{\detokenize{tabular:table-having-align-option-tabular}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\raggedright
+\begin{tabular}[t]{|\X{30}{100}|\X{70}{100}|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{tabular}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/tabularcolumn.tex b/tests/roots/test-latex-table/expects/tabularcolumn.tex
new file mode 100644
index 0000000..fcb01be
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/tabularcolumn.tex
@@ -0,0 +1,41 @@
+\label{\detokenize{tabular:table-with-tabularcolumn}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\sphinxthistablewithnovlinesstyle
+\centering
+\begin{tabulary}{\linewidth}[t]{cc}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{tabulary}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/expects/tabulary_having_widths.tex b/tests/roots/test-latex-table/expects/tabulary_having_widths.tex
new file mode 100644
index 0000000..2463416
--- /dev/null
+++ b/tests/roots/test-latex-table/expects/tabulary_having_widths.tex
@@ -0,0 +1,40 @@
+\label{\detokenize{tabular:table-having-align-option-tabulary}}
+
+\begin{savenotes}\sphinxattablestart
+\sphinxthistablewithglobalstyle
+\raggedleft
+\begin{tabulary}{\linewidth}[t]{|T|T|}
+\sphinxtoprule
+\sphinxstyletheadfamily
+\sphinxAtStartPar
+header1
+&\sphinxstyletheadfamily
+\sphinxAtStartPar
+header2
+\\
+\sphinxmidrule
+\sphinxtableatstartofbodyhook
+\sphinxAtStartPar
+cell1\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell1\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell2\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell2\sphinxhyphen{}2
+\\
+\sphinxhline
+\sphinxAtStartPar
+cell3\sphinxhyphen{}1
+&
+\sphinxAtStartPar
+cell3\sphinxhyphen{}2
+\\
+\sphinxbottomrule
+\end{tabulary}
+\sphinxtableafterendhook\par
+\sphinxattableend\end{savenotes}
diff --git a/tests/roots/test-latex-table/index.rst b/tests/roots/test-latex-table/index.rst
new file mode 100644
index 0000000..80dd110
--- /dev/null
+++ b/tests/roots/test-latex-table/index.rst
@@ -0,0 +1,8 @@
+test-latex-table
+================
+
+.. toctree::
+
+ tabular
+ longtable
+ complex
diff --git a/tests/roots/test-latex-table/longtable.rst b/tests/roots/test-latex-table/longtable.rst
new file mode 100644
index 0000000..da6fa5c
--- /dev/null
+++ b/tests/roots/test-latex-table/longtable.rst
@@ -0,0 +1,156 @@
+longtables
+==========
+
+longtable
+---------
+
+.. table::
+ :class: longtable, borderless
+
+ ======= =======
+ header1 header2
+ ======= =======
+ cell1-1 cell1-2
+ cell2-1 cell2-2
+ cell3-1 cell3-2
+ ======= =======
+
+longtable having :widths: option
+--------------------------------
+
+.. _mylongtable:
+
+.. table::
+ :class: longtable
+ :widths: 30,70
+ :name: namedlongtable
+
+ ======= =======
+ header1 header2
+ ======= =======
+ cell1-1 cell1-2
+ cell2-1 cell2-2
+ cell3-1 cell3-2
+ ======= =======
+
+See mylongtable_, same as :ref:`this one <namedlongtable>`.
+
+longtable having :align: option
+-------------------------------
+
+.. table::
+ :align: right
+ :class: longtable
+
+ ======= =======
+ header1 header2
+ ======= =======
+ cell1-1 cell1-2
+ cell2-1 cell2-2
+ cell3-1 cell3-2
+ ======= =======
+
+longtable with tabularcolumn
+----------------------------
+
+.. tabularcolumns:: |c|c|
+
+.. table::
+ :class: longtable
+
+ ======= =======
+ header1 header2
+ ======= =======
+ cell1-1 cell1-2
+ cell2-1 cell2-2
+ cell3-1 cell3-2
+ ======= =======
+
+longtable having caption
+------------------------
+
+.. list-table:: caption for longtable
+ :class: longtable
+ :header-rows: 1
+
+ * - header1
+ - header2
+ * - cell1-1
+ - cell1-2
+ * - cell2-1
+ - cell2-2
+ * - cell3-1
+ - cell3-2
+
+longtable having verbatim
+-------------------------
+
+.. list-table::
+ :class: longtable
+ :header-rows: 1
+
+ * - header1
+ - header2
+ * - ::
+
+ hello world
+
+ - cell1-2
+ * - cell2-1
+ - cell2-2
+ * - cell3-1
+ - cell3-2
+
+longtable having both :widths: and problematic cell
+---------------------------------------------------
+
+.. list-table::
+ :class: longtable
+ :header-rows: 1
+ :widths: 30,70
+
+ * - header1
+ - header2
+ * - + item1
+ + item2
+ - cell1-2
+ * - cell2-1
+ - cell2-2
+ * - cell3-1
+ - cell3-2
+
+longtable having problematic cell
+---------------------------------
+
+.. list-table::
+ :class: longtable
+ :header-rows: 1
+
+ * - header1
+ - header2
+ * - + item1
+ + item2
+ - cell1-2
+ * - cell2-1
+ - cell2-2
+ * - cell3-1
+ - cell3-2
+
+longtable having both stub columns and problematic cell
+-------------------------------------------------------
+
+.. list-table::
+ :class: longtable
+ :header-rows: 1
+ :stub-columns: 2
+
+ * - header1
+ - header2
+ - header3
+ * - + instub1-1a
+ + instub1-1b
+ - instub1-2
+ - notinstub1-3
+ * - cell2-1
+ - cell2-2
+ - cell2-3
diff --git a/tests/roots/test-latex-table/tabular.rst b/tests/roots/test-latex-table/tabular.rst
new file mode 100644
index 0000000..15db823
--- /dev/null
+++ b/tests/roots/test-latex-table/tabular.rst
@@ -0,0 +1,173 @@
+tabular and tabulary
+====================
+
+simple table
+------------
+
+======= =======
+header1 header2
+======= =======
+cell1-1 cell1-2
+cell2-1 cell2-2
+cell3-1 cell3-2
+======= =======
+
+table having :widths: option
+----------------------------
+
+.. _mytabular:
+
+.. table::
+ :widths: 30,70
+ :name: namedtabular
+ :class: booktabs, colorrows
+
+ ======= =======
+ header1 header2
+ ======= =======
+ cell1-1 cell1-2
+ cell2-1 cell2-2
+ cell3-1 cell3-2
+ ======= =======
+
+See :ref:`this <mytabular>`, same as namedtabular_.
+
+table having :align: option (tabulary)
+--------------------------------------
+
+.. table::
+ :align: right
+
+ ======= =======
+ header1 header2
+ ======= =======
+ cell1-1 cell1-2
+ cell2-1 cell2-2
+ cell3-1 cell3-2
+ ======= =======
+
+table having :align: option (tabular)
+-------------------------------------
+
+.. table::
+ :align: left
+ :widths: 30,70
+
+ ======= =======
+ header1 header2
+ ======= =======
+ cell1-1 cell1-2
+ cell2-1 cell2-2
+ cell3-1 cell3-2
+ ======= =======
+
+table with tabularcolumn
+------------------------
+
+.. tabularcolumns:: cc
+
+======= =======
+header1 header2
+======= =======
+cell1-1 cell1-2
+cell2-1 cell2-2
+cell3-1 cell3-2
+======= =======
+
+table with cell in first column having three paragraphs
+-------------------------------------------------------
+
++--------------+
+| header1 |
++==============+
+| cell1-1-par1 |
+| |
+| cell1-1-par2 |
+| |
+| cell1-1-par3 |
++--------------+
+
+
+table having caption
+--------------------
+
+.. list-table:: caption for table
+ :header-rows: 1
+
+ * - header1
+ - header2
+ * - cell1-1
+ - cell1-2
+ * - cell2-1
+ - cell2-2
+ * - cell3-1
+ - cell3-2
+
+table having verbatim
+---------------------
+
+.. list-table::
+ :header-rows: 1
+
+ * - header1
+ - header2
+ * - ::
+
+ hello world
+
+ - cell1-2
+ * - cell2-1
+ - cell2-2
+ * - cell3-1
+ - cell3-2
+
+table having both :widths: and problematic cell
+-----------------------------------------------
+
+.. list-table::
+ :header-rows: 1
+ :widths: 30,70
+
+ * - header1
+ - header2
+ * - + item1
+ + item2
+ - cell1-2
+ * - cell2-1
+ - cell2-2
+ * - cell3-1
+ - cell3-2
+
+table having problematic cell
+-----------------------------
+
+.. list-table::
+ :header-rows: 1
+
+ * - header1
+ - header2
+ * - + item1
+ + item2
+ - cell1-2
+ * - cell2-1
+ - cell2-2
+ * - cell3-1
+ - cell3-2
+
+table having both stub columns and problematic cell
+---------------------------------------------------
+
+.. list-table::
+ :header-rows: 1
+ :stub-columns: 2
+
+ * - header1
+ - header2
+ - header3
+ * - + instub1-1a
+ + instub1-1b
+ - instub1-2
+ - notinstub1-3
+ * - cell2-1
+ - cell2-2
+ - cell2-3