CTeX-org / zhlipsum

Chinese dummy text
LaTeX Project Public License v1.3c
17 stars 4 forks source link

指定超限的段落数时,出现死循环 #4

Closed muzimuzhi closed 5 years ago

muzimuzhi commented 5 years ago

现象: 如果指定了超过预定义数量的段落数(例如 \zhlipsum[1000]),即使已经是 nonstopmode,编译也会在显示警告 "invalid-range" 后挂住。

例子

\nonstopmode
\documentclass{article}
\usepackage{zhlipsum}
\begin{document}
\zhlipsum[1000]
\end{document}

分析: 问题出在 \zhlipsum_use:nn 的定义部分 https://github.com/stone-zeng/zhlipsum/blob/28e7300dd27d94b89e6c8dbf312165217e18cba9/source/zhlipsum.dtx#L1168-L1188

一种可能的方案: 在 \zhlipsum_use:nn 内部增加 seq 是否为空的判断,为空时跳过 \l_@@_before_tl\l_@@_after_tl 在内的整段输出代码,以和警告 "invalid-range" 的提示信息 "Nothing~ will~ be~ output." 保持一致。详见 https://github.com/muzimuzhi/zhlipsum/commit/ce60f0236e574cc96a14d718c9b7cbc10bb848df

补充信息

muzimuzhi commented 5 years ago