ElegantLaTeX/ElegantBook

Enhancement: lualatex compatibility

Firestar-Reimu opened this issue · 1 comments

If there is anyone who want to compile in lualatex please see this issue

99% of ElegantLaTeX can be moved from xelatex to lualatex, but:

Elegantbook:

  \ifdefstring{\ELEGANT@chinesefont}{nofont}{
    \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex}
    \xeCJKsetup{AutoFakeBold=true}
    }{\relax}

  \ifdefstring{\ELEGANT@chinesefont}{ctexfont}{
    \RequirePackage[UTF8,scheme=plain]{ctex}
    \xeCJKsetup{AutoFakeBold=true}
    }{\relax}

one solution is to remove the autofakebold function

another solution is:

  \ifdefstring{\ELEGANT@chinesefont}{nofont}{
    \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex}
    \RequirePackage{iftex}
    \ifxetex
      \xeCJKsetup{AutoFakeBold=true}
    \else
    \fi
    \ifluatex
      \defaultfontfeatures{AutoFakeBold=4}
    \else
    \fi
    }{\relax}

but this will use fake bold if or not there is a default bold fontface or BoldFont is given

ElegantPaper & ElegantNote

when using chinesefont=founder this error will happen on lualatex:

Font \\LTJY3/FZShuSong-Z01(0)/m/n/10=[FZShuSong-Z01.otf]:mode=node;language=dflt;jfm=zh_CN/quanjiao;+tlig;-ss05; at 10pt not loadable: metric data not found or bad.

and I don't know why (and why no such error on ElegantBook).

one solution is to use chinesefont=nofont and \defaultfontfeatures{}:

\documentclass[cn,hazy,blue,14pt,screen,chinesefont=nofont]{elegantnote}
\defaultfontfeatures{} % use this line
\setCJKmainfont[BoldFont={FZHei-B01},ItalicFont={FZKai-Z03}]{FZShuSong-Z01}
\setCJKsansfont[BoldFont={FZHei-B01}]{FZKai-Z03}
\setCJKmonofont[BoldFont={FZHei-B01}]{FZFangSong-Z02}
\setCJKfamilyfont{zhsong}{FZShuSong-Z01}
\setCJKfamilyfont{zhhei}{FZHei-B01}
\setCJKfamilyfont{zhkai}[BoldFont={FZHei-B01}]{FZKai-Z03}
\setCJKfamilyfont{zhfs}[BoldFont={FZHei-B01}]{FZFangSong-Z02}
\newcommand*{\songti}{\CJKfamily{zhsong}}
\newcommand*{\heiti}{\CJKfamily{zhhei}}
\newcommand*{\kaishu}{\CJKfamily{zhkai}}
\newcommand*{\fangsong}{\CJKfamily{zhfs}}

ElegantLaTeX doesn't have a plan to support lualatex. This issue will be closed as "not planned".