我希望 LuaTeX/LaTeX 專家能夠幫助解決我遇到的這個問題。
我有一個在 Debian Bullseye 上運行的 docker 容器,並且我已經安裝了textlive-full
包裹。完整安裝如下:
apt-get update &&
apt-get install -y wget perl-tk fonts-noto-cjk "texlive-full=2020.20210202-3" &&
apt-get clean
.tex 檔如下所示:
\documentclass[a4paper,16pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[margin=0.8in]{geometry}
\usepackage{libertine}
\usepackage{graphicx}
\usepackage{multido}
\usepackage{paracol}
\usepackage{ulem}
\usepackage{color}
\usepackage{soul}
\usepackage{xurl}
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage{tokcycle}
\usepackage{libertine}
\usepackage{enumitem}
\usepackage{tipa}
\hypersetup{pdfauthor={System},
pdfproducer={System},
pdfcreator={System}
}
\newcommand{\cvspace}{\vskip 1.2em}
\overfullrule=0pt
%----------------------------------------------------------------------------------------
% Field COMMAND
%----------------------------------------------------------------------------------------
\newcommand{\field}[2]{
\columnratio{0.20}
\setlength{\columnsep}{3em}
\begin{paracol}{2}
\noindent\hspace{0pt}\textbf{#1} \switchcolumn \noindent{#2}
\end{paracol}
\cvspace
}
%----------------------------------------------------------------------------------------
% Indent Field COMMAND
%----------------------------------------------------------------------------------------
\newcommand{\indentfield}[2]{
\columnratio{0.30}
\setlength{\columnsep}{3em}
\begin{paracol}{2}
\baselineskip=1pt
\hspace{0pt}\textbf{#1} \switchcolumn \noindent{#2}
\end{paracol}
\cvspace
}
%----------------------------------------------------------------------------------------
% Text COMMAND
%----------------------------------------------------------------------------------------
\newcommand{\text}[1]{
\noindent{#1}
\cvspace
}
%----------------------------------------------------------------------------------------
% header
%----------------------------------------------------------------------------------------
%Force new page%
\newcommand{\sectionbreak}{\clearpage}
%----------------------------------------------------------------------------------------
% graphic COMMAND
%----------------------------------------------------------------------------------------
\newcommand{\graphic}[1]{
\begin{center}
\includegraphics[width=0.48\textwidth]{#1}
\end{center}
}
%----------------------------------------------------------------------------------------
% allgraphic COMMAND
%----------------------------------------------------------------------------------------
\newcommand{\allgraphic}[1]{
\begin{center}
\saveimageresource{#1}
\multido{\i=1+1}{\the\lastsavedimageresourcepages}{
\includegraphics[page=\i,width=0.48\textwidth]{#1}
}
\end{center}
}
%----------------------------------------------------------------------------------------
% url
%----------------------------------------------------------------------------------------
\hypersetup{colorlinks=true,urlcolor=blue}
\urlstyle{same}
%----------------------------------------------------------------------------------------
% section end
%----------------------------------------------------------------------------------------
\newcommand{\drawline}{\hrule \cvspace}
%----------------------------------------------------------------------------------------
% New Paragraph
%----------------------------------------------------------------------------------------
\newcommand{\newpara}[0]{\\[3mm]}
%----------------------------------------------------------------------------------------
% Table Headings
%----------------------------------------------------------------------------------------
\newcommand{\tableheadings}[1]{#1 \\}
%----------------------------------------------------------------------------------------
% Table Row
%----------------------------------------------------------------------------------------
\newcommand{\tablerow}[1]{\hline #1 \\}
%----------------------------------------------------------------------------------------
% Support Content Wrapping
%----------------------------------------------------------------------------------------
\newcommand\wraptext[1]{\tokcycle
{\addcytoks{##1\penalty0\hskip0pt plus1pt\relax}}
{\processtoks{##1}}
{\addcytoks{##1}}
{\addcytoks{##1}}
{#1}\the\cytoks}
%----------------------------------------------------------------------------------------
% Support for CJK Languages
%----------------------------------------------------------------------------------------
\directlua {
luaotfload.add_multiscript("cjk", {
Hang = "Noto Serif CJK KR:mode=harf;script=hang;",
Hani = "Noto Serif CJK TC:mode=harf;script=hani;",
Kana = "Noto Serif CJK JP:mode=harf;script=kana;",
Hira = "Noto Serif CJK JP:mode=harf;script=hira;",
})
luaotfload.add_multiscript("cjk_bold", {
Hang = "Noto Serif CJK KR/B:mode=harf;script=hang;",
Hani = "Noto Serif CJK TC/B:mode=harf;script=hani;",
Kana = "Noto Serif CJK JP/B:mode=harf;script=kana;",
Hira = "Noto Serif CJK JP/B:mode=harf;script=hira;",
})
}
\setmainfont[RawFeature={multiscript=cjk},BoldFeatures={RawFeature={multiscript=cjk_bold}}]{Libertinus Serif}
\begin{document}
% Above this line is standard and included in base.tex%s
\title{MainTitle}\author{SubTitle}\date{SubSubTitle}\maketitle
\end{document}
然後,當我嘗試使用以下命令從 tex 檔案生成 PDF 時:
/usr/bin/lualatex -halt-on-error -jobname output -output-format pdf output.tex
我在日誌中收到以下錯誤:
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020/Debian) (format=lualatex 2023.3.10) 10 MAR 2023 12:56
restricted system commands enabled.
**/app/working/latex_abcde12345_64609089851690_4946691330391035353/output.tex
(/app/working/latex_abcde12345_64609089851690_4946691330391035353/output.tex
LaTeX2e <2020-10-01> patch level 4
Lua module: luaotfload 2022-10-03 3.23 Lua based OpenType font support
Lua module: lualibs 2020-12-30 2.73 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2020-12-30 2.73 ConTeXt Lua libraries -- extended c
ollection.
luaotfload | load : FATAL ERROR
luaotfload | load : × Failed to load "fontloader" module "basics-gen".
luaotfload | load : × Error message:
luaotfload | load : × "/etc/texmf/tex/lualatex/luaotfload/luaotfload-init.l
ua:301: system : no writeable cache path, quiting"./etc/texmf/tex/lualatex/luaot
fload/luaotfload-init.lua:301: system : no writeable cache path, quiting
stack traceback:
[C]: in function 'error'
/etc/texmf/tex/lualatex/luaotfload/luaotfload-init.lua:301: in function 'os.exi
t'
/etc/texmf/tex/lualatex/luaotfload/luaotfload.lua:203: in local 'load_fontloade
r_module'
/etc/texmf/tex/lualatex/luaotfload/luaotfload-init.lua:303: in upvalue 'init_ma
in'
/etc/texmf/tex/lualatex/luaotfload/luaotfload-init.lua:590: in function 'luaotf
load-init.lua'
/etc/texmf/tex/lualatex/luaotfload/luaotfload.lua:322: in field 'main'
[\directlua]:1: in main chunk.
<everyjob> ...ring \\def\string \\encodingdefault{OT1}')end }
\let \f@encoding \encoding...
l.1
\documentclass[a4paper,16pt]{article}
Here is how much of LuaTeX's memory you used:
8 strings out of 478824
100000,383344 words of node,token memory allocated
275 words of node memory still in use:
1 hlist, 1 dir, 39 glue_spec nodes
avail lists: 2:12,3:1,4:1
19793 multiletter control sequences out of 65536+600000
22 fonts using 2516239 bytes
5i,0n,1p,114b,15s stack positions out of 5000i,500n,10000p,200000b,200000s
! ==> Fatal error occurred, no output PDF file produced!
我設法讓它工作的唯一方法是安裝install-tl-20200406
以下步驟手動安裝這裡。但是,此安裝過程可能需要很長時間(最多兩個小時),理想情況下,我希望它非常快,在幾分鐘內。
有沒有辦法讓這個模板 .tex 檔案工作,安裝過程更快,並使用 Debian 軟體包使其工作而無需手動安裝?
注意:在進行手動安裝時,我執行了以下操作:
RUN chmod -R +x /install-tl-20200406
RUN echo "I" | /install-tl-20200406/install-tl -repository ftp://tug.org/historic/systems/texlive/2020/tlnet-final
RUN chmod -R +x /usr/local/texlive/2020/bin/
RUN rm -rf /install-tl-20200406
RUN chmod o+w /usr/local/texlive/2020/texmf-var
答案1
經過進一步調查,我能夠解決該問題,這似乎是權限問題。使用 texlive-luatex Debian 軟體包,我需要提供 Docker 使用者權限,之後/var/lib/texmf
它開始工作並且不再出現錯誤。
謝謝@David Carlisle 和@Ulrike Fischer 的關注,這些\usepackage[utf8]{inputenc}
內容\usepackage[T1]{fontenc}
已被刪除。