[Tex/LaTex] Custom numbering of figures

numberingpgfplotstikz-pgf

I'd like to number figures in a custom way.
For example: fig. 1, fig. 2a, fig. 2b, fig. 3 (among figures there is text).

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pgfplots}

\begin{document}

Bla bla bla

\begin{figure}[h]
\centering
\begin{center}
    \begin{tikzpicture}

        \draw (0,0) circle (1cm);   

    \end{tikzpicture}
\end{center}
\caption{Es.}
\end{figure}

Bla bla bla

\begin{figure}[h]
\centering
\begin{center}
    \begin{tikzpicture}

        \draw (0,0) circle (1cm);   

    \end{tikzpicture}
\end{center}
\caption{Es.}
\end{figure}

bla bla

\begin{figure}[h]
\centering
\begin{center}
    \begin{tikzpicture}

        \draw (0,0) circle (1cm);   

    \end{tikzpicture}
\end{center}
\caption{Es.}
\end{figure}

bla

\begin{figure}[h]
\centering
\begin{center}
    \begin{tikzpicture}

        \draw (0,0) circle (1cm);   

    \end{tikzpicture}
\end{center}
\caption{Es.}
\end{figure}

\end{document}

Thank you so much for your time.

Best Answer

As mentioned in the comments, to change the caption name ("Figure ") you can just use

\renewcommand{\figurename}{Fig.}

To customize the counter, you have to redefine \thefigure. If you want to manually choose the counter every time, just write something like

\renewcommand{\thefigure}{2a}

before each figure. The default implementation of \thefigure uses an automatically incrementing counter:

\renewcommand{\thefigure}{\arabic{figure}}

where figure is a counter, see for example this. Note that you have to revert the \thefigure command to the default value if you want to stop customizing your labels and get an automatically incrementing counter again. You can use \setcounter{\thefigure}{2} to set the value of the counter.

figs

\documentclass[10pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{pgfplots}

\renewcommand{\figurename}{Fig.}
\begin{document}

    Bla bla bla
    \renewcommand{\thefigure}{1}
    \begin{figure}[h]
        \centering
        \begin{center}
            \begin{tikzpicture}

            \draw (0,0) circle (1cm);   

            \end{tikzpicture}
        \end{center}
        \caption{Es.}
    \end{figure}

    Bla bla bla

    \renewcommand{\thefigure}{2a}
    \begin{figure}[h]
        \centering
        \begin{center}
            \begin{tikzpicture}

            \draw (0,0) circle (1cm);   

            \end{tikzpicture}
        \end{center}
        \caption{Es.}
    \end{figure}

    bla bla

    \renewcommand{\thefigure}{2b}
    \begin{figure}[h]
        \centering
        \begin{center}
            \begin{tikzpicture}

            \draw (0,0) circle (1cm);   

            \end{tikzpicture}
        \end{center}
        \caption{Es.}
    \end{figure}

    bla

    \setcounter{figure}{2}
    \renewcommand{\thefigure}{\arabic{figure}}
    \begin{figure}[h]
        \centering
        \begin{center}
            \begin{tikzpicture}

            \draw (0,0) circle (1cm);   

            \end{tikzpicture}
        \end{center}
        \caption{Es.}
    \end{figure}

\end{document}