如何将 XeLaTeX 模板转换为 LuaLaTeX?

如何将 XeLaTeX 模板转换为 LuaLaTeX?

我的文章使用了只能被 XeLaTeX 接受的模板。现在我想将其转换为 LuaLaTeX。该怎么做?

特别是对于这个模板。

SLEN 模板

\usepackage{ctex}
\usepackage{amsmath,amssymb,amsfonts,amsthm,fancyhdr}                    
\usepackage[numbers,sort&compress]{natbib}                               
\usepackage{url}                                                          
\usepackage{ifthen}                                                      

\usepackage{times}                                                        
\usepackage{ifpdf}                                                        


\usepackage[total={130mm,203mm}, top=28.3mm, headheight=20pt, headsep=4truemm,bindingoffset=1.5cm]{geometry}
\renewcommand{\baselinestretch}{1.04}                                    
\parindent 21pt

\makeatletter
\def\@maketitle{%
 \newpage
  \null
  \vskip 0em%
 \begin{center}%
 \let \footnote \thanks
   {\LARGE \@title \par}%
   \vskip 1.5em%
   {\large
     \lineskip .5em%
     \begin{tabular}[t]{c}%
       \@author
     \end{tabular}\par}%
   \vskip 1em%
   {\large \@date}%
 \end{center}%
 \par
 \vskip 1.5em}
\makeatother


\usepackage{sectsty}
\sectionfont{\large}
\subsectionfont{\normalsize}




\newtheoremstyle{mythm}{2ex}{2ex}{}{}{\bfseries}{}{1em}{}
\theoremstyle{mythm}

\newtheorem{definition}{{\bf{Definition}}}
\newtheorem*{definition*}{{\bf{Definition}}}


\makeatletter
\renewenvironment{proof}[1][Proof]{\par
    \pushQED{\hfill$\square$}%
    \normalfont \topsep6\p@\@plus6\p@ \labelsep1em\relax
    \trivlist
    \item[\hskip\labelsep\bfseries #1]\ignorespaces
}{%
    \popQED\endtrivlist\@endpefalse
} \makeatother


\newcommand{\mypiia}{%                                                    
    \ifthenelse{\myfirstpage < 10}{000\myfirstpage}{%                    
        \ifthenelse{\myfirstpage < 100}{00\myfirstpage}{%                 
            \ifthenelse{\myfirstpage < 1000}{0\myfirstpage}{%             
            \myfirstpage}%                                                
        }%
    }%
}

\newcommand{\mypiib}{%                                                    
    \ifthenelse{\mypages < 10}{0\mypages}{\mypages}                       
}

\newcommand{\mypii}{PII: 1674-3202(\mypubyear)-0%                         %
    \myissnumber-\mypiia-\mypiib}

\newcommand{\myauthors}{%
    \ifthenelse{\equal{\mysecondauthor}{null}
    \and \equal{\mythirdauthor}{null}}{\myfirstauthor}{%
        \ifthenelse{\equal{\mythirdauthor}{null}}
        {\myfirstauthor, \mysecondauthor}{%
        \myfirstauthor, \mysecondauthor, \mythirdauthor
        }
    }
}

\newcommand{\myoneauthors}{\author{\myfirstauthor\\                     
    \myfirstaffiliation \\ \myfirstemail}}

\newcommand{\mytwoauthors}{\author{\myfirstauthor\\                       
    \myfirstaffiliation \\ \myfirstemail
    \and \mysecondauthor \\ \mysecondaffiliation \\
    \small \mysecondemail}%
}%

\newcommand{\mythreeauthors}{\author{\myfirstauthor\\                     
    \myfirstaffiliation \\ \myfirstemail
    \and \mysecondauthor \\ \mysecondaffiliation \\
    \mysecondemail
    \and \mythirdauthor \\ \mythirdaffiliation \\
    \mythirdemail}%
}%

\newcommand{\authors}{%
    \ifthenelse{\equal{\mysecondauthor}{null}}{\myoneauthors}{%           
        \ifthenelse{\equal{\mythirdauthor}{null}}{\mytwoauthors}{%        
           \mythreeauthors
        }                                                                
    }
}

\newcommand{\mylhead}{Studies in Logic, Vol.~\myvolnumber,
No.~\myissnumber~(\mypubyear):~\myfirstpage--\mylastpage \\\mypii}

\newcommand{\myfancyheadCO}{\myauthors~/ \myrunningtitle}

\newcommand{\myfancyheadCE}{Studies in Logic, Vol.~\myvolnumber,
    No.~\myissnumber~(\mypubyear)}

\newcommand{\mytitlepage}{%
    \setcounter{page}{\myfirstpage}                                       
    \fancypagestyle{plain}{\fancyhf{}
      \lhead{\zihao{6}\mylhead}                                          
      \rhead{}                                                            
      \lfoot{}                                                            
      \cfoot{}                                                            
      \rfoot{}                                                            
      \renewcommand{\headrulewidth}{0pt}
    }
}


\pagestyle{fancy} \fancyhf{}
\fancyhead[CE]{\zihao{6}\myfancyheadCE}                                   
\fancyhead[LE,RO]{\zihao{-5}\thepage}                                     
\fancyhead[CO]{\zihao{6}\myfancyheadCO}                                   
\fancyhead[LO]{} \fancyhead[RE]{} \lfoot{} \cfoot{} \rfoot{}             
\renewcommand{\headrulewidth}{0.4pt}

\title{%
    \ifthenelse{\equal{\mythanks}{null}}{\mytitle}{%
    \mytitle\thanks{\mythanks}}
}


\newcommand{\originaltitlepage}{%
    \mytitlepage
        \authors
    \date{}                                                               
    \maketitle                                                            
    \vspace{-4ex}                                                         
    \begin{center}                                                        
    \begin{minipage}[c]{12cm}
        \zihao{-5} \noindent\textbf{Abstract.}\quad\myabstract
    \end{minipage}
    \end{center}
}


\newcommand{\reviewtitlepage}{%
  \mytitlepage
  \author{}
  \date{}
  \maketitle
  \vspace*{-8ex}
  \zihao{5}
  \noindent\reviewbooktitle
  \ifthenelse{\equal{\reviewbooktitleEN}{null}}{}{\\ \reviewbooktitleEN}
  \vspace*{2ex}
}


\newcommand{\reporttitlepage}{%
  \mytitlepage
  \author{}
  \date{}
  \maketitle
  \vspace*{-8ex}
}


    \newcommand{\printtitlepage}{%
    \ifthenelse{\equal{\myarticletype}{original}}{\originaltitlepage}{%
        \ifthenelse{\equal{\myarticletype}{bookreview}}{\reviewtitlepage}{%
            \reporttitlepage
        }
    }
}



\newcommand{\myoneauthorsCN}{{\kaishu \large{\myfirstauthorCN}}\\         
    \myfirstaffiliationCN \\ \myfirstemail}

\newcommand{\mytwoauthorsCN}{{\kaishu \large{\myfirstauthorCN}}\\        
    \myfirstaffiliationCN \\ \myfirstemail \\
    {\kaishu \large{\mysecondauthorCN}} \\ \mysecondaffiliationCN \\
    \mysecondemail}

\newcommand{\mythreeauthorsCN}{{\kaishu \large{\myfirstauthorCN}}\\       
    \myfirstaffiliationCN \\ \myfirstemail \\
    {\kaishu \large{\mysecondauthorCN}} \\ \mysecondaffiliationCN \\
    \mysecondemail \\
    {\kaishu \large{\mythirdauthorCN}} \\ \mythirdaffiliationCN \\
    \mythirdemail}

\newcommand{\printtitlepageCN}{%
\vspace*{0.5mm}
\begin{center}
    \renewcommand{\baselinestretch}{1.3}                             
    \zihao{3}\mytitleCN\\[4mm]
    \ifthenelse{\equal{\mysecondauthorCN}{null}}{\myoneauthorsCN}{    
        \ifthenelse{\equal{\mythirdauthorCN}{null}}{\mytwoauthorsCN}{ 
            \mythreeauthorsCN
        }                                                            
    }
    \\[4mm]
    \end{center}
    \renewcommand{\baselinestretch}{1.3}                                 
    \zihao{5} \hspace*{\parindent} \myabstractCN
    }



\usepackage{enumitem}
\setenumerate{itemsep=0pt,partopsep=0pt,parsep=\parskip,topsep=5pt}
\setitemize{itemsep=0pt,partopsep=0pt,parsep=\parskip,topsep=5pt}
\setdescription{itemsep=0pt,partopsep=0pt,parsep=\parskip,topsep=5pt}

我试图通过 LuaLaTeX 编写这篇文章

\documentclass[b5paper,11pt,onecolumn,twoside,UTF8]{article}

\usepackage{SLEN}  

\begin{document}
  Hello World!
\end{document}

但发生了致命的崩溃:

This is LuaTeX, Version beta-0.70.2-2012060719 (MiKTeX 2.9 64-bit) 

...
(D:/CTEX/MiKTeX/tex/generic/oberdiek/ifpdf.sty){C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}{D:/CTEX/MiKTeX/fonts/sfd/ttf2pk/UGBK.sfd}{D:/CTEX/MiKTeX/fonts/sfd/ttf2pk/Unicode.sfd
!LuaTeX error (file D:/CTEX/MiKTeX/fonts/sfd/ttf2pk/Unicode.sfd): invalid range
:
_0xFFFF

 ==> Fatal error occurred, no output PDF file produced!

LuaLaTeX failed to create a pdf file.
For possible explanations start the command from the Command Prompt...

我想要做的是让它能够被LuaLaTeX编译。

答案1

您无法将此模板转换为 LuaLateX。SLEN 包会加载ctex检查 XeLaTeX 的包,然后加载xeCJK仅与 XeLaTeX 兼容的包。当它找不到 XeLaTeX 时,它会加载CJK与 LuaLaTeX 不兼容的包,这就是您收到错误的原因。

以下最小文档复制了该问题(使用 LuaLaTeX 编译时出现错误;除非安装了 simkai.ttf 字体,否则这个特定的最小示例也无法使用 XeLaTeX 编译。)

% !TEX TS-program = LuaLaTeX

\documentclass{article}
\usepackage{ctex}
\begin{document}
\end{document}

!LuaTeX error (file /usr/local/texlive/2012/texmf-dist/fonts/sfd/ttf2pk/Unicode
.sfd): invalid token:
FF00_0x10FFFF

相关内容