在编码 T1 中,使用带有 koma 脚本类 \nobreakspace 的 fourierenc 时出错

在编码 T1 中,使用带有 koma 脚本类 \nobreakspace 的 fourierenc 时出错

我使用了此答案中的 4 行代码

章节号和章节标题在一行中

Mathematica 图形

效果很好。我刚刚换了新字体,发现现在出现了奇怪的错误。当我删除新字体包时,错误消失了。这都是用 lualatex 做的。我只用 lualatex。我按照使用字体的说明进行操作 http://www.tug.dk/FontCatalogue/urwschoolbookl/

Mathematica 图形

最后得到了这个 MWE

\documentclass[chapterprefix=false]{scrbook}

\makeatletter
\renewcommand*{\chapterformat}{%
  \mbox{\chapapp~\thechapter\autodot:\enskip}%
}
\makeatother    

\IfFileExists{luatex85.sty}{\usepackage{luatex85}}{}
\usepackage{fontspec}
\usepackage{amssymb}

\usepackage{fouriernc}  %added this per instructions
\usepackage[T1]{fontenc} %added this per instructions

\begin{document}
\chapter{test}
test
\end{document}

已编译

lualatex foo.tex 
This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 restricted system commands enabled.
(./foo.tex
LaTeX2e <2016/03/31> patch level 2
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/scrbook.cls
Document Class: scrbook 2016/06/14 v3.21 KOMA-Script document class (book)
(/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/local/texlive/2016/texmf-dist/scripts/oberdiek/oberdiek.luatex.lua)))
(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
chapter 1.
(/usr/local/texlive/2016/texmf-dist/tex/latex/lm/t1lmss.fd)
...................
! LaTeX Error: Command \nobreakspace unavailable in encoding T1.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.17 \chapter{test}                     
? 

删除这两行后错误消失

 \usepackage{fouriernc}  %added this
 \usepackage[T1]{fontenc} %added this

或者保留上面两行,但删除makeatletter....一些东西。下面这个可以工作:

\documentclass[chapterprefix=false]{scrbook}%ext        
\IfFileExists{luatex85.sty}{\usepackage{luatex85}}{}
\usepackage{fontspec}
\usepackage{amssymb}

\usepackage{fouriernc}  %added this
\usepackage[T1]{fontenc} %added this

\begin{document}
\chapter{test}
test
\end{document}

没有错误。问题是:

\makeatletter
\renewcommand*{\chapterformat}{%
  \mbox{\chapapp~\thechapter\autodot:\enskip}%
}
\makeatother 

在上述情况下没有出现此错误?在 Linux 上使用 TL 2016。以下是文件列表

*File List*
 scrbook.cls    2016/06/14 v3.21 KOMA-Script document class (book)
scrkbase.sty    2016/06/14 v3.21 KOMA-Script package (KOMA-Script-dependent bas
ics and keyval usage)
 scrbase.sty    2016/06/14 v3.21 KOMA-Script package (KOMA-Script-independent b
asics and keyval usage)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
scrlfile.sty    2016/06/14 v3.21 KOMA-Script package (loading files)
tocbasic.sty    2016/06/14 v3.21 KOMA-Script package (handling toc-files)
scrsize11pt.clo    2016/06/14 v3.21 KOMA-Script font size class option (11pt)
typearea.sty    2016/06/14 v3.21 KOMA-Script package (type area)
luatex85.sty    2016/06/15 v1.4 pdftex aliases for luatex
fontspec.sty    2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX
   expl3.sty    2016/05/18 v6512 L3 programming layer (loader) 
expl3-code.tex    2016/05/18 v6512 L3 programming layer 
l3pdfmode.def    2016/03/26 v6465 L3 Experimental driver: PDF mode
  xparse.sty    2016/05/18 v6512 L3 Experimental document command parser
luaotfload.sty    2016/06/16 v2.7 OpenType layout system
fontspec-luatex.sty    2016/02/01 v2.5a Font selection for XeLaTeX and LuaLaTeX

 fontenc.sty
  eu2enc.def    2010/05/27 v0.1h Experimental Unicode font encodings
  eu2lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
xunicode.sty    2011/09/09 v0.981 provides access to latin accents and many oth
er characters in Unicode lower plane
 eu2lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2016/07/10 v1.0t Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  luatex.def    2016/07/11 v0.01f Graphics/Color for luaTeX
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
fontspec.cfg
 amssymb.sty    2013/01/14 v3.01 AMS font symbols
amsfonts.sty    2013/01/14 v3.01 Basic AMSFonts support
fouriernc.sty    2005/12/20 1.0 fouriernc package
 fourier.sty    2005/01/01 1.4 fourier-GUTenberg package
 fontenc.sty
   t1enc.def    2016/06/19 v1.99m Standard LaTeX file
   t1lmr.fd    2009/10/30 v1.6 Font defs for Latin Modern
textcomp.sty    2016/06/19 v1.99m Standard LaTeX package
  ts1enc.def    2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
fourier-orns.sty    2004/01/30 1.1 fourier-ornaments package
 fontenc.sty
   t1enc.def    2016/06/19 v1.99m Standard LaTeX file
   t3cmr.fd    2001/12/31 TIPA font definitions
fmlfncmi.fd    2005/12/20 Fontinst v1.928 font definitions for FML/fncmi.
 fmsfncm.fd    2005/12/20 Fontinst v1.928 font definitions for FMS/fncm.
 fmxfutm.fd    futm-extension
  ts1cmr.fd    2014/09/29 v2.5h Standard LaTeX font definitions
   t1fnc.fd    2005/12/13 scaled font definitions for T1/fnc.
supp-pdf.mkii
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
pdftexcmds.sty    2016/05/21 v0.22 Utility functions of pdfTeX for LuaTeX (HO)
   ifpdf.sty    2016/05/14 v3.1 Provides the ifpdf switch
luatex-loader.sty    2016/05/16 v0.6 Lua module loader (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
  t1lmss.fd    2009/10/30 v1.6 Font defs for Latin Modern
 ***********

附言:我知道\usepackage[T1]{fontenc}不需要新的 lualatex?但说明书上说要添加它。

答案1

我认为没有理由与依赖于传统字体的fontspec一起加载。fouriernc

加载luainputenc应保证与 相同的结果pdflatex

\documentclass[chapterprefix=false]{scrbook}
\usepackage{luatex85}

\usepackage[T1]{fontenc}
\usepackage[utf8]{luainputenc}
\usepackage{fouriernc}

\begin{document}

\chapter{test}

test Münchener-Straße

\end{document}

在此处输入图片描述

如果您的目的是fouriernc在数学中使用,那么您可以使用 TeX Gyre Schola 作为文本字体:

\documentclass[chapterprefix=false]{scrbook}
\usepackage{luatex85}

\usepackage{fouriernc}  % for math
\usepackage[no-math]{fontspec}
\setmainfont{TeX Gyre Schola}[Scale=0.95]

\begin{document}

\chapter{test}

test Münchener-Straße $a+b=\sum_{i=1}^n x_i\sin y$

\end{document}

在此处输入图片描述

当然你也可以使用unicode-math

\documentclass[chapterprefix=false]{scrbook}
\usepackage{luatex85}

\usepackage{unicode-math}
\setmainfont{TeX Gyre Schola}[Scale=0.95]
\setmathfont{TeX Gyre Schola Math}[Scale=0.95]

\begin{document}

\chapter{test}

test Münchener-Straße $a+b=\sum_{i=1}^n x_i\sin y$

\end{document}

在此处输入图片描述

相关内容