# longtable in latex doesn't appear in list of tables [closed]

This longtable doesn't appear in the list of tables, I have tried some variants of captions but I couldn't get it to work.

\begin{adjustwidth}{-7cm}{-2cm}
\begin{longtable}{|p{5cm}|p{10cm}|}
% \def\arraystretch{1.1}
% \begin{tabular}{|m{5cm}|m{9cm}|}
\hline
\multicolumn{2}{|c|}{\centerline{Generating Inferences}}\\
\hline
\hline
\centerline{Rule} & \centerline{Formula}\\
\hline
\hline
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\begin{center}
Equality Resolution (ER)
\end{center}
&
\begin{center}
\begin{tabular}{c}
$s \not\simeq t \vee R$\\
\hline
$\sigma(R)$\\
\\
\end{tabular}
\\
$\text{if } \sigma = mgu(s,t) \text{ and } \sigma(s\not\simeq t) \text{ is eligible for resolution}$
\\
\end{center}
\\
\hline
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\begin{center}
Superposition into negative literals (SN)
\end{center}
&
\begin{center}
\begin{tabular}{c c}
$s \simeq t \vee S$ & $u \not\simeq v \vee R$\\
\hline
\multicolumn{2}{c}{$\sigma(u[p \leftarrow \sigma(t)] \not\simeq v \vee S \vee R)$}\\
\\
\end{tabular}
\\if $\sigma = mgu(u|_p,s)$, $\sigma(s) \not< \sigma(t)$, $\sigma(u) \not< \sigma(v)$, $\sigma(s \simeq t)$ is eligible for paramodulation, $\sigma(u \not\simeq v)$ is eligible for resolution, and $u|_p \not\in V$
\\
\end{center}
\\
\hline
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\begin{center}
Superposition into positive literals (SP)
\end{center}
&
\begin{center}
\begin{tabular}{c c}
$s \simeq t \vee S$ & $u \simeq v \vee R$\\
\hline
\multicolumn{2}{c}{$\sigma(u[p \leftarrow \sigma(t)] \simeq v \vee S \vee R)$}\\
\\
\end{tabular}
\\
if $\sigma = mgu(u|_p,s)$, $\sigma(s) \not< \sigma(t)$, $\sigma(u) \not< \sigma(v)$, $\sigma(s \simeq t)$ is eligible for paramodulation, $\sigma(u \not\simeq v)$ is eligible for resolution, and $u|_p \not\in V$
\\
\end{center}
\\
\hline
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\begin{center}
Equality Factoring (EF)
\end{center}
&
\begin{center}
\begin{tabular}{c}
$s \simeq t \vee u \simeq v \vee R$\\
\hline
$\sigma(t \not\simeq v \vee u \simeq v \vee R)$\\
\\
\end{tabular}
\\
if $\sigma = mgu(s,u)$, $\sigma(s) \not< \sigma(t)$, $\sigma(s \simeq t)$  is eligible for paramodulation.
\\
\end{center}
\\
\hline
\caption{Generating inference rules of the \textbf{SP} calculus implemented in E}
\label{table:sp-ginference-rules}
\end{longtable}


## closed as unclear what you're asking by ChrisS, Henri Menke, Troy, Stefan Pinnow, TeXnicianSep 27 '17 at 4:19

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to TeX SX! Could you post a full compilable code, not just a fragment? – Bernard Sep 26 '17 at 22:16
• Well, when I tried extracting this fragment from the project to create a file with only this table it worked fine, given that I use \table and \tabular in the same project, would that be the reason? – Ahmed Anwar Sep 26 '17 at 22:24
• You need to make a complete example that shows any problem that you want help with it's impossible to debug working code:-) start from a copy of the failing document and delete as much as you can, checking the problem still happens, then post the smallest document that you can make – David Carlisle Sep 26 '17 at 22:26
• I took the whole file from the project and put it in an empty one yet it's still working, and I have imported all of the packages from the whole project. I guess I will just delete the question. – Ahmed Anwar Sep 26 '17 at 22:38
• Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See minimal working example (MWE). – Henri Menke Sep 27 '17 at 1:58

It's not easy to tell what's ailing your code, as you've only provided a code snippet but no \listoftables command, no indication of the document class that's in use, and no listing of the packages you employ.

At any rate, if I expand your code snippet to make it minimally compilable, the longtable does show up in the list of tables.

A suggestion: Do try to declutter and simplify your LaTeX code, possibly along the lines shown below. You'll find yourself writing both more quickly while being less prone to (coding) errors. Do also strive to give your tables a more open "look", e.g., by omitting all vertical lines and creating well-spaced horizontal lines (courtesy of the booktabs package).

\documentclass{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{longtable,amsmath,array,booktabs}

\DeclareMathOperator{\mgu}{mgu}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\setlength{\LTcapwidth}{\textwidth} % default: ca. 10cm
\setlength\extrarowheight{3pt}

\begin{document}
\listoftables

\bigskip\bigskip

\begin{longtable}{@{} C{5cm}C{10cm} @{}}

\toprule
\multicolumn{2}{c}{Generating Inferences}\\[1ex]
Rule & Formula\\
\midrule

\caption{Generating inference rules of the \textbf{SP} calculus implemented in E}
\label{table:sp-ginference-rules}
\endlastfoot

Equality Resolution (ER) &
$\begin{array}{c} s\not\simeq t\vee R\\ \hline \sigma(R) \end{array}$ \\[3ex]
& if $\sigma = \mgu(s,t)$ and
$\sigma(s\not\simeq t)$ is eligible for resolution
\\[1ex]

\midrule

Superposition into negative literals (SN) &
$\begin{array}{c c} s \simeq t \vee S & u \not\simeq v \vee R\\ \hline \multicolumn{2}{c}{% \sigma(u[\,p\to\sigma(t)]\not\simeq v\vee S\vee R)} \end{array}$ \\[3ex]
& if $\sigma = \mgu(u|_p,s)$,
$\sigma(s) \not< \sigma(t)$,
$\sigma(u) \not< \sigma(v)$,
$\sigma(s \simeq t)$ is eligible for paramodulation,
$\sigma(u \not\simeq v)$ is eligible for resolution,
and $u|_p \not\in V$
\\[1ex]

\midrule

Superposition into positive literals (SP) &
$\begin{array}{cc} s \simeq t \vee S & u \simeq v \vee R\\ \hline \multicolumn{2}{c}{% \sigma(u[\,p \to \sigma(t)]\simeq v\vee S\vee R)} \end{array}$ \\[3ex]
& if $\sigma = \mgu(u|_p,s)$,
$\sigma(s) \not< \sigma(t)$,
$\sigma(u) \not< \sigma(v)$,
$\sigma(s \simeq t)$ is eligible for paramodulation,
$\sigma(u \not\simeq v)$ is eligible for resolution,
and $u|_p \not\in V$
\\[1ex]

\midrule

Equality Factoring (EF)
&
$\begin{array}{c} s \simeq t \vee u \simeq v \vee R\\ \hline \sigma(t \not\simeq v \vee u \simeq v \vee R) \end{array}$ \\[3ex]
& if $\sigma = \mgu(s,u)$,
$\sigma(s) \not< \sigma(t)$,
$\sigma(s \simeq t)$ is eligible for paramodulation.
\\[1ex]
\bottomrule

\end{longtable}
\end{document}


Loading ltablex, which brings the functionalities of longtable to tabularx, I have no prblem with the list of tables. I took the opportunity to simplify your code, and took the liberty to slightly modify the layout of the table:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[ignoremp]{geometry}
\usepackage{amsmath, amssymb}
\usepackage{tabularx, ltablex, caption}%{l}
\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}m{#1}}

\begin{document}

\listoftables
\bigskip
\setlength{\extrarowheight}{3pt}
\keepXColumns
\noindent\begin{tabularx}{\linewidth}{|>{\hsize=0.67\hsize}X|>{\hsize=1.33\hsize}X|}
\caption{Generating inference rules of the \textbf{SP} calculus implemented in E}
\label{table:sp-ginference-rules}\\
\hline
\multicolumn{2}{|c|}{Generating Inferences}\\
\hline
\hline
Rule & Formula\\
\hline
\hline
\hline
\multicolumn{2}{|c|}{Generating Inferences}\\
\hline
\hline
Rule & Formula\\
\hline
\hline
\hline
\endfoot
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Equality Resolution (ER)
& $\begin{matrix} s \not\simeq t \vee R\\ \hline \sigma(R) \end{matrix}$\medskip\newline
\parbox{\hsize}{if $\sigma = mgu(s,t)$ and $\sigma(s\not\simeq t)$ is eligible for resolution.}\smallskip
\\
\hline
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Superposition into negative literals (SN)
& $\begin{matrix} s \simeq t \vee S & u \not\simeq v \vee R \\ \hline \multicolumn{2}{c}{\sigma(u[p \leftarrow \sigma(t)] \not\simeq v \vee S \vee R)} \end{matrix}$ \medskip\newline
\parbox{\hsize}{if $\sigma = mgu(u|_p,s)$, $\sigma(s) \nless \sigma(t)$, $\sigma(u) \nless \sigma(v)$, $\sigma(s \simeq t)$ is eligible for paramodulation, $\sigma(u \not\simeq v)$ is eligible for resolution, and $u|_p \notin V$.}\smallskip
\\
\hline
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Superposition into positive literals (SP)
&$\begin{matrix} s \simeq t \vee S & u \simeq v \vee R \\ \hline \multicolumn{2}{c}{\sigma(u[p \leftarrow \sigma(t)] \simeq v \vee S \vee R)} \end{matrix}$
\medskip\newline
\parbox{\hsize}{if $\sigma = mgu(u|_p,s)$, $\sigma(s) \nless \sigma(t)$, $\sigma(u) \nless \sigma(v)$, $\sigma(s \simeq t)$ is eligible for paramodulation, $\sigma(u \not\simeq v)$ is eligible for resolution, and $u|_p \notin V$.}\smallskip
\\
\hline
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Equality Factoring (EF)
& $\begin{matrix} s \simeq t \vee u \simeq v \vee R\\ \hline \sigma(t \not\simeq v \vee u \simeq v \vee R) \end{matrix}$ \medskip\newline
\parbox{\hsize}{ if $\sigma = mgu(s,u)$, $\sigma(s) \not< \sigma(t)$, $\sigma(s \simeq t)$ is eligible for paramodulation.}\medskip
\end{tabularx}

\end{document}


• @Mico: Oh! yes. It's a residue of my first trial: I hadn't removed \centerlines from the O.P.'s code, which made tabularx overflow into the margin, and I didn't understand why. Thanks for pointing the problem! – Bernard Sep 27 '17 at 8:23

you have used \caption[] the empty optional argument there is specifically to prevent the caption being in the table of contents,

• even if I delete it, it still doesn't appear in the list of tables – Ahmed Anwar Sep 26 '17 at 22:18
• @AhmedAnwar are you sure? (you would need to run latex twice) but please fix the example so people can test it – David Carlisle Sep 26 '17 at 22:23