4

I need to manually adjust the chapter number in a book, so that three chapter numbers are missing.

\starttext
    \chapter{Birds of Africa}
    \chapter{Birds of Australia}
\stoptext

"Birds of Africa" should appear as chapter 1, but "Birds of Australia" should appear as chapter 5.

I tried \incrementnumber[chapter][4], but this did not work.

How can I manually increment the chapter number?

1
  • This solution does not appear to work. Using ConTeXt 2013.06.10.
    – Village
    Commented Sep 12, 2013 at 5:14

1 Answer 1

2

Section heads do not have a number associated with them. You can try one of the following.

  1. Use ownnumber (but this does not change the number of subsequent chapters)

    \setuphead[chapter][page=no] % so that the result is in one page
    \starttext
    \startchapter[title=Birds of Africa]
      Content
    \stopchapter
    \startchapter[title=Birds of Australia, ownnumber=5]
      Content
    \stopchapter
    \startchapter[title=Birds of Asia]
      Content
    \stopchapter
    \stoptext
    

    enter image description here

  2. The second option is to define your own conversion that will also increment the chapter numbers of subsequent chapters.

    \setuphead[chapter][page=no] % so that the result is in one page
    
    \startluacode
      userdata = userdata or {}
      userdata.myconversion = function(n)
          if n >= 2 then
            context(n+3)
          else
            context(n)
          end
      end
    \stopluacode
    
    \define[1]\myconversion{\usercode{myconversion(#1)}}
    
    \defineconversion[myconversion][\myconversion]
    \setuphead[chapter][conversion=myconversion]
    \starttext
    \startchapter[title=Birds of Africa]
      Content
    \stopchapter
    \startchapter[title=Birds of Australia]
      Content
    \stopchapter
    \startchapter[title=Birds of Asia]
      Content
    \stopchapter
    \stoptext
    

    enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .