Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #9305 LaTeX: backslash in sphinxupquote error with Japanese #9335

Merged
merged 1 commit into from Jun 13, 2021

Conversation

jfbu
Copy link
Contributor

@jfbu jfbu commented Jun 13, 2021

@jfbu jfbu added this to the 4.0.3 milestone Jun 13, 2021
@@ -765,7 +765,8 @@
% break at . , ; ? ! /
\sphinxbreaksviaactive
% break also at \
\let\sphinx@textbackslash\textbackslash
\setbox8=\hbox{\textbackslash}%
\def\sphinx@textbackslash{\copy8}%
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should perhaps use a proper scratch box but the contents of \sphinxupquote should be a text string hence it seems legit to use say \box8 as here (as this is enclosed in braces).

The \textbackslash is a complex command which checks the current font encoding and triggers a fall-back font encoding (OMS, math character) for example if character not available. So the former method with \let did not have expected effect and the \textbackslash was trying to redefine itself in a \discretionary context where only boxes are allowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I mentioned OMS from my pure latex testing, but in Sphinx context this will be T1 encoding)

@jfbu
Copy link
Contributor Author

jfbu commented Jun 13, 2021

I used this test file from a former issue with backslash and line-wrapping in literal environments.

Welcome to FOO's documentation!
===============================

:file:`a\\b`

:file:`\\C\\a{}a{}a{}\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa\\aaa`

::

   \aaa

``\aaa``

:file:`\\C\\aaa`


::

   \a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\a\

AAA

.. parsed-literal::

   \\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\a\\

AAA

.. raw:: latex

         \par\hrule\par

:file:`a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\a\\\\aa`

I tested with language='ja' and it works.

@jfbu
Copy link
Contributor Author

jfbu commented Jun 13, 2021

Thanks for review, I merge now.

@jfbu jfbu merged commit 8939a75 into sphinx-doc:4.0.x Jun 13, 2021
@jfbu jfbu deleted the 9305_platex_backslash_upquote branch June 13, 2021 17:14
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants