Closed liuxinyu95 closed 1 year ago
Created two new branches (luatex
and macosx
), and cleaned the legacy ones (zh-cn
, jvm
, and fix-linux-bb
).
After adding another 4 answers, the XeLaTex also broke with OOM issue in Mac OS X.
Switched to LuaTex.
-shell-escape
to detect Mac OS X vs. Linux, but it needn't this option to detect Windows. I changed the way to make (default) font selection based in \IfFontExitsTF
(provided in fontspec). Assume STSong
is the default font in Mac OS X, and Noto CJK is needed in Linux.~/.local/share/fonts
(the default user level font folder), then force refresh fc-cache -f -v
;\NeedsTeXFormat{LaTeX2e}
is needed, or the LuaTeX build fail.I finally solved the build-broken issue by switching to LuaLaTeX. The last issue was with luatexja-fontspec
pkg. It works well in Mac OS X, but cause the following error in Linux:
! Undefined control sequence.
\try@load@fontshape ...sname \relax \ltj@@is@kenc
{\f@encoding }\ifin@ \else...
I found PDF in CN/EN can be build successfully after exclude the luatexja-fontspec
pkg. I also found the unplugged project has the same issue about OS detection/font settings.
As the next step. I'll (1) try the svg
pkg to bring high resolution figure effect; (2) set Noto CJK as the preferred font for all OS platforms.
The CN font doesn't look as well as the one in unplugged project.
Track the CN font quality issue, and vector based figure quality improvement separately.
Summary
On 4/25/2023, we experienced a build break for the PDF book for 3 days. The root cause was because the delayed answers to the exercise exceeded the memory limitation (5M) of XeLaTex in Linux platform. I turned on the option to delay populating answers at the end of the book, LaTex had to cache the answers in memory unless meet a
shipoutAnswer
command. As I added more answers, the cached content finally could not be held in memory any more (with total 14 chapters, a preface, and 2 appendices). As the mitigation, I temporarily distributed the answers as the last section of each chapter (forceshipoutAnswer
in every chapter). This prevented memory bloating, but the reading experience is supplement to have all answers together after the main content. I am working on a long-term solution to this issue.Timeline
prelude.stl
:In
Makefile
:xeCJK
pkg can't work with LuaLaTex. I need a quick mitigation.fix-linux-bb
branch, tried to reproduce the issue.exercise
pkg doc, I found this:shipoutAnswer
in chapter 13, build pass.Future Solution
Given it's my plan to add more and more exercise/answers. Current 'delayed answer' approach is not scale with any fixed memory settings. If we want to achieve the good reader experience of continued main content, the long-term solution is to switch to LuaLaTex. However, this need careful changes, because:
xeCJK
, but the community decided not to port CJK to LuaLaTex, but adopted luatexja, see this.I am going to take stepped approach to iteratively make this change:
LuaTex
branch to separate this migration from XeTeX to LuaTeX (will clean up some legacy branches);MacOSX
branch to go on adding answers to chapter 14, As the memory quota in Mac is still enough. With this branch, I can complete the book as soon as possible;algoxy
) with the above two.Besides, I'll also explore better solution to secure figure quality (may be SVG is better than PNG) with reasonable size overhead.
-- Xinyu