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

add explicit invocation of fontspec and Source Code Pro #537

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

mpacer
Copy link
Member

@mpacer mpacer commented Feb 22, 2017

This makes unicode characters more generally available in plaintext.

It doesn't technically handle #533 (although it does now seem to catch the combining characters), since it doesn't address the monospace font issue.

@Ken-B could you check to see whether you also see the â because that (now) does seem to work locally for me.

@Ken-B
Copy link

Ken-B commented Feb 22, 2017

@michaelpacer I'm not an expert on this, so maybe I did something wrong.

Anyway, here's the output of my testpdf:
in math mode: β̂
in unicode: a=1 â=2 β=3 β̂=4
directly in mathmode: =5
in verbatim block ̂ = 6

In [ ]: # 
a=1
â=2  
=3 
 ̂ = 4

So there is some progress, as unicode in markdown cells now output correctly! :)
Unicode in mathmode is still missing (not so important, I'd say).

However, in verbatim and code cells, the hat now appears, but nothing under it. Strange.

By the way, I installed with pip install -e . but the tests don't pass (see output in this gist). I hope this helps.

@Carreau
Copy link
Member

Carreau commented Feb 22, 2017

Palatino does not seem to be installed on travis.

@mpacer mpacer changed the title add explicit invocation of fontspec and palatino add explicit invocation of fontspec and Source Code Pro Feb 24, 2017
@mpacer
Copy link
Member Author

mpacer commented Feb 24, 2017

@Ken-B So now the markdown stuff probably won't work, but it should work for the monospace font.

The combining character doesn't actually combine, but I don't know how many fonts will be able to support that. Regardless, I figure this is a big enough improvement it's worth including even if its not enough.

For details about what's going on check out: http://tex.stackexchange.com/questions/355081/fonts-using-xetex-why-do-fontspec-and-setmonofont-versus-sourcecodepro-differ/355269?noredirect=1#comment874662_355269

@Ken-B
Copy link

Ken-B commented Feb 24, 2017

I'm now getting these crossed boxes where the β should be, see image below. I guess it indicates a font missing?
I installed again with pip install -e . but should I download some special font or adjust some setting?

nbconvert20170224

@mpacer
Copy link
Member Author

mpacer commented Feb 27, 2017

@Ken-B I'm specifically trying to avoid anyone needing to download a custom font, so no, the more barebones your system the easier it will be for me to ensure that I'm not relying on my local setup to solve these problems.

@Ken-B
Copy link

Ken-B commented Feb 27, 2017

@michaelpacer Ok. I just tested again and got the same output as last time (with the crossed boxes). I'm on osx 10.12.3 by the way.

Let me know what I can do to help.

@mpacer
Copy link
Member Author

mpacer commented Feb 27, 2017

@Ken-B first try a conversion to .tex and then use XeLaTeX directly, I added some debugging statements to the template that should dump information to the .log file; what version of the font is it finding for you?

@mpacer
Copy link
Member Author

mpacer commented Feb 28, 2017

@Ken-B If you run the tests on your end, are they failing?

@mpacer mpacer force-pushed the font_issues branch 2 times, most recently from 5683ba7 to a177dd3 Compare February 28, 2017 07:54
@Ken-B
Copy link

Ken-B commented Feb 28, 2017

Good morning, @michaelpacer ,

With 5f5d297 it errors because it can't find the Tex Gyre Pagella font (full output here)

The latest (a177dd3) gives following output:
nbconvert20170228

So unicode output is back, but still nothing in the code cells.

This is running jupyter-nbconvert --to pdf.
If I first convert to latex and then run xelatex, I get a LaTeX Font warning (log file here).

The nbconvert tests have 3 fails for test_latex and 1 test_pdf. See output here.

I'm impressed with the efforts here, I feel we're getting closer, thanks! :)

@Ken-B
Copy link

Ken-B commented Mar 7, 2017

@michaelpacer , your latest commit 059b0b5 fails locally with output below. Let me know what I can do to help.

(/usr/local/texlive/2015/texmf-dist/tex/latex/unicode-math/unicode-math-table.t
ex)))
kpathsea: Running mktextfm texgyrepagella
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input texgyrepagella
This is METAFONT, Version 2.7182818 (TeX Live 2015) (preloaded base=mf)

kpathsea: Running mktexmf texgyrepagella

! I can't find file `texgyrepagella'.
<*> ...; mag:=1; nonstopmode; input texgyrepagella
                                                  
Please type another input file name
! Emergency stop.
<*> ...; mag:=1; nonstopmode; input texgyrepagella
                                                  
Transcript written on mfput.log.
grep: texgyrepagella.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input texgyrepagella' failed to make texgyrepagella.tfm.
kpathsea: Appending font creation commands to missfont.log.

*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
* 
* OpenType feature 'Numbers=OldStyle,Monospaced' (+tnum) not available for
* font 'SourceCodePro-Regular' with script 'Latin' and language 'Default'.
*************************************************
*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
* 
* OpenType feature 'Numbers=OldStyle,Monospaced' (+tnum) not available for
* font 'SourceCodePro-Regular' with script 'Latin' and language 'Default'.
*************************************************
*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
* 
* OpenType feature 'Numbers=OldStyle,Monospaced' (+tnum) not available for
* font 'SourceCodePro-Bold' with script 'Latin' and language 'Default'.
*************************************************

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "texgyrepagella" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  
                                                  
l.32 ...hsfont(Latin,Greek,Digits){texgyrepagella}
                                                  
? 
! Emergency stop.
!...............................................  
                                                  
l.32 ...hsfont(Latin,Greek,Digits){texgyrepagella}
                                                  
No pages of output.
Transcript written on notebook.log.

@mpacer
Copy link
Member Author

mpacer commented Mar 7, 2017 via email

@Ken-B
Copy link

Ken-B commented Mar 7, 2017

I've added the \usepackage{tgpagella} on line 20 of base.tplx. Also adding \XeTeXtracingfonts gave an error, I guess because it's also used above on line 17.
I have no idea what this all does as I have zero experience with this, but I'm happy to test things out!

Afterwards it threw a different error message (it doesn't seem to write the log anymore).

(/usr/local/texlive/2015/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty)))kpathsea:make_tex: Invalid fontname `TeX Gyre Pagella Math', contains ' '


LaTeX Font Warning: Font shape `EU1/qpl/m/n' undefined
(Font)              using `EU1/lmr/m/n' instead on input line 27.

*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
* 
* OpenType feature 'Numbers=OldStyle,Monospaced' (+tnum) not available for
* font 'SourceCodePro-Regular' with script 'Latin' and language 'Default'.
*************************************************
*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
* 
* OpenType feature 'Numbers=OldStyle,Monospaced' (+tnum) not available for
* font 'SourceCodePro-Regular' with script 'Latin' and language 'Default'.
*************************************************
*************************************************
* fontspec warning: "icu-feature-not-exist-in-font"
* 
* OpenType feature 'Numbers=OldStyle,Monospaced' (+tnum) not available for
* font 'SourceCodePro-Bold' with script 'Latin' and language 'Default'.
*************************************************

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "TeX Gyre Pagella Math" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  
                                                  
l.33 ...Latin,Greek,Digits){TeX Gyre Pagella Math}
                                                  
? 
! Emergency stop.
!...............................................  
                                                  
l.33 ...Latin,Greek,Digits){TeX Gyre Pagella Math}
                                                  
No pages of output.
Transcript written on notebook.log.

@Ken-B
Copy link

Ken-B commented Mar 12, 2017

@michaelpacer anything I can do to help? Does it work for you locally?

@mpacer
Copy link
Member Author

mpacer commented Mar 12, 2017 via email

@mpacer mpacer mentioned this pull request Mar 30, 2017
@Ken-B
Copy link

Ken-B commented Apr 6, 2018

@mpacer There was an informative post on the julia forum on typesetting with unicode for latex that might help with this issue:
https://discourse.julialang.org/t/typesetting-julia-code-in-latex-documents-unicode/10176
Again, happy to test and assist where possible.
Best,
Ken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants