Skip to content

LaTeX: backticks in code-blocks trigger latexpdf build warning (and font change) with late TeXLive 2019 #8711

Closed

Description

@jfbu

Describe the bug

For users with LaTeX2e 2020-02-02 or later (i.e. final TL2019 but not early one) latexpdf build console output might get cluttered with

Package textcomp Warning: Symbol \textasciigrave not provided by
(textcomp)                font family pcr in TS1 encoding.
(textcomp)                Default family used instead on input line 98.

for each backtick rendered as a literal. The glyph in pdf output is slightly different. Possibly looks better, actually.

To Reproduce
Steps to reproduce the behavior:

Insert this in index.rst and issue make latexpdf.

::

   The :py:func:`enumerate` function can be used for ...

Expected behavior
No LaTeX warnings.

Environment info

  • OS: [e.g. Unix/Linux/Mac/Win/other with version]
  • Python version: [e.g. 3.7.1]
  • Sphinx version: 3.4.0, 4.0.0+/3ed7590ed
  • LaTeX: TeXLive 2019 after LaTeX 2e 2020-02-02 update or TeXLive 2020.

Additional context

Upstream latex ticket: latex3/latex2e#478

Activity

  1. changed the title [-]LaTeX: backticks in code-blocks trigger latexpdf build warning with late TeXLive 2019 (and font change)[/-] [+]LaTeX: backticks in code-blocks trigger latexpdf build warning (and font change) with late TeXLive 2019[/+] on Jan 20, 2021
  2. jfbu commented on Jan 20, 2021

    @jfbu
    ContributorAuthor

    The problem is not only for code-blocks, this rst source:

    We have a LaTeX problem with \`backticks'

    triggers

    Package textcomp Warning: Symbol \textasciigrave not provided by
    (textcomp)                font family ptm in TS1 encoding.
    (textcomp)                Default family used instead on input line 97.
    

    if using default Sphinx "times" font for pdf output of main text.

  3. jfbu commented on Jan 20, 2021

    @jfbu
    ContributorAuthor

    The subsituted glyph looks actually better (at least for mono font). The problem is with the numerous warnings and loading of an extra tex font. Probably the reasonable way out (as LaTeX2e is not going to change back) is to switch to the TeX Gyre fonts. (might improve support for european languages, only Latin ones) This means also that we need to augment our dependencies for Linux distros and tell people to look out for "tex-gyre" or similar named package to install on their systems (Ubuntu xenial has it.)

    I am attaching
    testasciigrave.pdf with its latex source
    testasciigrave.tex.txt with extra .txt in filename to attach here.

    This shows how the backtick and single quote (non smartified) look like with Sphinx default fonts for make latexpdf, when done with LaTeX posterior to 2020/02/02, and how it was before. And it shows how it would look like if we switched to the tex-gyre fonts by default (indenpendently hopefully of whether using LaTeX from 2015 or from 2020).

  4. tk0miya commented on Jan 20, 2021

    @tk0miya
    Member

    +1 for adding the font to our dependency list. It's good timing for us to do that because we have a plan for a major release this spring.

  5. jfbu commented on Jan 20, 2021

    @jfbu
    ContributorAuthor

    @tk0miya simplest way would be to replace our default \usepackage{times} by \usepackage{newtxtext}. The latter uses the tex gyre fonts clones for times+helvetica+courier. Arguably we could add \usepackage{newtxmath} for math equations matching better with Times-like body font.

  6. added this to the 4.0.0 milestone on Jan 20, 2021
  7. added 2 commits that reference this issue on Jan 20, 2021
    a00b78c
    99a8b7f
  8. jfbu commented on Jan 20, 2021

    @jfbu
    ContributorAuthor

    @tk0miya simplest way would be to replace our default \usepackage{times} by \usepackage{newtxtext}. The latter uses the tex gyre fonts clones for times+helvetica+courier. Arguably we could add \usepackage{newtxmath} for math equations matching better with Times-like body font.

    The package newtxtext is very useful to a LaTeX user, but not so much to us, because its goodies are mainly available via LaTeX macros which we are not going to output. Besides, it loads quite a few LaTeX packages. And on Ubuntu it is in texlive-fonts-extra which is very big (almost half a gigabyte). So in the end at #8716 I decided to use more directly tgtermes and tgheros (they are really almost exactly like what \usepackage{times} provided but the LaTeX support of the font system is more complete, for example they fix this issue and might improve support of European languages without having to use xetex or luatex).

    For the monospace font newtxtt LaTeX package exists and has much less LaTeX dependencies than newtxtext, and I wish I could use it. Unfortunately it too adds texlive-fonts-extra as font dependency. What it would bring in addition to direct txtt usage is a choice of shapes for the 0 digit. txtt only has a slashed one, but
    newtxtt has a dotted one as well as two oblong ones, and one with the slash in other direction. Also newtxtt has an option to scale the font. But I felt txtt at regular size is already a good match to times (tgtermes).

  9. jfbu commented on Jan 23, 2021

    @jfbu
    ContributorAuthor

    Fixed by #8716 for next major release

  10. added a commit that references this issue on Mar 11, 2021
    3134085
  11. locked as resolved and limited conversation to collaborators on Jul 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions