Hi Paul,

Le 25/05/2024 à 16:20, Paul Smith a écrit :
I recently upgraded to Sphinx v5.3.0, and it looks like something has
changed in the latexpdf generation. I have an rst file with the following C
code snippet:

:code:`"%zu\n"`

Previously, this worked fine in producing latex output. However, with
v5.3.0, I get the following error on "make latexpdf":

! Text line contains an invalid character.
l.14023 \sphinxcode{\sphinxupquote{"\%zu^^@
                                            n"}} is a suitable format %

So, the \n in the code block was converted into "^@n" in the .tex file,
which throws an error with latex. What is the proper way to put in the "\n"
in a code block and have it work with latex?


 this is strange indeed.  Yes ^@ will break LaTeX. I could not reproduce with 
v5.3.0.

Sphinx version: 5.3.0
Python version: 3.12.3 (CPython)
Docutils version: 0.21.2
Pygments version: 2.18.0
Jinja2 version: 3.1.4

I only see \sphinxcode{\sphinxupquote{"\%zun"}} with no fancy null character in 
output.

Variants with syntax highlighting have no issue either.

```
:code:`"%zu\n"`

.. code:: C

   "%zu\n"


.. role:: Ccode(code)
   :language: C

:Ccode:`"%zu\n"`
```

What is your version of Docutils

Best,

Jean-François

--
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sphinx-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/v3nrd6%24uqs%241%40ciao.gmane.io.

Reply via email to