The document below, with a chapter/section scheme in a memoir class document, uses a custom \secref command. This command allows reference to a section in the shorter form "section s" that would normally appear in the full form "section c.s". Here c is the chapter number and s is the section number.

The \secref command is as kindly provided by Christian Hupfer, from his "trickier" code answer in Reference with just part of section number after decimal point.

This document used to compile without error.

But now instead it gives this error:

./secref-try.tex:40: Use of \@stripdot doesn't match its definition.
<argument> 1
l.40 In section \secref{sec:more}
                              %% ERROR WITH \@stripdot here

Here is the document:




% Added to allow ref to section n, not section m.n
%    ``trickier' 'code by Christian Hupfer, from
%   https://tex.stackexchange.com/questions/383606/reference-with-just-part-of-section-number-after-decimal-point
% Stripping the dot from the 1.2 -like reference
% Stripping the memoir stuff from the reference, 
%    i.e. \M@TitleReference {1.2}{FOO} and handing #1 (1.2) over to the \@@stripdot macro
\def\@stripdot\M@TitleReference #1#2\@nil{\@@stripdot#1\@nil}
% Macro, second level of expansion
% Expand the argument first
  % Do nothing if #1 is not defined




In section \secref{sec:more} %% ERROR WITH \@stripdot here
of \cref{chap:one} \dots .

And in \cref{sec:one} \dots .


  \section{About one}\label{sec:one}

  \section{More about one}\label{sec:more}


In section \ref{sec:more}


The error does not occur if \usepackage[nocfg]{nomencl} is commented out! Instead, it produces the expected output, including the following first page:

Output from \secnum OK without nomencl package


What's wrong?

Did something change recently in nomencl (which does have changes in version 5.1 dated 2019/02/08), cleveref, hyperref, or even memoir?

  • The code in the "Third installment" block of Christian's answer seems to work fine. Any reason for not using it? – Mico Feb 17 at 21:50
  • @Mico: I may be able to use that "Third installment" instead, but with my actual, book-length project with many, many style modifications, I cannot tell whether doing so will create further problems. The issue remains as to why the "trickier" version no longer works! – murray Feb 17 at 21:58
  • There's nothing like giving the alternative code a try and find out if any "further problems" are created, right? Aside: Is there any particular reason to suspect that "further problems" might be created by the use of the code in the "third installment" block? – Mico Feb 17 at 22:00
  • As I recall, Christian's "Third installment" uses \xassoccnt, which did not get along with \calc (and I do need \calc). Or was that package conflict fixed? – murray Feb 17 at 22:12
  • 1
    The \@stripdot is not by me and we 'talked' about this already, that xassoccnt should be loaded after any package that makes use of calc – user31729 Feb 18 at 15:03

I cannot tell you why the code in the "trickier" block of Christian Hupfer's answer doesn't work for you. However, as I already noted in a comment, the code in the "third installment" block of Christian's answer seems to work just fine.

(Note that the following code expects that version 1.5 or newer of the xassoccnt package is in use.)

enter image description here


%% The following code is from the 'third instalment' 
%% block of the answer posted by Christian Hupfer at 
%% https://tex.stackexchange.com/a/383608
% Replace \arabic{section} with \Roman{section} etc. as needed:
%% End of code from Christian Hupfer's answer


Section \secref{sec:two} of \cref{chap:one} 

\Cref{sec:two} of \cref{chap:one} 

Section \ref{sec:two} of \cref{chap:one} 

\chapter{One}\label{chap:one} \dots
\section{About one}\label{sec:one} \dots
\section{About two}\label{sec:two} \dots
  • 1
    This works just fine, even with my actual book-length project (where xassoccnt is indeed loaded after calc and after packages that depend on calc). I'll wait a bit before accepting this viable answer in the hope that somebody will discover why nomencl now causes the problem with Christian's "trickier" version. – murray Feb 18 at 2:19

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.