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
    – Joseph Wright
    Commented May 6 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
    – matteofg
    Commented May 6 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?
    – AlexG
    Commented May 13 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
    – Joseph Wright
    Commented May 13 at 10:06

You must log in to answer this question.

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