Skip to content

Instantly share code, notes, and snippets.

@pydanny
Created March 17, 2017 17:19
Show Gist options
  • Save pydanny/d6a33e2d51384da36b43f8b44d8fc316 to your computer and use it in GitHub Desktop.
Save pydanny/d6a33e2d51384da36b43f8b44d8fc316 to your computer and use it in GitHub Desktop.
% Our tocloft configuration
\usepackage{tocloft}
\newlength{\mylen} %% extra space
\setlength{\mylen}{.2cm}
\addtolength{\cftsecnumwidth}{\mylen} % add the extra space after section numbers
\addtolength{\cftsubsecnumwidth}{\mylen} % add the extra space after subsection numbers
% How we load fontspec
\usepackage{fontspec}
% A sample TOC header
\chapter*{Authors' Notes}
\addcontentsline{toc}{chapter}{Authors' Notes}
% The error we get
xelatex -shell-escape screen.tex
This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex)
\write18 enabled.
entering extended mode
(./screen.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 22 language(s) loaded.
(./main.tex (/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/book.cls
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/bk10.clo))
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/listings/listings.sty
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/listings/lstmisc.sty)
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/listings/listings.cfg))
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def))
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
)
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
*************************************************
* fontspec warning: "tu-clash"
*
* I have found the tuenc.def encoding definition file but the TU encoding is
* not defined by the LaTeX2e kernel; attempting to correct but you really
* should update to the latest version of LaTeX2e.
*************************************************
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/tuenc.def
! Missing \endcsname inserted.
<to be read again>
\def
l.252 ... \UnicodeEncodingName {}{"007E}
?
@pydanny
Copy link
Author

pydanny commented Mar 17, 2017

Thought: My LaTeX2e is 2016/03/31 but I heard the latest is 2017/01/01. Yet just two days ago I installed the latest texlive from https://www.tug.org/texlive.

@clayball
Copy link

I got this to generate a PDF for me by adding the following..

\documentclass[]{book}
\begin{document}
\end{document}

Full tex file...

\documentclass[]{book}

\usepackage{tocloft}

\newlength{\mylen} %% extra space
\setlength{\mylen}{.2cm}
\addtolength{\cftsecnumwidth}{\mylen} % add the extra space after section numbers
\addtolength{\cftsubsecnumwidth}{\mylen} % add the extra space after subsection numbers

% How we load fontspec

\usepackage{fontspec}

\begin{document}

% A sample TOC header

\chapter*{Authors' Notes}
\addcontentsline{toc}{chapter}{Authors' Notes}

\end{document}

@clayball
Copy link

output from the command...

$ xelatex -shell-escape texhelp.tex
This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex)
\write18 enabled.
entering extended mode
(./texhelp.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 3 language(s) loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/book.cls
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/bk10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/tocloft/tocloft.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex)
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def))
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty)
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1lmr.fd))
(/usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty
(/usr/share/texlive/texmf-dist/tex/latex/tipa/t3enc.def
(/usr/share/texlive/texmf-dist/tex/latex/euenc/eu1lmss.fd))
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/xelatex/xetex-def/xetex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))))
(/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(./texhelp.aux) (/usr/share/texlive/texmf-dist/tex/latex/tipa/t3cmr.fd)
[1] (./texhelp.aux) )
Output written on texhelp.pdf (1 page).
Transcript written on texhelp.log.

@pydanny
Copy link
Author

pydanny commented Mar 17, 2017

@clayball, when I try the same thing I don't generate a PDF. The log report is:

This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex 2017.3.15)  17 MAR 2017 11:18
entering extended mode
 \write18 enabled.
 %&-line parsing enabled.
**mini.tex
(./mini.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 22 language(s) loaded.
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/book.cls
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016basic/texmf-dist/tex/latex/base/bk10.clo
File: bk10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@chapter=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (./mini.aux)
\openout1 = `mini.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
(./mini.aux) ) 
Here is how much of TeX's memory you used:
 219 strings out of 495086
 2271 string characters out of 6174758
 49147 words of memory out of 5000000
 3629 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 319 hyphenation exceptions out of 8191
 23i,1n,17p,126b,36s stack positions out of 5000i,500n,10000p,200000b,80000s

No pages of output.

@pydanny
Copy link
Author

pydanny commented Mar 17, 2017

Okay, at http://tex.stackexchange.com/questions/358996/fontspec-warning-tu-clash I found that I needed to run sudo fmtutil-sys --all. That resolved the fontspec clash, but I have a new error:

kpathsea:make_tex: Invalid fontname `[fonts/PTSansNarrow-Regular.ttf.ttf]/OT', contains '['

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
! 
! The font "PTSansNarrow-Regular.ttf" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  
                                                  
l.30 {PTSansNarrow.ttf}

For reference, PTSansNarrow-Regular.ttf is very much in my fonts directory. 😢

@clayball
Copy link

@pydanny hmm.. have you tried this using TeXMaker? The log/error output is generally informative and helpful.
The build options for XeLaTeX work for me. As does the quick build for DVI->PS.
Modifying the options via Option=>Configure Texmaker=>(Commands and Quick Build) may prove useful.
Wish I could be more helpful.

@pydanny
Copy link
Author

pydanny commented Mar 17, 2017

@clayball, I'll give TeXMaker a try!

@mpacer
Copy link

mpacer commented Mar 17, 2017

I think it is adding an extension for you: note PTSansNarrow-Regular.ttf.ttf is what it was searching for.

What is your current font declaration?

@clayball
Copy link

@pydanny, best of luck with everything!

@mpacer
Copy link

mpacer commented Mar 17, 2017

Also, I should mention that I cannot reproduce the initial error. My guess is it's related to your current font declaration.

Strangely when I look at the PT Sans Narrow font on my comp, it comes in a .ttc font collection rather than an individual file. Had you generated them manually?

@pydanny
Copy link
Author

pydanny commented Mar 17, 2017

@mpacer, the font declaration causing the problem is:

\setsansfont [Path = fonts/,
    UprightFont = PTSansNarrow-Regular.ttf,
    BoldFont = OpenSans-Bold.ttf,
    ItalicFont = AvenirNextCondensed-Italic.ttf
 ]
{PTSansNarrow.ttf}

The font is stored in a fonts directory. It's also in my Mac's fontbook utility. Not sure if there's a conflict.

However, what've discovered though is that when I comment out this command, the book compiles without a problem. In the rendered book's section on typographical conventions, everything looks fine. HOORAY!

So I think the problem is resolved. However, since the book is 527 pages, it might be a while before we discover any problems.

@mpacer
Copy link

mpacer commented Mar 17, 2017

Does get you a functional font declaration? My guess is that if you don't pass an explicit Extension parameter it defaults to Extension = .ttf which seems backwards for xelatex given it's otf support, but 🤷‍♀️.

\setsansfont [Path = fonts/,
Extension = .ttf,
UprightFont = PTSansNarrow-Regular,
BoldFont = OpenSans-Bold,
ItalicFont = AvenirNextCondensed-Italic
]
{PTSansNarrow}

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