[Django] #35754: PDF documentation renders curly quotes as full-width

20 views
Skip to first unread message

Django

unread,
Sep 11, 2024, 10:02:04 PM9/11/24
to django-...@googlegroups.com
#35754: PDF documentation renders curly quotes as full-width
-----------------------------------------+-------------------------------
Reporter: A. Rafey Khan | Owner: A. Rafey Khan
Type: Bug | Status: assigned
Component: Documentation | Version:
Severity: Normal | Keywords: sphinx, latex
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 1 |
-----------------------------------------+-------------------------------
Hi,

In the pdf documentation builds, there is a noticeable amount of
unnecessary gap after quote marks especially the apostrophes.
I'll be referring to Django 5.1.x
(https://media.readthedocs.org/pdf/django/5.1.x/django.pdf) at the time of
writing.
For example on page 26, there are near a dozen occurrences where the
contractions such as `isn't` are rendered like `isn' t`.

The issue has been presumably since this PR was merged:
https://github.com/django/django/pull/15079. It is inherently due to the
combination of smart quote feature of `Sphinx` and `ctex` latex package
which we use to enable support for Chinese character set in the pdf
documentation which appears to be rendering curly/smart quotes as full-
width. The issue was previously raised and discussed in the `ctex` source
repository: https://github.com/CTeX-org/ctex-kit/issues/389, However, the
maintainers do not appear interested in merging any related changes into
the package, the main reason being that the package is specifically
tailored for Chinese typesetting and additionally using `ctex`, the
recommended method for producing smart quotes in latex (e.g., `quoted
text") still functions as expected.

I can propose two solutions:

1. We can add the rules in the preamble to convert from full-width quotes
back to half-width as suggested in the mentioned thread.

2. As it appears that our documentation text is mainly in English and
Chinese is used just once merely as an example to demonstrate Unicode-
related functionality (Page 2061). So alternatively, it is also possible
to use Unicode characters other than Chinese and get rid of the `ctex`
dependency. Note that this change won't affect any pdf builds where
language is defined as Chinese as `xeCJK/ctex` would be implicitly
imported in that case.

If we agree on either of the change, I can submit the PR accordingly.
--
Ticket URL: <https://code.djangoproject.com/ticket/35754>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 11, 2024, 10:04:47 PM9/11/24
to django-...@googlegroups.com
#35754: PDF documentation renders curly quotes as full-width
-------------------------------+-----------------------------------------
Reporter: A. Rafey Khan | Owner: A. Rafey Khan
Type: Bug | Status: assigned
Component: Documentation | Version:
Severity: Normal | Resolution:
Keywords: sphinx, latex | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 1
-------------------------------+-----------------------------------------
Changes (by A. Rafey Khan):

* Attachment "sample_bug.PNG" added.

Django

unread,
Sep 12, 2024, 3:00:50 AM9/12/24
to django-...@googlegroups.com
#35754: PDF documentation renders curly quotes as full-width
-------------------------------+-----------------------------------------
Reporter: A. Rafey Khan | Owner: A. Rafey Khan
Type: Bug | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: sphinx, latex | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+-----------------------------------------
Changes (by Sarah Boyce):

* cc: Mariusz Felisiak, David Smith (added)
* easy: 1 => 0
* has_patch: 1 => 0
* stage: Unreviewed => Accepted
* version: => dev

--
Ticket URL: <https://code.djangoproject.com/ticket/35754#comment:1>

Django

unread,
Sep 12, 2024, 8:14:20 AM9/12/24
to django-...@googlegroups.com
#35754: PDF documentation renders curly quotes as full-width
-------------------------------+-----------------------------------------
Reporter: A. Rafey Khan | Owner: A. Rafey Khan
Type: Bug | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: sphinx, latex | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+-----------------------------------------
Changes (by A. Rafey Khan):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/35754#comment:2>

Django

unread,
Sep 12, 2024, 8:31:44 AM9/12/24
to django-...@googlegroups.com
#35754: PDF documentation renders curly quotes as full-width
-------------------------------+-----------------------------------------
Reporter: A. Rafey Khan | Owner: A. Rafey Khan
Type: Bug | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: sphinx, latex | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+-----------------------------------------
Comment (by A. Rafey Khan):

PR: https://github.com/django/django/pull/18577
--
Ticket URL: <https://code.djangoproject.com/ticket/35754#comment:3>

Django

unread,
Sep 13, 2024, 10:51:32 AM9/13/24
to django-...@googlegroups.com
#35754: PDF documentation renders curly quotes as full-width
-------------------------------------+-------------------------------------
Reporter: A. Rafey Khan | Owner: A. Rafey
| Khan
Type: Bug | Status: assigned
Component: Documentation | Version: dev
Severity: Normal | Resolution:
Keywords: sphinx, latex | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/35754#comment:4>

Django

unread,
Sep 13, 2024, 10:52:16 AM9/13/24
to django-...@googlegroups.com
#35754: PDF documentation renders curly quotes as full-width
-------------------------------------+-------------------------------------
Reporter: A. Rafey Khan | Owner: A. Rafey
| Khan
Type: Bug | Status: closed
Component: Documentation | Version: dev
Severity: Normal | Resolution: fixed
Keywords: sphinx, latex | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"1f3f0cd8cabd201063ac024cb72eea27ea8c4aa8" 1f3f0cd]:
{{{#!CommitTicketReference repository=""
revision="1f3f0cd8cabd201063ac024cb72eea27ea8c4aa8"
Fixed #35754 -- Mapped full-width characters in latex to half-width.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35754#comment:5>
Reply all
Reply to author
Forward
0 new messages