我正在尝试使用 XeLaTeX 编译文档。在 TeXstudio 和 TeXworks 中,它都无法生成任何 PDF。我将问题缩小到包含的 s 数量tcolorbox
。如果我删除其中任何一个,它都会再次编译。
由于使用的tcolorbox
s 数量太多(超过一百),我无法重现良好的 MWE。
日志说
Sorry, but xelatex.exe did not succeed. The log file hopefully
contains the information to get MiKTeX going again:
C:\Users\Fabiano\AppData\Local\MiKTeX\miktex\log\xelatex.log
dvipdfmx:fatal: File ended prematurely
No output PDF file written.
然后,在 中xelatex.log
,第一个 FATAL 错误是
2021-09-29 15:19:51,966-0300 FATAL xelatex.core - Too many open files: path="C:\Users\Fabiano\AppData\Local\Programs\MiKTeX\fonts/tfm/public/cm\cmr10.tfm"
2021-09-29 15:19:51,966-0300 FATAL xelatex.core - Function: fdopen
2021-09-29 15:19:51,967-0300 FATAL xelatex.core - Result: 24
那么,对于如何进行有什么建议吗?
编辑
tcolorboxes 使用的代码是
\NewTColorBox{eblock}{O{} m m m}{
enhanced,
breakable = unlimited,
skin = bicolor,
boxrule = 0pt,
fontupper = \sffamily,
fontlower = \sffamily,
fonttitle = \sffamily,
colframe = #2,
coltitle = white,
interior style = {left color=secondtablecolor,right color=white},
colbacklower = white,
left = 2pt,
right = 2pt,
top = 2pt,
bottom = 2pt,
middle = 1pt,
before upper* = {\begin{minipage}{\linewidth}\begin{hangparas}{1em}{1}},
after upper* = {\end{hangparas}\end{minipage}},
segmentation at break = false,
title = {
\SetTblrInner{rowsep=0pt,colsep=0pt}
\begin{tblr}{Xr}
{\bfseries#3} & {\bfseries#4}\\
\end{tblr}
},
sharpish corners,
#1
}
答案1
我发现了这个问题。是 tcolobox 标题中的 tblr 环境导致了打开的文件过多。那个环境的存在本身就是我的 LaTeXing 不好造成的。不要误会我的意思,tabularray 是一个很棒的包,我发现它非常有用,但有炮弹打不中人。
title = {
\SetTblrInner{rowsep=0pt,colsep=0pt}
\begin{tblr}{Xr}
{\bfseries#3} & {\bfseries#4}\\
\end{tblr}
},
很容易被替代
title = {{\bfseries#3} \hfill {\bfseries#4}}
具有相同的效果,且无需打开大量文件。
无论如何,对于那些喜欢调试代码来发现问题的确切性质(超出我自己的能力范围的事情)的人,我让我的系统中有一个序言 MWE 来重现该问题。
\documentclass{book}
\usepackage[tables]{xcolor}
\usepackage{tabularray}
\usepackage[most]{tcolorbox}
\usepackage{hanging}
\definecolor {secondtablecolor} {HTML} {E6E6DC}
\newtcolorbox{eblock}[4][]{
enhanced,
breakable,
skin = bicolor,
boxrule = 0pt,
fontupper = \sffamily,
fontlower = \sffamily,
fonttitle = \sffamily,
colframe = #2,
coltitle = white,
interior style = {left color=secondtablecolor,right color=white},
colbacklower = white,
left = 2pt,
right = 2pt,
top = 2pt,
bottom = 2pt,
middle = 1pt,
before upper* = {\begin{minipage}{\linewidth}\begin{hangparas}{1em}{1}},
after upper* = {\end{hangparas}\end{minipage}},
segmentation at break = false,
title = {
\SetTblrInner{rowsep=0pt,colsep=0pt}
\begin{tblr}{Xr}
{\bfseries#3} & {\bfseries#4}\\
\end{tblr}
},
sharpish corners,
#1
}
\begin{document}
% Really lots of tcolorboxes like the below to reproduce the issue.
\begin{eblock}{green}{Test}{Test}
Test
\tcblower
Test
\end{eblock}
\end{document}