# Continuous numbering of figures and tables changes not working

I'm aware of the topic: Continuous v. per-chapter/section numbering of figures, tables, and other document elements and I tried use the options given, but none worked for me. I'm using memoirclass. What I'm doing wrong?

I tried:

\documentclass{memoir}

\usepackage{chngcntr}
\counterwithout{figure}{chapter}

\begin{document}
\chapter{A}
\begin{figure}
\centering
\caption{A figure}
\end{figure}

\end{document}

Figure remains 1.1.

So, I tried \counterwithout{figure}{chapter} since memoir supports this command. Figure remains 1.1.

So I tried:

\usepackage[figurewithin=none]{caption}

Figure remains 1.1.

@jon This is my "style file", named folhadeestilos.txt:

% ---
% Pacotes
% ---
\usepackage[brazilian]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[none]{hyphenat}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage[authoryear,round]{natbib}

% ---
% Margens
% ---
\setlrmarginsandblock{3cm}{2cm}{*}
\setulmarginsandblock{3cm}{2cm}{*}

\checkandfixthelayout

% ---
% Fonte Arial
% ---
\usepackage[scaled]{uarial}
\renewcommand*\familydefault{\sfdefault}
%\usepackage{microtype}

% ---
% Customização da numeração de páginas e das seções
% ---
\renewcommand{\printtoctitle}[1]{%
\centering\large\bfseries\MakeUppercase{#1}}
\renewcommand{\aftertoctitle}{%
\thispagestyle{empty}\afterchaptertitle}

\renewcommand{\printloftitle}[1]{%
\centering\large\bfseries\MakeUppercase{#1}}
\renewcommand{\afterloftitle}{%
\thispagestyle{empty}\afterchaptertitle}

\renewcommand{\printlottitle}[1]{%
\centering\large\bfseries\MakeUppercase{#1}}
\renewcommand{\afterlottitle}{%
\thispagestyle{empty}\afterchaptertitle}

\chapterstyle{tandh}
\aliaspagestyle{chapter}{simple}
\setlength\beforechapskip{-\baselineskip}

\renewcommand{\printchaptertitle}[1]{%
\large\bfseries\MakeUppercase{#1}}
\renewcommand{\printchapternum}{%
\large\bfseries \thechapter\space}

\renewcommand{\bibname}{Referências Bibliográficas}
\AtBeginDocument{\renewcommand{\bibsection}{\chapter{\bibname}}}

% ---
% Legendas e numeração de figuras e tabelas
% ---
\usepackage[center,small,bf]{caption}

% ---
% Ambiente matemático em sans serif
% ---
\everymath{\mathsf{\xdef\mysf{\mathgroup\the\mathgroup\relax}}\mysf}

% ---
% Hyperref
% ---

And this is my simplified main file:

\documentclass[a4paper,12pt,oneside]{memoir}

\begin{document}

...

\pagestyle{simple}
\input{mem.tex}

\end{document}

Where mem.tex contains the \begin{figure} enviroment.

This works for me (revised, to take into account the new file structure):

\documentclass[12pt,openany]{memoir}
\usepackage{filecontents}% <--- used to create the two other files 'on the fly' (it makes the example self-contained)

\usepackage[brazilian]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[none]{hyphenat}
\end{filecontents}

\begin{filecontents}{mem.tex}
\begin{table}[h]
\centering
\begin{tabular}{ll}
a & b \\
\end{tabular}
\caption{table one}
\end{table}

\begin{figure}[h]
\centering
\caption{caption one}
\end{figure}
\end{filecontents}

\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\begin{document}

\chapter{one}

\input{mem.tex}

\section{two}

\begin{table}[h]
\centering
\begin{tabular}{ll}
a & b \\
\end{tabular}
\caption{table two}
\end{table}

\begin{figure}[h]
\centering
\caption{caption two}
\end{figure}

\chapter{three}

\begin{table}[h]
\centering
\begin{tabular}{ll}
a & b \\
\end{tabular}
\caption{table three}
\end{table}

\begin{figure}[h]
\centering
\caption{caption three}
\end{figure}

\section{four}

\begin{table}[h]
\centering
\begin{tabular}{ll}
a & b \\
\end{tabular}
\caption{table four}
\end{table}

\begin{figure}[h]
\centering
\caption{caption four}
\end{figure}

\end{document}

If you are using memoir's \<front|main|back>matter commands, you will need to renew some definitions in order to make \counterwithout work as expected.

Thus, you can add to your preamble in this case (where all figures and tables are in the 'mainmatter' section):

\makeatletter
\renewcommand\@memmain@floats{%
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}}
\makeatother

(This could do in your personal .sty file, e.g.; but in that case, you don't need the two \makeat* commands.)

Less elegantly, you can simply move the \counter* commands to after the \mainmatter declaration.

• I tried your code in a separated archive and worked too. I'm doing a thesis and I have all packages "charged" in a separated .tex and I call it \input{archive.tex} inside of my main .tex file, called thesis. But the archives with the tables and figures are too in separated files and as well I call them by \input command inside of thesis.tex. Could be this my error? – Ana Nascimento May 30 '13 at 4:18
• I hate myself. Why so dumb? Your example worked. I'll look my files more carefully and see what I'm making wrong. Thank you for your time and help @jon. – Ana Nascimento May 30 '13 at 5:10
• @AnaNascimento -- We've all been there, never fear! I can't even count the number of times a trivial non-problem held me up for far too long.... – jon May 30 '13 at 5:21
• I figured out the problem! I was using a \mainmatter command. Once I put it off, the figures and tables are correctly numbered. So now I have a different problem. I was using this command because the first page of the thesis cannot be counted in numbering page sequencet. There are another way to do that without using \mainmatter @jon? – Ana Nascimento May 30 '13 at 6:08
• Perfect, @jon!!! Thank you very very very much!!!! – Ana Nascimento May 30 '13 at 6:13

This is now better explained in the manual for memoir 3.7. As mentioned above \mainmatter resets the numbering. Here is what is now mentioned in the manual as a solution:

\makeatletter
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\renewcommand\@memfront@floats{}
\renewcommand\@memmain@floats{}
\newcommand\@memback@floats{}
\makeatletter

the three \...@floats macros are issued by \frontmatter, \mainmatter and \backmatter and resets in verious ways.