# Table numbers stay at zero

In my thesis, all the tables using the tabularx package are automatically numbered as zero. So I have for example a chapter 4 that starts with six tables numbered 4.0 ... I thought I had solved it by just using \setcounter{table}{value} before each one of these tables, and it worked. But now I've seen that while the numbering is correct in the document, it is still wrong in my "List of Tables" which is part of a thesis template I'm using. So I guess I have to solve the actual problem at the source but I don't know how.

On obvious solution would be to just do away with tabularx, but I need this package to generate this kind of image positioning:

Here's my code:

\documentclass[11pt, oneside]{Thesis} % The default font size and one-sided printing (no margin offsets)

\graphicspath{{./Pictures/}} % Specifies the directory where pictures are stored

\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{physics}
\usepackage{float}

\usepackage{tabularx}
\usepackage[english]{babel}
\usepackage[table]{xcolor}
\usepackage{tabularx}
%\usepackage{showframe} % for demo
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{lua-visual-debug}

\usepackage{makecell}
\usepackage{placeins}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[square, numbers, comma, sort&compress]{natbib}

\usepackage{booktabs}
%\usepackage[table,xcdraw]{xcolor}

\hypersetup{urlcolor=blue, colorlinks=true} % Colors hyperlinks in blue - change to black if annoying
\title{\ttitle} % Defines the thesis title - don't touch this

\begin{document}

%%%%%%%%%%%%%%%%%%% EXAMPLE OF A TABLE WITH TABULARX %%%%%%%%%%%%%%%%%%%%%%%%
\begin{table}[h]
\centering
\hspace*{-2cm}\makebox[\linewidth][c]{%
\begin{tabularx}{1.2\textwidth}{c*{2}{>{\centering\arraybackslash}X}@{}}
\multirow{2}{*}{
\begin{subfigure}{3cm}
\vspace{-1cm}
\includegraphics[height=12cm]{example-image}
\end{subfigure}}
&   \begin{subfigure}{\hsize}
\caption*{k-$\varepsilon$ RNG}
\includegraphics[width=\hsize,height=8cm]{example-image}
\medskip
\end{subfigure}
&   \begin{subfigure}{\hsize}
\caption*{k-$\varepsilon$ Realizable}
\includegraphics[width=\hsize,height=8cm]{example-image}
\medskip
\end{subfigure}      \\
&   \begin{subfigure}{\hsize}
\caption*{k-$\omega$ SST}
\includegraphics[width=\hsize,height=8cm]{example-image}
\end{subfigure}
&   \begin{subfigure}{\hsize}
\caption*{LES}
\includegraphics[width=\hsize,height=8cm]{example-image}
\end{subfigure}
\end{tabularx}}
\caption{Turbulence models comparison: Turbulent kinetic energy [J/kg] and Subgrid turbulent viscosity ratio [kg/m.s] for LES model}
\label{kinetic}
\end{table}

%%%%%%%%%%%%%%%%%%%% EXAMPLE OF A TABLE WITHOUT TABULARX %%%%%%%%%%%%%%%%%%%%
\begin{table}[htp]
\centering
\hspace*{-1.5cm}
\makebox[\columnwidth][c]{%
\begin{minipage}{1.35\linewidth}
\centering
\begin{subfigure}[t]{.49\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{In-plane velocity vectors [m/s] - Normal profile}
\medskip
\end{subfigure}\hfill
\begin{subfigure}[t]{.49\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{In-plane velocity vectors [m/s] - Inverted profile}
\medskip
\end{subfigure}     \\
\begin{subfigure}[t]{.49\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{In-plane velocity vectors [m/s] - Normal profile close-up}
\medskip
\end{subfigure}\hfill
\begin{subfigure}[t]{.49\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{In-plane velocity vectors [m/s] - Inverted profile close-up}
\medskip
\end{subfigure}  \\
\begin{subfigure}[t]{.49\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Radial velocity contours [m/s] - Normal profile close-up}
\medskip
\end{subfigure}\hfill
\begin{subfigure}[t]{.49\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Radial velocity contours [m/s] - Inverted profile close-up}
\medskip
\end{subfigure}  \\
\begin{subfigure}[t]{.49\textwidth}
\includegraphics[width=\textwidth]{example-imagez}
\caption{Subgrid turbulent viscosity ratio [kg/m.s] - Normal profile close-up}
\medskip
\end{subfigure}\hfill
\begin{subfigure}[t]{.49\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Subgrid turbulent viscosity ratio [kg/m.s] - Inverted profile close-up}
\medskip
\end{subfigure}  \\
\end{minipage}}
%OVERALL CAPTION AND LABEL%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\caption{Comparison of 0,2mm normal and inverted profiles}
\label{0.2mm_comparison}
\end{table}

\end{document}

• If I remember correctly I already answered (between others) on this question no so long ago ... in it is pointed that instead tabularx you should use tabular and all will works as expected. – Zarko Aug 15 '15 at 15:01
• The document class Thesis does not seem to be on the CTAN. The Internet, though, is awash with LaTeX document classes called Thesis.csv and thesis.csv. Which particular one are you using, and where might it be downloaded from? – Mico Aug 15 '15 at 16:07
• @Zarko: Yes, I used tabular where I could, but for these specific tables I need tabularx to be able to use \multirow – Romain Aug 15 '15 at 16:11
• Later evening I will show you, that the multirow is not tabularx dependent. – Zarko Aug 15 '15 at 16:43

From the (almost) the same question (not so long ago) we know, that tabularx clashes with subcaption and caption numbering. So, there is no sense to insist to use it with such application. Instead, it is better to use ordinary tabular and manually calculate width of columns (see MWE below).

multirow works in all types of tables, so for its use there is no reason to stick with tabularx. Instead, to use multirow directly, I prefer to use \multirowcell{<number of lines>}{...} from package makecell. This functionality makecell is based on multirow package.

And again how to make table wider than text. Dedicated package for this is changepage. Here I use option strict and version \adjustwidth*, which protrude table width into outer margin. For details see documentation for this package.

Code:

\documentclass[11pt,oneside]{book}  % The default font size and
% one-sided printing (no margin offsets)
%\graphicspath{{./Pictures/}} % Specifies the directory where pictures are stored
\usepackage[T1]{fontenc}
%\usepackage{physics}
%\usepackage{float}
%\usepackage[english]{babel}

\usepackage{calc}% added for column width calculation
\usepackage[strict]{changepage}% added for column width calculation
\usepackage{booktabs,makecell,multirow}% for tables

%\usepackage{showframe} % for demo
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{ragged2e}
%\usepackage{lua-visual-debug}

%\usepackage{placeins}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
%\usepackage[square, numbers, comma, sort&compress]{natbib}

%\hypersetup{urlcolor=blue, colorlinks=true} % Colors hyperlinks in blue - change to black if annoying
%\title{\ttitle} % Defines the thesis title - don't touch this

\begin{document}
\begin{table}[h]
%\hspace*{-2cm}\makebox[\linewidth][c]{% don't doing this,
% in such cases is better to use  {adjustwidth*}
% from package ˙changepage
\begin{tabular}{@{}p{30mm}*{2}{p{0.5\linewidth-15mm}}@{}}
% centering of columns is not necessary,
% figures take full width of column!
\multirowcell{2}{
\includegraphics[width=\hsize,height=12cm]{example-image}               }
&   \begin{subfigure}{\hsize}
\caption*{k-$\varepsilon$ RNG}
\includegraphics[width=\hsize,height=8cm]{example-image}
\end{subfigure}
&   \begin{subfigure}{\hsize}
\caption*{k-$\varepsilon$ Realizable}
\includegraphics[width=\hsize,height=8cm]{example-image}
\end{subfigure}\bigskip      \\
&   \begin{subfigure}{\hsize}
\caption*{k-$\omega$ SST}
\includegraphics[width=\hsize,height=8cm]{example-image}
\end{subfigure}
&   \begin{subfigure}{\hsize}
\caption*{LES}
\includegraphics[width=\hsize,height=8cm]{example-image}
\end{subfigure}
\end{tabular}
\caption{Turbulence models comparison: Turbulent kinetic energy [J/kg] and Subgrid turbulent viscosity ratio [kg/m.s] for LES model}
\label{kinetic}
\end{table}
\end{document}


As it can be seen from the code, I commented all packages, which are not relevant for showing figures. I also use documentclass book instead of Thesis (which I don't have installed). The code contains also some notes for clarification.

You need neither tabularx nor multirow. It's not clear why you're pushing the thing to the left and want to use more than the default text width, but I didn't change this.

You just need a tabular for the four images; I use another one for the left image just to get vertical centering (there are several other methods).

Note the two nested \makebox commands: the first is to make TeX ignore the width of the inner one, which is set to 1.2\textwidth with the [s] optional argument.

\documentclass[11pt]{article}

\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{siunitx}

\newlength{\mylength}

\begin{document}

%%%%%%%%%%%%%%%%%%% EXAMPLE OF A TABLE WITH TABULARX %%%%%%%%%%%%%%%%%%%%%%%%
\begin{table}[htp]
\centering
\setlength{\mylength}{1.2\textwidth}
\addtolength{\mylength}{-4\tabcolsep} % the space between the columns

\hspace*{-2cm}\makebox[\textwidth]{\makebox[1.2\textwidth][s]{%
\begin{tabular}{@{}c@{}}
\includegraphics[width=3cm,height=12cm]{example-image}
\end{tabular}\hfill
\begin{tabular}{@{}cc@{}}
\begin{subfigure}{0.5\mylength}
\caption*{k-$\varepsilon$ RNG}
\includegraphics[width=0.5\mylength,height=8cm]{example-image}
\end{subfigure}
& \begin{subfigure}{0.5\mylength}
\caption*{k-$\varepsilon$ Realizable}
\includegraphics[width=0.5\mylength,height=8cm]{example-image}
\end{subfigure}      \\ \\ % space out the two rows
\begin{subfigure}{0.5\mylength}
\caption*{k-$\omega$ SST}
\includegraphics[width=0.5\mylength,height=8cm]{example-image}
\end{subfigure}
& \begin{subfigure}{0.5\mylength}
\caption*{LES}
\includegraphics[width=0.5\mylength,height=8cm]{example-image}
\end{subfigure}
\end{tabular}%
}}

\caption{Turbulence models comparison: Turbulent kinetic energy (\si{J/kg}) and Subgrid turbulent
viscosity ratio (\si{kg/m.s}) for LES model} \label{kinetic}

\end{table}

\end{document}


Note the use of siunitx` for the units and the parentheses around the symbols (square brackets are incorrect, as they denote dimensionality, not unit).