1

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.

SLEN template

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

I was trying to compile this article via LuaLaTeX

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

Moriambar
  • 11,466
Popopo
  • 831
  • You can't use polyglossia with LuaLaTeX – egreg Mar 01 '13 at 16:18
  • @DavidCarlisle I have updated my post. – Popopo Mar 01 '13 at 16:21
  • 2
  • 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 01 '13 at 16:27
  • I don't think this can work with LuaLaTeX at all. It's probably easier to use less math alphabets; but without a sample of what you're trying to achieve, it's difficult to say more. – egreg Mar 01 '13 at 16:29
  • @Mico .rar is a kind of zip file, like .tar in Unix. Btw, I have posted the .sty file in my post. – Popopo Mar 01 '13 at 16:46
  • @egreg I have asked this question indeed, but sadly it was closed... – Popopo Mar 01 '13 at 16:53
  • @Popopo That question is too generic to be answered; it has unknown packages (fitch, mathhero) and many that are clearly unrelated to the problem. It's unknown what you use dsfont for (a candidate for being transformed in a "non math alphabet"). Too generic = not answerable. – egreg Mar 01 '13 at 16:58
  • You need to provide a minimal(!) working example, not a random collection of things from your preamble: see here or here. – jon Mar 01 '13 at 17:04
  • @jon Okay, I did it. – Popopo Mar 01 '13 at 17:17
  • After creating the files slen.sty and slen.tex with the inputs you've provided, I get an error message when trying to compile the .tex file under XeLaTeX as well. Specifically: ! LaTeX Error: Missing \begin{document} right after the sectsty package is loaded. Thus, the compilation problem doesn't seem to be limited to LuaLaTeX. – Mico Mar 01 '13 at 17:33
  • @Mico Honestly I haven't met this problem in MiKTeX. Besides, it seems some small errors can be skipped, and we can finally get a pdf file. However the error in process of compilation via LuaLaTeX is fatal hence cannot even yield a pdf file. – Popopo Mar 01 '13 at 17:40
  • 1
    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 01 '13 at 20:18
  • @jon Do you mean I can delete those two lines "\newtheoremstyle{mythm}{2ex}{2ex}{}{}{\bfseries}{}{1em}{} \theoremstyle{mythm}", and replace \bf to \textbf? – Popopo Mar 02 '13 at 03:16
  • 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. – Alan Munn Mar 02 '13 at 03:47
  • @AlanMunn You're right. Hence it seems I have to reduce fonts used. – Popopo Mar 02 '13 at 05:02
  • These two lines: \newtheorem{definition}{{\bf{Definition}}} and \newtheorem*{definition*}{{\bf{Definition}}}. Change the \bf to \textbf. – jon Mar 02 '13 at 19:38
  • That's not a XeLaTeX template (as there is nothing specific to XeLaTeX in it), but a pdflatex template. And a bad one, too. – Martin Schröder Mar 05 '13 at 14:44

1 Answers1

6

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
Alan Munn
  • 218,180