# How to convert a XeLaTeX template to LuaLaTeX? [closed]

My article used a template which can only be accepted by XeLaTeX. Now I want to convert it to LuaLaTeX. How to do this?

Especially for this template.

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

\usepackage{times}
\usepackage{ifpdf}

\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
}
}
}

No.~\myissnumber~(\mypubyear):~\myfirstpage--\mylastpage \\\mypii}

No.~\myissnumber~(\mypubyear)}

\newcommand{\mytitlepage}{%
\setcounter{page}{\myfirstpage}
\fancypagestyle{plain}{\fancyhf{}
\lfoot{}
\cfoot{}
\rfoot{}
}
}

\pagestyle{fancy} \fancyhf{}

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

\newcommand{\originaltitlepage}{%
\mytitlepage
\authors
\date{}
\maketitle
\vspace{-4ex}
\begin{center}
\begin{minipage}[c]{12cm}
\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}


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

\usepackage{SLEN}

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


But got a fatal crash:

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...


What I want to do is to make it can be compiled by LuaLaTeX.

-

## closed as too localized by Martin Schröder, Werner, Kurt, Stefan Kottwitz♦Mar 5 '13 at 15:23

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

You can't use polyglossia with LuaLaTeX –  egreg Mar 1 '13 at 16:18
@DavidCarlisle I have updated my post. –  Popopo Mar 1 '13 at 16:21
This is either too localized or a duplicate of Frequently loaded packages: Differences between XeLaTeX and LuaLaTeX. –  doncherry Mar 1 '13 at 16:26
The link you provide is to a file with extension .rar. I'm not familiar with this file type (probably some kind of archive, right?). Could you post a link to a file with a somewhat more standard file type? –  Mico Mar 1 '13 at 16:27
This is not really a minimal example since there are many commands in the .sty file that are not (yet) defined. You also can't have ........ in the .sty file. I also see no reason why this file needs to be compiled with any specific TeX engine. Note also that \bf commands are deprecated: you are encouraged to use either the \bfseries switch or the \textbf{<text>} commands in your definitions. –  jon Mar 1 '13 at 20:18

You can't convert this template to LuaLateX. The SLEN package loads the ctex package which checks for XeLaTeX and then loads the xeCJK package, which is only compatible with XeLaTeX. When it doesn't find XeLaTeX it loads CJK which is incompatible with LuaLaTeX which is why you get the error you get.

The following minimal document replicates the problem (compile with LuaLaTeX for the error; this particular minimal example will also not compile with XeLaTeX unless you have the simkai.ttf font installed.)

% !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

-