使用 ConTeXt subsub 模块时出错

使用 ConTeXt subsub 模块时出错

此示例已在上一个问题中提出 更多章节标题?

\setupcolors[state=start]
\usemodule[subsub]
\setuphead[section][color=red,style=\bfc]
\setuphead[subsection][color=blue,style=\bfb]
\setuphead[subsubsection][style=\bfa]
\setuphead[subsubsubsection][style=bold]
\starttext
\section{first section}
\subsection{a}
\subsubsection{b}
\subsubsubsection{c}
\subsubsubsubsection{d}
\subsubsubsubsubsection{e}
\subsubsubsubsubsubsection{f}
\subsubsubsubsubsubsubsection{g}
\subsubsubsubsubsubsubsubsection{h}
\subsubsubsubsubsubsubsubsubsection{i}
\stoptext

我在 FreeBSD 10.3 上安装了 TeXLive 2016

该命令context yourfile.tex导致错误,我输入 x 来结束该过程。日志文件如下。

如果将 h 和 i 部分注释掉,则不会出现错误。

有人可以解释一下或者给我指明方向吗?

open source     > 1 > 1 > /usr/local/texlive/2016/texmf-dist/tex/context/base/mkiv/cont-yes.mkiv

ConTeXt  ver: 2016.05.17 19:20 MKIV current  fmt: 2016.10.14  int: english/english

system          > 'cont-new.mkiv' loaded
open source     > 2 > 2 > /usr/local/texlive/2016/texmf-dist/tex/context/base/mkiv/cont-new.mkiv
close source    > 2 > 2 > /usr/local/texlive/2016/texmf-dist/tex/context/base/mkiv/cont-new.mkiv
system          > files > jobname 'yourfile', input './yourfile', result 'yourfile'
fonts           > latin modern fonts are not preloaded
languages       > language 'en' is active
open source     > 2 > 3 > /common/mnt/local/sync/ark/01/a8/b2/12/MoreSectionHeadings/0/yourfile.tex
colors          > 'rgb' color space is supported
colors          > 'cmyk' color space is supported
resolvers       > modules > 'subsub' is loaded
open source     > 3 > 4 > /usr/local/texlive/2016/texmf-dist/tex/context/modules/mkiv/m-subsub.mkiv
close source    > 3 > 4 > /usr/local/texlive/2016/texmf-dist/tex/context/modules/mkiv/m-subsub.mkiv
fonts           > preloading latin modern fonts (second stage)
fonts           > 'fallback modern-designsize rm 12pt' is loaded
structure       > sectioning > section @ level 3 : 0.0.1 -> first section
structure       > sectioning > subsection @ level 4 : 0.0.1.1 -> a
structure       > sectioning > subsubsection @ level 5 : 0.0.1.1.1 -> b
structure       > sectioning > subsubsubsection @ level 6 : 0.0.1.1.1.1 -> c
structure       > sectioning > subsubsubsubsection @ level 7 : 0.0.1.1.1.1.1 -> d
structure       > sectioning > subsubsubsubsubsection @ level 8 : 0.0.1.1.1.1.1.1 -> e
structure       > sectioning > subsubsubsubsubsubsection @ level 9 : 0.0.1.1.1.1.1.1.1 -> f
structure       > sectioning > subsubsubsubsubsubsubsection @ level 10 : 0.0.1.1.1.1.1.1.1.1 -> g

tex error       > tex error on line 8 in file /common/mnt/local/sync/ark/01/a8/b2/12/MoreSectionHeadings/0/yourfile.tex: ! Missing number, treated as zero

<to be read again> 
s
<argument> s
 amepage-11
\addaskedblankskip ..._vspacing_temp #1\dimexpr #2
                                                  \relax 
l.8 }

\spac_vspacing_yes_indeed ...ar \clf_vspacing {#1}
                                                  \fi 
\strc_sectioning_handle_page_yes ...entheadlevel ]
                                                  \fi \headparameter \c!befo...
...
l.18 \subsubsubsubsubsubsubsubsection{h}


 1     % https://tex.stackexchange.com/questions/30997/more-section-headings
 2     
 3     \setupcolors[state=start]
 4     \usemodule[subsub]
 5     \setuphead[section][color=red,style=\bfc]
 6     \setuphead[subsection][color=blue,style=\bfb]
 7     \setuphead[subsubsection][style=\bfa]
 8 >>  \setuphead[subsubsubsection][style=bold]
 9     \starttext
10     \section{first section}
11     \subsection{a}
12     \subsubsection{b}
13     \subsubsubsection{c}
14     \subsubsubsubsection{d}
15     \subsubsubsubsubsection{e}
16     \subsubsubsubsubsubsection{f}
17     \subsubsubsubsubsubsubsection{g}
18     \subsubsubsubsubsubsubsubsection{h}


? x

system          > structure > start used structure

used structure  > text: yourfile

system          > structure > stop used structure


system          > files > start used files

used file       >    1: filename=cont-yes.mkiv filetype=tex foundname=/usr/local/texlive/2016/texmf-dist/tex/context/base/mkiv/cont-yes.mkiv usedmethod=database
used file       >    2: filename=publ-imp-default.lua filetype=scripts foundname=/usr/local/texlive/2016/texmf-dist/tex/context/base/mkiv/publ-imp-default.lua usedmethod=database
used file       >    3: filename=cont-new.mkiv filetype=tex foundname=/usr/local/texlive/2016/texmf-dist/tex/context/base/mkiv/cont-new.mkiv usedmethod=database
used file       >    4: filename=lang-us.lua filetype=scripts foundname=/usr/local/texlive/2016/texmf-dist/tex/context/patterns/mkiv/lang-us.lua usedmethod=database
used file       >    5: filename=/common/mnt/local/sync/ark/01/a8/b2/12/MoreSectionHeadings/0/yourfile.tex foundname=/common/mnt/local/sync/ark/01/a8/b2/12/MoreSectionHeadings/0/yourfile.tex usedmethod=direct
used file       >    6: filename=m-subsub.mkiv filetype=tex foundname=/usr/local/texlive/2016/texmf-dist/tex/context/modules/mkiv/m-subsub.mkiv usedmethod=database
used file       >    7: filename=lm.lfg filetype=tex foundname=/usr/local/texlive/2016/texmf-dist/tex/context/fonts/mkiv/lm.lfg usedmethod=database
used file       >    8: filename=lmroman12-regular filetype=otf format=otf foundname=/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman12-regular.otf usedmethod=database
used file       >    9: filename=latinmodern-math.otf filetype=opentypefonts foundname=/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm-math/latinmodern-math.otf usedmethod=database
used file       >   10: filename=lmroman10-bold filetype=otf format=otf foundname=/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman10-bold.otf usedmethod=database
used file       >   11: filename=lmroman12-bold filetype=otf format=otf foundname=/usr/local/texlive/2016/texmf-dist/fonts/opentype/public/lm/lmroman12-bold.otf usedmethod=database

system          > files > stop used files


system          > options > start commandline options

used option     > currentrun="1"
used option     > fulljobname="./yourfile.tex"
used option     > input="./yourfile.tex"
used option     > kindofrun="1"
used option     > maxnofruns="9"
used option     > no-parse-first-line="true"

system          > options > stop commandline options

system          > options > start commandline files

used file       >    1: ./yourfile.tex

system          > options > stop commandline files


mkiv lua stats  > used config file: selfautoparent:/texmfcnf.lua;selfautoparent:/texmf-dist/web2c/texmfcnf.lua
mkiv lua stats  > used cache path: readable: '/usr/local/texlive/2016/texmf-var/luatex-cache/context/a86c089b384a3076dc514ba966a1fac9' | readable+writable: '/home/bob/.texlive2016/texmf-var/luatex-cache/context/a86c089b384a3076dc514ba966a1fac9'
mkiv lua stats  > resource resolver: loadtime 0.089 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 11 found files, scanned paths: <none>
mkiv lua stats  > stored bytecode data: 387 modules (0.312 sec), 82 tables (0.008 sec), 469 chunks (0.320 sec)
mkiv lua stats  > traced context: maxstack: 1175, freed: 0, unreachable: 1175
mkiv lua stats  > cleaned up reserved nodes: 44 nodes, 9 lists of 444
mkiv lua stats  > node memory usage: 72 hlist, 8 vlist, 32 boundary, 1 disc, 16 local_par, 1 dir, 109 glue, 64 penalty, 79 glyph, 355 attribute, 39 glue_spec, 89 attribute_list, 2 temp, 7 if_stack, 16 late_lua
mkiv lua stats  > node list callback tasks: 6 unique task lists, 4 instances (re)created, 104 calls
mkiv lua stats  > used backend: pdf (backend for directly generating pdf output)
mkiv lua stats  > jobdata time: 0.000 seconds saving, 0.001 seconds loading
mkiv lua stats  > callbacks: 253 direct, 334 indirect, 587 total
mkiv lua stats  > randomizer: resumed with value 0.44926483810379
mkiv lua stats  > loaded tex modules: 1 requested, all found (*-subsub)
mkiv lua stats  > loaded patterns: en::2, load time: 0.000
mkiv lua stats  > result saved in file: yourfile.pdf, compresslevel 3, objectcompresslevel 3
mkiv lua stats  > loaded fonts: 4 files: latinmodern-math.otf, lmroman10-bold.otf, lmroman12-bold.otf, lmroman12-regular.otf
mkiv lua stats  > font engine: otf 3.020, afm 1.512, tfm 1.000, 8 instances, 2 shared in backend, 0 common vectors, 2 common hashes, load time 0.182 seconds 
mkiv lua stats  > used platform: freebsd-amd64, type: unix, binary subtree: bin
mkiv lua stats  > luatex banner: this is luatex, version 0.95.0 (tex live 2016)
mkiv lua stats  > control sequences: 44071 of 65536 + 100000
mkiv lua stats  > lua properties: engine: lua, used memory: 76 MB (ctx: 76 MB), hash type: lua, hash chars: min(64,40), symbol mask: utf (τεχ)
mkiv lua stats  > runtime: 4.159 seconds

答案1

ConTeXt\blank[samepage-\currentheadlevel]在每个之后插入一个\sub...section,以防止在节头后出现分页符。默认情况下,\blank[samepage-\num...]仅在 之前定义samepage-10。因此,当您在 级别使用节头时,您会收到未定义的11错误。samepage-11

最简单的解决方案是定义samepage-11。我只是使用类似于samepage-1samepage-10到 的定义spac-ver.mkiv

\dorecurse{10}
  {\normalexpanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr\c_spac_vspacing_special_base+\c_spac_vspacing_special_step*\recurselevel\relax]}}

为了安全起见,我们还将其定义samepage-11samepage-20

\unprotect
\dostepwiserecurse{11}{20}{1}
  {\normalexpanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr\c_spac_vspacing_special_base+\c_spac_vspacing_special_step*\recurselevel\relax]}}
\protect

现在示例可以正常工作了。以下是完整的 MWE:

\setupcolors[state=start]
\usemodule[subsub]

\unprotect
\dostepwiserecurse{11}{20}{1}
  {\normalexpanded{\definevspacing[\v!samepage-\recurselevel][penalty:\the\numexpr\c_spac_vspacing_special_base+\c_spac_vspacing_special_step*\recurselevel\relax]}}
\protect


\setuphead[section][color=red,style=\bfc]
\setuphead[subsection][color=blue,style=\bfb]
\setuphead[subsubsection][style=\bfa]
\setuphead[subsubsubsection][style=bold]
\starttext
\section{first section}
\subsection{a}
\subsubsection{b}
\subsubsubsection{c}
\subsubsubsubsection{d}
\subsubsubsubsubsection{e}
\subsubsubsubsubsubsection{f}
\subsubsubsubsubsubsubsection{g}
\subsubsubsubsubsubsubsubsection{h}
\subsubsubsubsubsubsubsubsubsection{i}
\stoptext

相关内容