Change chapter number as displayed in LyX

Matt Barnard matt at murphyengineer.com
Fri Mar 27 00:55:47 UTC 2020


Sure, see attached. Adjusting the LyX numbering like this is something I've
found myself wanting to do a number of times.

Thanks for your time,
Matt

Example (attached)

> \setcounter{part}{9}
> Part 10 My document starts on Part 10
> 1 with one section
> \addcontentsline{toc}{part}{*By the way,}*By the way,
> This chapter is an aside, but it needs to be at the Part level in the ToC
> \setcounter{part}{9}
> Part 11 then we continue with Part 10
> 2 but LyX says this is Part 11


Note that I resolved this for now using the following:

\newcounter{previouschapter}
> \newcounter{previoussection}
> \newcounter{uniquechapteranchor}
> \newcommand{\pushchapter}{%
>   \let\previouschaptertitle\parttitle%
>
  \setcounter{previouschapter}{\value{part}}%
>   \setcounter{previoussection}{\value{section}}%
> }
> \newcommand{\popchapter}{%
>   \renewcommand*{\theHpart}{\value{uniquechapteranchor}\the\value{part}}
> % for hyperref

  \chapt{\value{previouschapter}}                                   %
> shorthand for \setcounter{part}{n-1}
>   \part{\previouschaptertitle~(cont.)}%
>   \sect{\value{previoussection}}%
>   \stepcounter{section}%
>   \stepcounter{uniquechapteranchor}%
> }


and then


> \part{Real  part  }

\pushchapter
> \part*{Interrupting part}

\popchapter % output a new part, but don't start a new part in LyX

\section{this is in real  part}


LyX continues numbering with the previous part even though I write a new
part in the output

On Thu, Mar 26, 2020 at 4:57 PM Richard Kimberly Heck <rikiheck at lyx.org>
wrote:

> On 3/26/20 4:16 PM, Matt Barnard wrote:
>
> Hello,
>
> I'm interrupting a numbered chapter with an unnumbered chapter, and I
> would like to continue sections within that previous numbered chapter. I've
> done this on the output side with \setcounter{part}, but in LyX the
> chapter number is still incremented.
>
> I've fixed this for the first instance using the local layout
>
> Counter part
>
> InitialValue 12
>
> End
>
> but I haven't found a way to give LyX a command mid-document to adjust
> numbering.
>
> Is this currently supported?
>
> I'm not sure I entirely understand the issue. Can you post a very simple
> example file?
>
> Riki
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200326/96da083c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: newfile1.lyx
Type: application/lyx
Size: 3025 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-users/attachments/20200326/96da083c/attachment.bin>


More information about the lyx-users mailing list