0

I am writing a science dissertation in the memoir class. The numbering system of the figures and tables appears to use the Chapter Figure number in chapter format, but does not include any separator between Chapter and Figure number in chapter.

This results in code like galaxies in figure \ref{fig:mo_2.7}., in reference to the first figure in the document, producingSDSS galaxies in figure 11

This reads like "figure eleven" (11) instead of "figure one point one" (1.1), as I would expect the figure reference package to produce. The same glitch is happening in the caption beneath the actual figure. So, again for the first figure of the document, code that reads

\begin{figure}[hbtp]
\centering
\includegraphics[scale=1]{literature_comparisons/Mo2010_fig_2_27_right.png}
\caption[Galaxies in the SDSS]{The colour–magnitude\index{galaxy colour} relation of about 365,000 galaxies in the SDSS\index{SDSS} (see section \ref{bimodality} for discussion).
}
    \label{fig:mo_2.7}
\end{figure}

produces the following text upon compilation with pdflatex:

Figure 11. The colour-magnitude relation of about 365,000 galaxies in the SDSS (see section 1.2.1 for discussion).

As you can see, references to section labels work fine with chapter, section and subsection numbers all separarated by periods. References to figure and table labels, however, are all missing periods. To illustrate how this numbering looks throughout the document, see the list of figures that latex generates: List of figures, showing 6 enteries numbered 11, 12, 13, 21, 22, and 31

The document does not have 31 figures, but does have three chapters that include figures.

The preamble for this dissertation is

\documentclass[11pt, oneside, a4paper]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[a4paper,width=138mm,top=35mm,bottom=35mm,bindingoffset=10mm]{geometry}
\usepackage{url}
\usepackage{titlesec}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{rotating}
\usepackage{pdflscape}
\usepackage{mathrsfs,amsmath}
\usepackage{units}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{bibentry}
\usepackage{subcaption}
\usepackage{makeidx}
\usepackage{acro}
\usepackage{caption}
\captionsetup{labelsep=period}
\include{content/acronyms}
\usepackage{natbib}
\bibliographystyle{abbrvnat}
\setcitestyle{authoryear,open={(},close={)}}
\usepackage{perpage}
\MakePerPage{footnote}
\captionsetup[subfigure]{labelformat=simple}
\renewcommand\thesubfigure{\alph{subfigure})}
\setlength{\parindent}{0pt}
\nonzeroparskip
\newsubfloat{figure}
\newcommand{\thesisTitle}{Alpha Omega}
\newcommand{\thesisSubtitle}{}
\newcommand{\thesisName}{AA BB}
\newcommand{\thesisDate}{\today}
\newcommand{\thesisFirstSupervisor}{XX YY}
\newcommand{\thesisSecondSupervisor}{YY ZZ}
\newcommand{\thesisUniversity}{\protect{XX U}}
\newcommand{\thesisUniversityDepartment}{Department of X}
\newcommand{\thesisUniversityInstitute}{Institute X}
\newcommand{\thesisUniversityCity}{Cityname}
\newcommand{\thesisUniversityStreetAddress}{XX Road}
\newcommand{\thesisUniversityPostalCode}{XXXXX}
\renewcommand*{\cftappendixname}{Appendix\space}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\chapterstyle{madsen}
\DoubleSpacing
\setsecnumdepth{subsection}
\nobibliography*
\makepagestyle{myruled}
\makeheadrule {myruled}{\textwidth}{\normalrulethickness}
\makefootrule {myruled}{\textwidth}{\normalrulethickness}{\footruleskip}
\makeevenhead {myruled}{}{\small\itshape\leftmark}{}
\makeoddhead {myruled}{}{\small\itshape\rightmark}{}
\makeevenfoot {myruled}{\small \thepage}{}{}
\makeoddfoot {myruled}{}{}{\small \thepage}

\makepsmarks {myruled}{
\nouppercaseheads
\createmark {chapter} {both} {shownumber}{}{. \ }
\createmark {section} {both}{shownumber}{} {. \ }
\createmark {subsection} {both}{shownumber}{} {. \ }
\createmark {subsubsection}{both}{shownumber}{} {. \ }
\createplainmark {toc} {both} {\contentsname}
\createplainmark {lof} {both} {\listfigurename}
\createplainmark {lot} {both} {\listtablename}
\createplainmark {bib} {both} {\bibname}
\createplainmark {index} {both} {\indexname}
\createplainmark {glossary} {both} {\glossaryname}
}

\makepagestyle{plain}
\makefootrule {plain}{\textwidth}{\normalrulethickness}{\footruleskip}
\makeevenfoot {plain}{\small \thepage}{}{}
\makeoddfoot {plain}{}{}{\small \thepage}
\makeindex

\makepsmarks {plain}{
\nouppercaseheads
\createmark {chapter} {both} {shownumber}{}{. \ }
\createmark {section} {both}{shownumber}{} {. \ }
\createmark {subsection} {both}{shownumber}{} {. \ }
\createmark {subsubsection}{both}{shownumber}{} {. \ }
\createplainmark {toc} {both} {\contentsname}
\createplainmark {lof} {both} {\listfigurename}
\createplainmark {lot} {both} {\listtablename}
\createplainmark {bib} {both} {\bibname}
\createplainmark {index} {both} {\indexname}
\createplainmark {glossary} {both} {\glossaryname}
}
\setsecnumdepth{subsubsection}
\pagestyle{myruled}
\makeindex

How can I get latex to add periods to figure and table labels and references?


Edit:

After a discussion in the comments, I show a minimal example that reproduces the problem and a fix that addresses it. The minimal example is:

\documentclass{memoir}

\usepackage{graphicx}

\begin{document}

\mainmatter
\chapter{Introduction}
\begin{figure}
\includegraphics[scale=1]{plot.png}
\caption{Plot}
\label{fig:plot}
\end{figure}

See figure \ref{fig:plot}.

\end{document}

Replacing

\mainmatter

with

\mainmatter
\renewcommand{\thefigure}{\thechapter.\arabic{figure}}

fixes the problem on the surface level, and the figure numbering system now includes a period between Chapter and Figure number in the chapter:

Screenshot that reads "See figure one point one".

  • 1
    Welcome to TeX SX! Strange… What you want it the default, normally. Try \renewcommand{\thefigure}{\thechapter.\arabic{figure}} in your preamble. – Bernard Jul 1 at 15:05
  • @Bernard Tried adding \renewcommand{\thefigure}{\thechapter.\arabic{figure}} in several parts of the preamble. Does not seem to produce any change. – parallelogram Jul 1 at 15:22
  • 2
    You should post a minimal, but complete code reproducing the problem. I don't think it's the standard behaviour in the memoir class. – Bernard Jul 1 at 15:37
  • 1
    I tried your code after I had added some document content. Various problems were reported related to your code. In the LoF numbers looked like 2.1 In the caption as 2.1. and in a \ref as 2.1. Basically the caption package does not work well with memoir. – Peter Wilson Jul 1 at 17:35
  • 1
    This is a known error, please make sure to update your LaTeX installation. At one point the counter resetting macros was added to the LaTeX kernel, but they did so with an errror. This error have long since been fixed. – daleif Jul 2 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.