[Tex/LaTex] Continuous numbering of figures and tables changes not working

floatsmemoirnumbering

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}{*}
\setheaderspaces{*}{1cm}{*}

\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}

\setsecheadstyle{\large\bfseries}

\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
% ---
\usepackage[hidelinks]{hyperref}

And this is my simplified main file:

\documentclass[a4paper,12pt,oneside]{memoir}
\input{folhadeestilos.tex}

\begin{document}

...

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

\end{document}

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

Best Answer

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)

\begin{filecontents}{folhadeestilos.sty}
 \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}

\usepackage{folhadeestilos}
\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.