Skip to content

Convert to HTML is fine, but Convert to PDF ignores Greek letters #1673

Closed

Description

@ibehnam

This has been discussed many time here and on other forums, but I still don't know how to get Jupyter to print Greek letters when I convert the notebook to PDF. Interestingly, if converted to HTML, everything is fine.

When converted to PDF:
image

When converted to HTML:
image

I've tried using CLI pandoc and tweaking the settings (e.g., changing the font or using xelatex instead of pdflatex), but nothing seems to work. And since these Greek letters are part of my code, I can't just replace them with something that's known to Latex.

Activity

  1. MSeal commented on Nov 17, 2021

    @MSeal
    Contributor

    Try doing the webpdf conversion -- it uses HTML to generate the PDF instead of LaTeX and generally has a lot fewer unsupported renderings.

  2. ibehnam commented on Nov 18, 2021

    @ibehnam
    Author

    Try doing the webpdf conversion -- it uses HTML to generate the PDF instead of LaTeX and generally has a lot fewer unsupported renderings.

    Thanks. I tried that, but it breaks code and code outputs across pages:
    image

  3. cgevans commented on Dec 7, 2021

    @cgevans
    Contributor

    Having unicode letters work in LaTeX differs depending on whether pdflatex or xelatex/lualatex is being used. The current template

    For xelatex/lualatex, having \usepackage{unicode-math} in the template would allow for Greek characters to work reasonably in math (but breaks pdflatex). The ucs package isn't needed / is detrimental.

    For pdflatex, the current template does include \usepackage[mathletters]{ucs}, but the ucs package also needs \usepackage[utf8x]{inputenc} to come after it, and so with the current template, unicode math won't work.

    Pandoc's current template never uses ucs, and uses unicode-math if xelatex/lualatex is being used.

    I'll see if I can fix up the template to have this work, hopefully for both math and text.

  4. added a commit that references this issue on Dec 7, 2021
    de91f80
  5. t-makaro commented on Jan 26, 2022

    @t-makaro
    Contributor

    I haven't looked at this in a while, but I'm fairly certain that we should be using \usepackage[utf8]{inputenc} and not the utf8x package. They are similar, but utf8x dated. I have been meaning to test it out for a while, but I haven't gotten around to it.

  6. cgevans commented on Jan 26, 2022

    @cgevans
    Contributor

    I think that \usepackage[mathletters]{ucs} needs utf8x specifically, not utf8; utf8x is actually in the ucs package. I think both ucs and utf8x are dated, yes; for pdflatex, the code here uses the alphabeta package, if it is installed, and only uses ucs and utf8x as a fallback if it isn't. For lualatex/xelatex, it uses unicode-math (though Greek text will not work with the default font in those cases; see #1688).

  7. jpgoldberg commented on Jul 21, 2022

    @jpgoldberg

    Somewhere, I have get to find where, the generated LaTeX uses latinmodern fonts. latin modern mono does not include Greek.

    From my xelatex logs:

    Missing character: There is no φ (U+03C6) in font [lmmono10-regular]:!
    

    I have not found out where I can change this. (I can manually edit the generated LaTeX file, but I want to build from a notebook to PDF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions