Is there any way to make Figures-label with automatically incremented counter. I have this code:
\documentclass[10pt,a4paper,openany]{book}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics{natural-number-line-1.pdf}
\caption{image-Numbe-1}
\label{fig:f1.1}
\end{figure}
\ref{fig:f1.1}\
%%%%%%%%%%%%%%%%
\begin{figure}
\includegraphics{natural-number-line-2.pdf}
\caption{image-Numbe-2}
\label{fig:f1.2}
\end{figure}
\ref{fig:f1.2}\
%%%%%%%%%%%%%%%%
\begin{figure}
\includegraphics{natural-number-line-3.pdf}
\caption{image-Numbe-3}
\label{fig:f1.3}
\end{figure}
\ref{fig:f1.3}\
%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
\end{document}
when i insert a new image and reference it, so i must change all the labels after it, like that:
\documentclass[10pt,a4paper,openany]{book}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\includegraphics{newimage.pdf}
\caption{newimage}
\label{fig:f1.1}
\end{figure}
\ref{fig:f1.1}\\
%%%%%%%%%%%%%%%%
\begin{figure}
\includegraphics{natural-number-line-1.pdf}
\caption{image-Numbe-1}
\label{fig:f1.2}
\end{figure}
\ref{fig:f1.2}\\
%%%%%%%%%%%%%%%%
\begin{figure}
\includegraphics{natural-number-line-2.pdf}
\caption{image-Numbe-2}
\label{fig:f1.3}
\end{figure}
\ref{fig:f1.3}\\
%%%%%%%%%%%%%%%%
\begin{figure}
\includegraphics{natural-number-line-3.pdf}
\caption{image-Numbe-3}
\label{fig:f1.4}
\end{figure}
\ref{fig:f1.4}\\
%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%
\end{document}
I have more than 1000 figures, and my question is: Is there any way to make label with automatically incremented counter, so i can insert and reference figures in any place without change all the labels of figures after that?
\labelis just an arbitrary name. It has nothing to do with the figure number you are getting. Thus, use descriptive labels (such asfig:introductory_figureorfig:scope,...) rather than labels that include chapter/figure numbers. – leandriis Sep 30 '20 at 18:28\label,\refmechanism is that figures, tables,... are automatically numbered and referenced correctly, even if you change their order. Therefore, don't use labels that just make sense if your images stay in a spcific order. Probably you could use the filename as the label? – leandriis Sep 30 '20 at 18:36\labelmechanism is so that you do not need to adjust the numbering if you add or insert figures (or sections) it is normally considered bad style but if you want to use an incremental number to generate unique references that will work fine, but there is no relation between that internal numbered id used for\labeland the actual printed figure number, so there is no need to change the labels or references when you re-order the figures. Auto-generating the label defeats the process as then you have no way to have a stable id to use with\ref. – David Carlisle Sep 30 '20 at 22:02\ref{}to know and constant unique labels. If you have 40 figures and you remove the third figure, and the figurefig:1.4is relabelled automatily tofig:1.3, what happend with already made reference to later figures (from\ref{fig:1.4}to\ref{fig:1.40})? Now all this reference will point to the wrong figure. What now? Manually change all the references? – Fran Oct 04 '20 at 14:41