# Figure numbers in Lyx and PDF are differnt!

I am using Lyx 2.1 and Adobe Acrobat Reader DC for thesis. I need to figures to be numbered for each chapter, i.e. Fig 2.3 for second chapter's third figure. I tried the codes recommended in the forum but it didn't work out. So I returned to flat numbering. Now the problem is the number in Lyx is 1,2,3, ... but in pdf it resets in start of each section ie. first figure of each section is 1.1 and second 1.2 and in the start of next section again 1.1? Can anybody help me with this. (The class is NUThesis and I don't have any module and preamble). The class file is here, LyX Layout for the NU Thesis Class. The code that I used: \makeatletter \@addtoreset{figure}{chapter}% Reset figure numbering at every chapter \makeatother \renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}% Figure number is chapter.figure

• Welcome! Please provide a document as small as possible (a Minimal Working Example) so that we can reproduce your problem. Could you provide as well the "the codes recommended in the forum" that you tried? Could you as well say where you found this NUThesis class? Is it there? – Clément Nov 13 '15 at 18:59
• The layout is hear (LyX Layout for the NU Thesis Class Url: math.unl.edu/graduate) – Mehdi Firouznia Nov 13 '15 at 19:08
• he codes that I added to preamble :\makeatletter \@addtoreset{figure}{chapter}% Reset figure numbering at every part \makeatother \renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}% Figure number is part.figure – Mehdi Firouznia Nov 13 '15 at 19:17
• You should rather edit your first post. Click on "edit" between the tags and the comments, or look at this guideline. And please, format your code. – Clément Nov 13 '15 at 19:25

With the following code :

\documentclass[print]{nuthesis} % Require http://www.math.unl.edu/graduate/nuthesis/nuthesis.zip
\begin{document}
\chapter{Foreword}
\section{First section}
\begin{figure}
\caption{First figure}
\end{figure}
\section{Second Section}
\begin{figure}
\caption{Second figure}
\end{figure}
\begin{figure}
\caption{Third figure}
\end{figure}
\chapter{Introduction}
\section{A second first section}
\begin{figure}
\caption{Forth figure}
\end{figure}
\section{A second second section}
\begin{figure}
\caption{Fifth figure}
\end{figure}
\end{document}


I get figures numbered 1.1, 1.2, 1.3, 2.1, 2.2.

Isn't that the behavior you expect?

• I just copy and paste my work to new file from the same template and it's OK now. Thanks ( still confused what happened to the original one, specifically the part that pdf and lyx show different figure numbers) – Mehdi Firouznia Nov 13 '15 at 20:11
• A mysterious solution, then… To quote another rule of the stack exchange network: "Saying “thanks” is appreciated, but it doesn’t answer the question. Instead, vote up the answers that helped you the most! If these answers were helpful to you, please consider saying thank you in a more constructive way – by contributing your own answers to questions your peers have asked on Stack Overflow." – Clément Nov 13 '15 at 20:16