我正在使用 newfile.sty 生成一个文件,然后再次读取它。使用 Koma-Script 时,它自 TeXLive 2020 起停止工作:如果文件在 \chapter 或 \section 等分段命令后包含换行符,则 \readstream 会在换行符后停止读取流:
最小示例:
\documentclass{scrartcl}
\usepackage{newfile}
\begin{document}
\section{Eins}
Writing into a file here:
\newoutputstream{lsg}
\openoutputfile{min.lsg}{lsg}
\addtostream{lsg}{This is before the section \protect\section{Zwei} and this is after it.}
\addtostream{lsg}{This is after a newline in the file.}
\closeoutputstream{lsg}
Reading from file stops at the first newline character that appears after the
sectioning command:
\newinputstream{lsg}%
\openinputfile{min.lsg}{lsg}%
\readstream{lsg}
\end{document}
使用标准 article.cls 它可以按预期工作:
\documentclass{article}
\usepackage{newfile}
\begin{document}
\section{Eins}
Writing into a file here:
\newoutputstream{lsg}
\openoutputfile{min.lsg}{lsg}
\addtostream{lsg}{This is before the section \protect\section{Zwei} and this is after it.}
\addtostream{lsg}{This is after a newline in the file.}
\closeoutputstream{lsg}
Reading from file stops at the first newline character that appears after the
sectioning command:
\newinputstream{lsg}%
\openinputfile{min.lsg}{lsg}%
\readstream{lsg}
\end{document}
日志档案
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020) (format=lualatex 2020.5.18) 21 JUN 2020 13:17
system commands enabled.
file:line:error style messages enabled.
**min.tex
(./min.tex
LaTeX2e <2020-02-02> patch level 5
Lua module: luaotfload-main 2020-02-02 3.12 luaotfload entry point
Lua module: luaotfload-init 2020-02-02 3.12 luaotfload submodule / initializatio
n
Lua module: lualibs 2020-02-02 2.70 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2020-02-02 2.70 ConTeXt Lua libraries -- extended c
ollection.
Lua module: luaotfload-log 2020-02-02 3.12 luaotfload submodule / logging
Lua module: luaotfload-parsers 2020-02-02 3.12 luaotfload submodule / filelist
Lua module: luaotfload-configuration 2020-02-02 3.12 luaotfload submodule / conf
ig file reader
luaotfload | conf : Root cache directory is /Users/xxx/Library/texlive/2020/
texmf-var/luatex-cache/generic-dev/names.
luaotfload | init : Loading fontloader “fontloader-2020-01-26.lua” from kpse
-resolved path “/usr/local/texlive/2020/texmf-dist/tex/luatex/luaotfload/fontl
oader-2020-01-26.lua”.
Lua-only attribute luaotfload@state = 2
Lua-only attribute luaotfload@noligature = 3
Lua-only attribute luaotfload@syllabe = 4
luaotfload | init : Context OpenType loader version “3.11”
Inserting `luaotfload.node_processor' at position 1 in `pre_linebreak_filter'.
Inserting `luaotfload.node_processor' at position 1 in `hpack_filter'.
Lua module: luaotfload-loaders 2020-02-02 3.12 luaotfload submodule / callback h
andling
Inserting `luaotfload.define_font' at position 1 in `define_font'.
Lua module: luaotfload-database 2020-02-02 3.12 luaotfload submodule / database
Lua module: luaotfload-unicode 2020-02-02 3.12 luaotfload submodule / Unicode he
lpers
Lua module: luaotfload-colors 2020-02-02 3.12 luaotfload submodule / color
Lua-only attribute luaotfload_color_attribute = 5
Lua module: luaotfload-resolvers 2020-02-02 3.12 luaotfload submodule / resolver
s
luaotfload | conf : Root cache directory is /Users/xxx/Library/texlive/2020/
texmf-var/luatex-cache/generic-dev/names.
Lua module: luaotfload-features 2020-02-02 3.12 luaotfload submodule / features
Lua module: luaotfload-letterspace 2020-02-02 3.12 luaotfload submodule / color
Lua module: luaotfload-embolden 2020-02-02 3.12 luaotfload submodule / color
Lua module: luaotfload-notdef 2020-02-02 3.12 luaotfload submodule / color
Lua module: luaotfload-harf-define 2020-02-02 3.12 luaotfload submodule / databa
se
Lua module: luaotfload-script 2020-02-02 3.12 luaotfload submodule / Script help
ers
Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_opentype_file'.
Inserting `luaotfload.harf.strip_prefix' at position 1 in `find_truetype_file'.
Lua module: luaotfload-harf-plug 2020-02-02 3.12 luaotfload submodule / database
Inserting `Harf pre_output_filter callback' at position 1 in `pre_output_filter'
.
Inserting `Harf wrapup_run callback' at position 1 in `wrapup_run'.
Inserting `Harf finish_pdffile callback' at position 1 in `finish_pdffile'.
Inserting `Harf glyph_info callback' at position 1 in `glyph_info'.
Lua module: luaotfload-auxiliary 2020-02-02 3.12 luaotfload submodule / auxiliar
y functions
Inserting `luaotfload.aux.set_sscale_dimens' at position 1 in `luaotfload.patch_
font'.
Inserting `luaotfload.aux.set_font_index' at position 2 in `luaotfload.patch_fon
t'.
Inserting `luaotfload.aux.patch_cambria_domh' at position 3 in `luaotfload.patch
_font'.
Inserting `luaotfload.aux.fixup_fontdata' at position 1 in `luaotfload.patch_fon
t_unsafe'.
Inserting `luaotfload.aux.set_capheight' at position 4 in `luaotfload.patch_font
'.
Inserting `luaotfload.aux.set_xheight' at position 5 in `luaotfload.patch_font'.
Lua module: luaotfload-fallback 2020-02-02 3.12 luaotfload submodule / fallback
Lua module: luaotfload-multiscript 2020-02-02 3.12 luaotfload submodule / multis
cript
Lua module: luaotfload-tounicode 2020-02-02 3.12 luaotfload submodule / tounicod
e
Inserting `luaotfload.rewrite_fontname' at position 6 in `luaotfload.patch_font'
. L3 programming layer <2020-03-06>
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2020/01/24 v3.29 KOMA-Script document class (article)
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrkbase.sty
Package: scrkbase 2020/01/24 v3.29 KOMA-Script package (KOMA-Script-dependent ba
sics and keyval usage)
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrbase.sty
Package: scrbase 2020/01/24 v3.29 KOMA-Script package (KOMA-Script-independent b
asics and keyval usage)
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks15
)
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package: scrlfile 2020/01/24 v3.29 KOMA-Script package (loading files)
)))
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/tocbasic.sty
Package: tocbasic 2020/01/24 v3.29 KOMA-Script package (handling toc-files)
\scr@dte@tocline@numberwidth=\skip47
\scr@dte@tocline@numbox=\box45
)
Package tocbasic Info: omitting babel extension for `toc'
(tocbasic) because of feature `nobabel' available
(tocbasic) for `toc' on input line 137.
Class scrartcl Info: File `scrsize11pt.clo' used instead of
(scrartcl) file `scrsize11.clo' to setup font sizes on input line 2212
.
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/scrsize11pt.clo
File: scrsize11pt.clo 2020/01/24 v3.29 KOMA-Script font size class option (11pt)
luaotfload | db : Font names database loaded from /Users/xxx/Library/texlive
/2020/texmf-var/luatex-cache/generic-dev/names/luaotfload-names.luc)
(/usr/local/texlive/2020/texmf-dist/tex/latex/koma-script/typearea.sty
Package: typearea 2020/01/24 v3.29 KOMA-Script package (type area)
\ta@bcor=\skip48
\ta@div=\count163
\ta@hblk=\skip49
\ta@vblk=\skip50
\ta@temp=\skip51
\footheight=\skip52
Package typearea Info: These are the values describing the layout:
(typearea) DIV = 10
(typearea) BCOR = 0.0pt
(typearea) \paperwidth = 597.50793pt
(typearea) \textwidth = 418.25555pt
(typearea) DIV departure = -6%
(typearea) \evensidemargin = 17.3562pt
(typearea) \oddsidemargin = 17.3562pt
(typearea) \paperheight = 845.04694pt
(typearea) \textheight = 595.80026pt
(typearea) \topmargin = -25.16531pt
(typearea) \headheight = 17.0pt
(typearea) \headsep = 20.40001pt
(typearea) \topskip = 11.0pt
(typearea) \footskip = 47.6pt
(typearea) \baselineskip = 13.6pt
(typearea) on input line 1719.
)
\c@part=\count164
\c@section=\count165
\c@subsection=\count166
\c@subsubsection=\count167
\c@paragraph=\count168
\c@subparagraph=\count169
\scr@dte@section@maxnumwidth=\skip53
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\section on input line 4723.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\section on input line 4723.
\scr@dte@part@maxnumwidth=\skip54
Class scrartcl Info: using compatibility default `afterindent=false'
(scrartcl) for `\part on input line 4731.
\scr@dte@subsection@maxnumwidth=\skip55
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\subsection on input line 4741.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\subsection on input line 4741.
\scr@dte@subsubsection@maxnumwidth=\skip56
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\subsubsection on input line 4751.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\subsubsection on input line 4751.
\scr@dte@paragraph@maxnumwidth=\skip57
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\paragraph on input line 4761.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\paragraph on input line 4761.
\scr@dte@subparagraph@maxnumwidth=\skip58
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\subparagraph on input line 4771.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\subparagraph on input line 4771.
\abovecaptionskip=\skip59
\belowcaptionskip=\skip60
\c@pti@nb@sid@b@x=\box46
Package tocbasic Info: omitting babel extension for `lof'
(tocbasic) because of feature `nobabel' available
(tocbasic) for `lof' on input line 6002.
\scr@dte@figure@maxnumwidth=\skip61
\c@figure=\count170
Package tocbasic Info: omitting babel extension for `lot'
(tocbasic) because of feature `nobabel' available
(tocbasic) for `lot' on input line 6014.
\scr@dte@table@maxnumwidth=\skip62
\c@table=\count171
Class scrartcl Info: Redefining `\numberline' on input line 6178.
\bibindent=\dimen134
)
(/usr/local/texlive/2020/texmf-dist/tex/latex/newfile/newfile.sty
Package: newfile 2009/09/03 v1.0c Output and input files
(/usr/local/texlive/2020/texmf-dist/tex/latex/tools/verbatim.sty
Package: verbatim 2019/11/10 v1.5r LaTeX2e package for verbatim enhancements
\every@verbatim=\toks16
\verbatim@line=\toks17
\verbatim@in@stream=\read2
)
\c@streamvline=\count172
)
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def
File: l3backend-pdfmode.def 2020-03-12 L3 backend support: PDF mode
\l__kernel_color_stack_int=\count173
\l__pdf_internal_box=\box47
)
(./min.aux)
\openout1 = min.aux
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 4.
LaTeX Font Info: Trying to load font information for TS1+cmr on input line 4.
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd
File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions
)
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
Package scrbase Info: activating english \contentsname on input line 4.
Package scrbase Info: activating english \listfigurename on input line 4.
Package scrbase Info: activating english \listtablename on input line 4.
\lsgoutstre@m=\write3
\openout3 = min.lsg
\lsginstre@m=\read3
[1
{/usr/local/texlive/2020/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./min.aux))
Here is how much of LuaTeX's memory you used:
3053 strings out of 480992
100000,552014 words of node,token memory allocated
426 words of node memory still in use:
3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 4 attribute, 52 glue_spec,
4 attribute_list, 1 write nodes
avail lists: 2:51,3:14,4:2,5:30,6:5,7:211,9:18,10:1,11:12
20563 multiletter control sequences out of 65536+600000
28 fonts using 3653771 bytes
42i,6n,54p,10121b,248s stack positions out of 5000i,500n,10000p,200000b,100000s
</usr/local/texlive/2020/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.o
tf></usr/local/texlive/2020/texmf-dist/fonts/opentype/public/lm/lmsans10-bold.ot
f>
Output written on min.pdf (1 page, 7613 bytes).
PDF statistics: 22 PDF objects out of 1000 (max. 8388607)
12 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 131072)
1 words of extra memory for PDF output out of 10000 (max. 100000000)
答案1
将 Koma-Script(以及 TeXLive 2020 的其余部分)更新到最新版本 3.30 解决了该问题。