5

This mwe:

\DocumentMetadata{testphase=new-or-1} \documentclass{book} \usepackage{hyperref} \usepackage[ocgcolorlinks]{ocgx2} \begin{document} \tableofcontents \chapter{first chapter} \end{document} 

produces, in the console, the following error:

(./ocgx2.toc ! Undefined control sequence. \pdf_object_new:nn ...\__pdf_backend_object_new:n {#1} l.1 ...\numberline {1}first chapter}{3}{chapter.1} % 

The error occurs only with the ocgcolorlinks option.

Finally, all my documents with this 'configuration' (i.e. the simultaneous presence of the testphase=new-or-1 key, the ocgcolorlinks option and the \tableofcontents command) always compiled correctly.

1
  • 2
    I'll take a look at this shortly Commented May 6, 2024 at 14:42

1 Answer 1

4

There are a couple of oversights in the compatibility code: the approach being used to make PDF objects is one we've adjusted, and the older one is being used here. For the present, use:

\DocumentMetadata{testphase=new-or-1} \ExplSyntaxOn \cs_gset_eq:NN \__pdf_backend_object_new:n \pdf_object_new:n \cs_gset_protected:Npn \pdf_object_write:nn #1#2 { \exp_args:Nee \__pdf_backend_object_write:nnn { \__pdf_object_retrieve:n {#1} } { \prop_item:Nn \g__pdf_object_prop {#1} } {#2} \bool_gset_true:N \g__pdf_init_bool } \ExplSyntaxOff \documentclass{book} \usepackage{hyperref} \usepackage[ocgcolorlinks]{ocgx2} \begin{document} \tableofcontents \chapter{first chapter} \end{document} 
3
  • I guess it will be updated soon... in the meantime, thank you Commented May 6, 2024 at 15:32
  • Still, the original input does not compile, only with -dev versions of pdflatex and lualatex. Is there anything that needs to be adjusted in ocgx2? Commented May 13, 2024 at 9:40
  • 1
    @AlexG We've moved to a dev/main split for l3backend and l3kernel, so it will be a couple of weeks before the 'release' version is updated Commented May 13, 2024 at 10:06

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.