I'm trying to provide editing instructions for a document inside a document, which means occasionally having to have section and subsection numbers that are not part of my document and should not be part of my ToC. The convention often used is to have the unicode replacement character symbol, a ? in a diamond, stand in for the unknown section number. Because this confuses lualatex, it's usually rendered as
\usepackage{amssymb,graphicx,stackengine,xcolor}
\def\ucr{\scalebox{2}{\stackinset{c}{}{c}{-.2pt}{%
\textcolor{white}{\sffamily\bfseries\small ?}}{%
\rotatebox{45}{$\blacksquare$}}}}
This works as part of a document. However it produces an error when I try to use it as part of redefining \thesection. That is
\renewcommand\thesection{\ucr.\arabic{section}}
results in:
! Undefined control sequence. \stackinset ...\ifstrequal {#2}{}{\def \stack@tmp {0pt}}{\def \stack@tmp {#2...
A working example:
\documentclass[a4paper,10pt,oneside,openany,final,article]{memoir}
\usepackage{amssymb,graphicx,stackengine,xcolor}
\def\ucr{\scalebox{2}{\stackinset{c}{}{c}{-.2pt}{%
\textcolor{white}{\sffamily\bfseries\small ?}}{%
\rotatebox{45}{$\blacksquare$}}}}
\settocdepth{section}
\begin{document}
\tableofcontents*
\chapter{Intro}
An intro to my problem.
\section{A Section for the Table of Contents}
\chapter{Wording}
Please amend the standing document by inserting a new chapter between the current chapters 4 and 5.
\begin{@empty}
\settocdepth{part}
\renewcommand\thechapter{X}
\renewcommand\thesection{X.\arabic{section}}
\chapter{A New Chapter}
Some contents for the new chapter
\section{New Section}
Some contents for the new section
\end{@empty}
\end{document}
However if X in the renewcommand blocks are changed to \ucr, compilation fails.
\documentclass[a4paper,10pt,oneside,openany,final,article]{memoir}
\usepackage{amssymb,graphicx,stackengine,xcolor}
\def\ucr{\scalebox{2}{\stackinset{c}{}{c}{-.2pt}{%
\textcolor{white}{\sffamily\bfseries\small ?}}{%
\rotatebox{45}{$\blacksquare$}}}}
\settocdepth{section}
\begin{document}
\tableofcontents*
\chapter{Intro}
An intro to my problem.
\section{A Section for the Table of Contents}
\chapter{Wording}
Please amend the standing document by inserting a new chapter between the current chapters 4 and 5.
\begin{@empty}
\settocdepth{part}
\renewcommand\thechapter{\ucr}
\renewcommand\thesection{\ucr.\arabic{section}}
\chapter{A New Chapter}
Some contents for the new chapter
\section{New Section}
Some contents for the new section
\end{@empty}
\end{document}