已编辑问题

已编辑问题

已编辑问题

我想用novel安装在我的发行版上的类来编写一个文档。

因为我觉得我无法制作自己的最小工作示例,所以我从官方网站文档我删除了我认为没用的部分:

% !TeX TS-program = LuaLaTeX
% !TeX encoding = UTF-8
\documentclass{novel} % See list of class options; usually none needed.
%%% METADATA (FILE DATA):
\SetTitle{IMPORTANT: Provide Book Title} % Required for PDF/X.
\SetSubtitle{} % Default: empty.
\SetAuthor{} % Default: empty.
\SetApplication{LuaLaTeX with novel and microtype}
\SetProducer{LuaLaTeX with novel-pdfx and hyperref}
\SetPDFX[CGATSTR001]{X-1a:2001}
%%% DIMENSIONS:
\SetTrimSize{5.5in}{8.5in} % Sets width, height of your book.
% Default Media Size equals Trim Size.
% Rarely-used over-ride, except for cover artwork:
% \SetMediaSize[alignment]{width}{height}
% Default margins vary with Trim Size. Defaults for {5.5in}{8.5in}:
\SetMargins{0.5in}{0.5in}{0.5in}{0.75in}
%%% GENERAL FONTS:
% Percent at end of line is necessary, when writing font settings multi-line:
\SetParentFont[%
SmallCapsFeatures={Renderer=Basic},% Effective when small caps requested locally.
Kerning=On, %
Ligatures=TeX, %
]{Libertinus Serif}
% Main text font automatically adds Numbers=OldStyle,Ligatures=Common.
% Default main font size is based on other layout settings.
% Varies from 11pt to 12pt. With all default layouts, value is 11.4pt.
% You may manually choose a different main font size:
% \SetFontSize{length}
% Default lines per page (main textblock) is calculated from other layout settings.
% When using all defaults, the calculated value is 35.
% If used, \SetLinesPerPage manually chooses the value:
% \SetLinesPerPage{integer}
\SetDecoFont{NovelDeco.otf}
\setsansfont{Libertinus Sans}
\setmonofont{Libertinus Mono}
\setmathfont{Libertinus Math} % unicode-math
%%% HEADERS/FOOTERS:
\SetHeadFootStyle{1} % This style has headers only.
\SetHeadJump{1.5}
\SetFootJump{1.5}
\SetLooseHead{50}
\SetEmblems{}{} % Default blanks.
\SetHeadFont[\parentfontfeatures,Letters=SmallCaps,Scale=0.92]{\parentfontname}
\SetPageNumberStyle{\thepage}
\SetVersoHeadText{\theAuthor}
\SetRectoHeadText{\theTitle}
%%% CHAPTERS:
\SetChapterStartStyle{footer} % Equivalent to empty, when style has no footer.
\SetChapterStartHeight{10}
\SetChapterFont[Numbers=Lining,Scale=1.6]{\parentfontname}
\SetSubchFont[Numbers=Lining,Scale=1.2]{\parentfontname}
\SetScenebreakIndent{false}
%%% CUSTOM FONTS:
% \NewFontFamily[]{} % Optional command.
% \NewFontFace[]{} % Optional command.
% \CreateFontFeature{}{} % Optional command.
%%% OTHER:
\setdefaultlanguage[variant=american]{english} % polyglossia
\microtypesetup{config=novel-microtype,stretch=20,shrink=20,final} % microtype

\begin{document}
\clearpage % or \cleartorecto
\end{document} 

现在我遇到的问题是,当我使用 LuaTeX 编译它时,我收到一堆polyglossia错误消息,例如:

! Package polyglossia Error: language * is not loaded. Please load it before us
! Package polyglossia Error: Could not retrieve key frenchspacing for language

以及其他错误消息,例如:

! You can't use `\relax' after \the.

上一个问题答案不明确:

大家好,我是新手,所以请原谅我的问题太愚蠢了。我想用novel安装在我的发行版上的类来编写一个文档。

我的最小样本是:

\documentclass[12pt,letterpaper]{novel}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{polyglossia}
\setdefaultlanguage{•}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\author{}
\begin{document}
Some text
\end{document}

我使用 Texmaker 作为编辑器,当我使用 LuaTex 进行编译时,我收到的第一个错误是

! LaTeX Error: *** this package currently works only with XeTeX ***

但我不知道如何让它与 XeTeX 一起工作,因为如果我用 XeLateX 编译(它们是同一件事吗?),那么我就无法用 LuaTex 编译,并且出现以下错误:

! Class novel Error: Must compile with LuaLaTeX 0.95+.

答案1

您没有显示您的输入或足够的错误消息来进行全面诊断,但您有一个类似的文档

\documentclass{novel}

\usepackage{xeCJK}

\begin{document}

\end{document}

该类novel需要 lualatex 但是该类xeCJK需要 xelatex 因此在所有情况下都会出现错误。

pdflatex 或 xelatex

! Class novel Error: Must compile with LuaLaTeX 0.95+.

See the novel class documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.76 ...uaLaTeX only. No pdfTeX, dvips, or XeTeX.}
                                                  
? 

路拉泰克斯

(/usr/local/texlive/2021/texmf-dist/tex/xelatex/xecjk/xeCJK.sty

! Critical Package xeCJK Error: The xeCJK package requires XeTeX to function.
(xeCJK)                         
(xeCJK)                         You must change your typesetting engine to
(xeCJK)                         "xelatex"
(xeCJK)                         instead of plain "latex" or "pdflatex" or
(xeCJK)                         "lualatex".
(xeCJK)                         Loading xeCJK will abort!

Type <return> to continue.
 ...                                              
                                                  
l.43 ...sg_critical:nn { xeCJK } { Require-XeTeX } }
                                                  
? 

最后一个错误的形式与您显示的不太一样,因此需要 xelatex 的包不适合xeCJK您的情况,但基本问题如图所示。

基本上没有办法解决这个问题,您需要使用与 xelatex 兼容的文档类或使用与 lualatex 兼容的包。


通过在编辑的问题中添加的示例,您可以更轻松地加载xltxtraxunicode轻松删除旧式 xelatex 包。

\documentclass[12pt,letterpaper]{novel}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
% dont use these even with xelatex (and they only work with xelatex) \usepackage{xunicode}\usepackage{xltxtra}
\usepackage{polyglossia}
\setdefaultlanguage{•}
\usepackage{amsmath}
\usepackage{amsfonts}
%\usepackage{amssymb}
% not with novel \usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\author{}
\begin{document}
Some text
\end{document}

相关内容