ConTeXt:项目布局、容量超出

ConTeXt:项目布局、容量超出

我想开始使用上下文来撰写我的论文,但我什至无法使一个简单的项目布局发挥作用:

产品.tex

\environment env
\startproduct product

\component test

\stopproduct

环境变量

\startenvironment env
\usepath[{components}]
\setuphead[color=red]
\stopenvironment

组件/测试.tex

\product product

\startcomponent test
\section{Hello}
this is just a test.
\stopcomponent

当我编译 product.tex 时它说

open source     > 3 > 5 > components/test.tex
open source     > 4 > 6 > product.tex
open source     > 5 > 7 > components/test.tex
open source     > 6 > 8 > product.tex
open source     > 7 > 9 > components/test.tex
open source     > 8 > 10 > product.tex
open source     > 9 > 11 > components/test.tex
open source     > 10 > 12 > product.tex
open source     > 11 > 13 > components/test.tex
open source     > 12 > 14 > product.tex
open source     > 13 > 15 > components/test.tex
open source     > 14 > 16 > product.tex
open source     > 15 > 17 > components/test.tex
open source     > 16 > 18 > product.tex
open source     > 17 > 19 > components/test.tex
open source     > 18 > 20 > product.tex
open source     > 19 > 21 > components/test.tex
open source     > 20 > 22 > product.tex
open source     > 21 > 23 > components/test.tex
open source     > 22 > 24 > product.tex
open source     > 23 > 25 > components/test.tex
open source     > 24 > 26 > product.tex
open source     > 25 > 27 > components/test.tex
open source     > 26 > 28 > product.tex
open source     > 27 > 29 > components/test.tex
open source     > 28 > 30 > product.tex
open source     > 29 > 31 > components/test.tex
open source     > 30 > 32 > product.tex
open source     > 31 > 33 > components/test.tex
open source     > 32 > 34 > product.tex
open source     > 33 > 35 > components/test.tex
open source     > 34 > 36 > product.tex
open source     > 35 > 37 > components/test.tex
open source     > 36 > 38 > product.tex
open source     > 37 > 39 > components/test.tex
open source     > 38 > 40 > product.tex
open source     > 39 > 41 > components/test.tex
open source     > 40 > 42 > product.tex
open source     > 41 > 43 > components/test.tex
open source     > 42 > 44 > product.tex
open source     > 43 > 45 > components/test.tex

tex error       > error on line 5 in file components/test.tex: ! TeX capacity exceeded, sorry [text input levels=127]


\processfilemany #1->\clf_processfilemany {#1}

l.5 }

\m_syst_action_nop #1 ->\clf_useproduct {#1}

l.1 \product product


1     \product product
2     
3     \startcomponent test
4     \section{Hello}
5 >>  this is just a test.
6     \stopcomponent
7 

显然,它陷入了组件和产品相互包含的无限循环中。如果我\product product从组件中取出第一行(),它可以编译正常,但不会加载环境。

我究竟做错了什么?

答案1

我不使用该project-product-component结构,因此我不确定哪个是正确的解决方案。但您有两种可能性:

  1. 更改结构如下:

    Product.tex

    \startproduct *
    \environment env
    
    \component test
    \stopproduct
    

    components/test.tex

    \startcomponent *
    \environment env
    
    This is a test
    \stopcomponent
    
  2. 添加项目文件:

    project.tex

    \startproject project
    \environment env
    \product product
    \stopproject
    

    product.tex

    \startproduct product
    \project project
    \component components/test
    \stopproduct
    

    components/test.tex

    \startcomponent test
    \project project
    
    \section{Hello}
    this is just a test.
    \stopcomponent
    

在这两种情况下,您都只编译product文件或component文件。您从未编译该project文件。

第一种方案比较简单,第二种方案则稍微复杂一些。

OT:请注意,可以使用\startcomponent *等,这样您就不必输入全名component

相关内容