我正在尝试排版一些食谱。我已经尝试过 LaTeX,现在我正在尝试使用 ConTeXt 做同样的事情。我遇到了很多问题。我已经用了两天了,但我不知道编译器告诉我做什么/更改什么/问题是什么。我试着自己弄清楚。我读过几篇与 ConTeXt相关的文档的部分内容context
:cont-eni.pdf
,,,ms-cb-en.pdf
mk.pdf
contextref.pdf
请参阅下面的 MWE。有人能指出问题并建议修复方法/更好的方法吗?
\setuppapersize[A4]
\setupbodyfont[sansserif,9pt]
\language[cz]
\define[3]\Recipe{%
\section[#1]{#2}%
\startcolumns[n=2,rule=on]
#3
\stopcolumns}
\define[1]\Ingredients{%
\subsubject{Ingredience}%
\it
\starttable[|r|l|]
#1
\stoptable}
\long\def\Steps#1{%
\groupedcommand{\subsubject{Příprava}}{}{#1}}
%\showframe
\starttext
\startalignment[center]
\title{Recepty}
\currentdate
\stopalignment
\chapter{Bábovky}
\Recipe{babovka}{Bábovka}{%
\Ingredients{%
\NC 40~dkg \NC polohrubá mouka \NR
\NC 15~dkg \NC cukr \NR
\NC 10~dkg \NC tuk \NR
\NC 1~ks \NC prášek do pečiva
}
\Steps{%
A word word word word. \par Another word word word word word word
word word word word word word word word word word word word word
word word word word word word word word word word word word word
word word word word word word word word. \par Yet another word
word word word word word word word word word word word word word
word word word word word word word word word word word word word
word word word word word word word word word word word word word
word word word word.\par
}
}
Between. Between. Between. Between. Between. Between. Between.
\Recipe{babovka2}{Bábovka}{%
\Steps{%
Word word word word word word word word word word word word word
word word word word word word word word word word word word word
word word word word word word word word word word word word word.}
}
\page
\completecontent
\stoptext
编译日志:
(recepty.context.tex
ConTeXt ver: 2012.05.30 11:26 MKIV fmt: 2012.10.20 int: english/english
system > cont-new.mkiv loaded
(/usr/share/texmf/tex/context/base/cont-new.mkiv
system > beware: some patches loaded from cont-new.mkiv
)
system > no recepty.context.top
fonts > latin modern fonts are not preloaded
languages > language en is active
fonts > preloading latin modern fonts (third stage)
fonts > typescripts > unknown: library 'loc'
{/usr/share/texmf/fonts/map/dvips/lm/lm-math.map}{/usr/share/texmf/fonts/map/dvips/lm/lm-rm.map}{/usr/share/texmf/fonts/map/pdftex/context/mkiv-base.map}
fonts > virtual math > unable to resolve name mapsfromchar
fonts > fallback modern ss 9pt is loaded
structure > sectioning > title @ level 2 : 0.0 -> Recepty
backend > xmp > using file '/usr/share/texmf/tex/context/base/lpdf-pdx.xml'
pages > flushing realpage 1, userpage 1
structure > sectioning > chapter @ level 2 : 0.1 -> Bábovky
structure > sectioning > section @ level 3 : 0.1.1 -> Bábovka
structure > sectioning > subsubject @ level 4 : 0.1.1.0 -> Ingredience
! Misplaced \noalign.
system > tex > error on line 48 in file recepty.context.tex: Misplaced \noalign ...
38 \Steps{%
39 A word word word word. \par Another word word word word word word
40 word word word word word word word word word word word word word
41 word word word word word word word word word word word word word
42 word word word word word word word word. \par Yet another word
43 word word word word word word word word word word word word word
44 word word word word word word word word word word word word word
45 word word word word word word word word word word word word word
46 word word word word.\par
47 }
48 >> }
49
50 Between. Between. Between. Between. Between. Between. Between.
51
52 \Recipe{babovka2}{Bábovka}{%
53 \Steps{%
54 Word word word word word word word word word word word word word
55 word word word word word word word word word word word word word
56 word word word word word word word word word word word word word.}
57 }
58
\tablenoalign ->\noalign
\bgroup \let \noalign \relax \let \tablenoalign \re...
\starttablenoalign ->\tablenoalign
\bgroup
\doinserttabletail ->\starttablenoalign
\global \settrue \preventtablebreak ...
\stoptable ...hucktableautorow \doinserttabletail
\starttablenoalign \global...
<argument> ...R \NC 1~ks \NC prášek do pečiva }
\Steps {A word word word ...
\Recipe ... [#1]{#2}\startcolumns [n=2,rule=on] #3
\stopcolumns
l.48 }
?
! Misplaced \noalign.
system > tex > error on line 48 in file recepty.context.tex: Misplaced \noalign ...
38 \Steps{%
39 A word word word word. \par Another word word word word word word
40 word word word word word word word word word word word word word
41 word word word word word word word word word word word word word
42 word word word word word word word word. \par Yet another word
43 word word word word word word word word word word word word word
44 word word word word word word word word word word word word word
45 word word word word word word word word word word word word word
46 word word word word.\par
47 }
48 >> }
49
50 Between. Between. Between. Between. Between. Between. Between.
51
52 \Recipe{babovka2}{Bábovka}{%
53 \Steps{%
54 Word word word word word word word word word word word word word
55 word word word word word word word word word word word word word
56 word word word word word word word word word word word word word.}
57 }
58
\tablenoalign ->\noalign
\bgroup \let \noalign \relax \let \tablenoalign \re...
\starttablenoalign ->\tablenoalign
\bgroup
\doinserttabletail ...abletail \starttablenoalign
\global \setfalse \prevent...
\stoptable ...hucktableautorow \doinserttabletail
\starttablenoalign \global...
<argument> ...R \NC 1~ks \NC prášek do pečiva }
\Steps {A word word word ...
\Recipe ... [#1]{#2}\startcolumns [n=2,rule=on] #3
\stopcolumns
l.48 }
?
! Misplaced \noalign.
system > tex > error on line 48 in file recepty.context.tex: Misplaced \noalign ...
38 \Steps{%
39 A word word word word. \par Another word word word word word word
40 word word word word word word word word word word word word word
41 word word word word word word word word word word word word word
42 word word word word word word word word. \par Yet another word
43 word word word word word word word word word word word word word
44 word word word word word word word word word word word word word
45 word word word word word word word word word word word word word
46 word word word word.\par
47 }
48 >> }
49
50 Between. Between. Between. Between. Between. Between. Between.
51
52 \Recipe{babovka2}{Bábovka}{%
53 \Steps{%
54 Word word word word word word word word word word word word word
55 word word word word word word word word word word word word word
56 word word word word word word word word word word word word word.}
57 }
58
\tablenoalign ->\noalign
\bgroup \let \noalign \relax \let \tablenoalign \re...
\starttablenoalign ->\tablenoalign
\bgroup
\stoptable ...oinserttabletail \starttablenoalign
\globalletempty \dotablehe...
<argument> ...R \NC 1~ks \NC prášek do pečiva }
\Steps {A word word word ...
\Recipe ... [#1]{#2}\startcolumns [n=2,rule=on] #3
\stopcolumns
l.48 }
?
structure > sectioning > subsubject @ level 4 : 0.1.1.0 -> Příprava
columns > balanced in 7 step(s)
structure > sectioning > section @ level 3 : 0.1.2 -> Bábovka
structure > sectioning > subsubject @ level 4 : 0.1.2.0 -> Příprava
columns > balanced in 1 step(s)
pages > flushing realpage 2, userpage 2
structure > sectioning > title @ level 2 : 0.1 -> \headtext {content}
pages > flushing realpage 3, userpage 3
)</usr/share/texmf/fonts/opentype/public/lm/lmsans9-oblique.otf></usr/share/texmf/fonts/opentype/public/lm/lmsans10-regular.otf></usr/share/texmf/fonts/opentype/public/lm/lmsans9-regular.otf>
system > files > start used files
used files > 1: filename=recepty.context.tex | foundname=recepty.context.tex | usedmethod=direct
used files > 2: filename=cont-new.mkiv | filetype=tex | foundname=/usr/share/texmf/tex/context/base/cont-new.mkiv | usedmethod=database
used files > 3: filename=lang-us.lua | filetype=lua | foundname=/usr/share/texmf/tex/context/patterns/lang-us.lua | usedmethod=database
used files > 4: filename=lm.lfg | filetype=tex | foundname=/usr/share/texmf/tex/context/fonts/lm.lfg | usedmethod=database
used files > 5: filename=lm-math.lfg | filetype=tex | foundname=/usr/share/texmf/tex/context/fonts/lm-math.lfg | usedmethod=database
used files > 6: filename=lm-math.map | filetype=map | format=map | foundname=/usr/share/texmf/fonts/map/dvips/lm/lm-math.map | usedmethod=database
used files > 7: filename=lm-rm.map | filetype=map | format=map | foundname=/usr/share/texmf/fonts/map/dvips/lm/lm-rm.map | usedmethod=database
used files > 8: filename=mkiv-base.map | filetype=map | format=map | foundname=/usr/share/texmf/fonts/map/pdftex/context/mkiv-base.map | usedmethod=database
used files > 9: filename=lmsans9-regular | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmsans9-regular.otf | usedmethod=database
used files > 10: filename=lmroman5-regular.otf | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmroman5-regular.otf | usedmethod=database
used files > 11: filename=rm-lmr5.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/rm-lmr5.tfm | usedmethod=database
used files > 12: filename=lmmi5.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmmi5.tfm | usedmethod=database
used files > 13: filename=lmsy5.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmsy5.tfm | usedmethod=database
used files > 14: filename=lmex10.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmex10.tfm | usedmethod=database
used files > 15: filename=msam5.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam5.tfm | usedmethod=database
used files > 16: filename=msbm5.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm5.tfm | usedmethod=database
used files > 17: filename=stmary10.afm | filetype=afm | format=afm | foundname=/usr/share/texlive/texmf-dist/fonts/afm/public/stmaryrd/stmary10.afm | usedmethod=database
used files > 18: filename=stmary10.pfb | filetype=pfb | format=pfb | foundname=/usr/share/texlive/texmf-dist/fonts/type1/public/stmaryrd/stmary10.pfb | usedmethod=database
used files > 19: filename=lmroman5-bold | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmroman5-bold.otf | usedmethod=database
used files > 20: filename=lmmib5.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmmib5.tfm | usedmethod=database
used files > 21: filename=lmsans8-regular.otf | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmsans8-regular.otf | usedmethod=database
used files > 22: filename=lmmono8-regular.otf | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmmono8-regular.otf | usedmethod=database
used files > 23: filename=eufm5.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/euler/eufm5.tfm | usedmethod=database
used files > 24: filename=lmroman7-regular.otf | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmroman7-regular.otf | usedmethod=database
used files > 25: filename=rm-lmr7.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/rm-lmr7.tfm | usedmethod=database
used files > 26: filename=lmmi7.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmmi7.tfm | usedmethod=database
used files > 27: filename=lmsy7.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmsy7.tfm | usedmethod=database
used files > 28: filename=msam7.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam7.tfm | usedmethod=database
used files > 29: filename=msbm7.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm7.tfm | usedmethod=database
used files > 30: filename=lmroman7-bold.otf | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmroman7-bold.otf | usedmethod=database
used files > 31: filename=lmmib7.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmmib7.tfm | usedmethod=database
used files > 32: filename=eufm7.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/euler/eufm7.tfm | usedmethod=database
used files > 33: filename=eufb7.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/euler/eufb7.tfm | usedmethod=database
used files > 34: filename=lmroman9-regular.otf | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmroman9-regular.otf | usedmethod=database
used files > 35: filename=rm-lmr9.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/rm-lmr9.tfm | usedmethod=database
used files > 36: filename=lmmi9.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmmi9.tfm | usedmethod=database
used files > 37: filename=lmsy9.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmsy9.tfm | usedmethod=database
used files > 38: filename=msam10.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/symbols/msam10.tfm | usedmethod=database
used files > 39: filename=msbm10.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/symbols/msbm10.tfm | usedmethod=database
used files > 40: filename=lmroman9-bold.otf | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmroman9-bold.otf | usedmethod=database
used files > 41: filename=lmmib10.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texmf/fonts/tfm/public/lm/lmmib10.tfm | usedmethod=database
used files > 42: filename=lmsans9-regular.otf | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmsans9-regular.otf | usedmethod=database
used files > 43: filename=lmmono9-regular.otf | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmmono9-regular.otf | usedmethod=database
used files > 44: filename=eufm10.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/euler/eufm10.tfm | usedmethod=database
used files > 45: filename=eufb10.tfm | filetype=tfm | format=tfm | foundname=/usr/share/texlive/texmf-dist/fonts/tfm/public/amsfonts/euler/eufb10.tfm | usedmethod=database
used files > 46: filename=lang-cs.lua | filetype=lua | foundname=/usr/share/texmf/tex/context/patterns/lang-cs.lua | usedmethod=database
used files > 47: filename=lmsans10-regular | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmsans10-regular.otf | usedmethod=database
used files > 48: filename=lpdf-pdx.xml | filetype=tex | foundname=/usr/share/texmf/tex/context/base/lpdf-pdx.xml | usedmethod=database
used files > 49: filename=lmsans9-oblique | filetype=otf | format=otf | foundname=/usr/share/texmf/fonts/opentype/public/lm/lmsans9-oblique.otf | usedmethod=database
system > files > stop used files
system > structure > start used structure
used structure > text: recepty.context
system > structure > stop used structure
mkiv lua stats > used config file - selfautodir:/share/texmf/web2c/texmfcnf.lua
mkiv lua stats > used cache path - readable: '/var/lib/texmf/luatex-cache/context/f919750633122078d706dd10f1cfd39b' (order 1)
mkiv lua stats > used cache path - readable: '/home/wilx/.texmf-var/luatex-cache/context/f919750633122078d706dd10f1cfd39b' (order 2)
mkiv lua stats > used cache path - writable: '/home/wilx/.texmf-var/luatex-cache/context/f919750633122078d706dd10f1cfd39b'
mkiv lua stats > resource resolver - loadtime 0.059 seconds, 3 scans with scantime 0.002 seconds, 20 shared scans, 49 found files, scanned paths: /etc/texmf /home/wilx/.texmf-var /home/wilx/texmf
mkiv lua stats > stored bytecode data - 303 modules, 65 tables, 368 chunks
mkiv lua stats > cleaned up reserved nodes - 39 nodes, 9 lists of 446
mkiv lua stats > node memory usage - 3 glue, 2 penalty, 16 attribute, 50 glue_spec, 4 attribute_list
mkiv lua stats > node list callback tasks - 6 unique task lists, 5 instances (re)created, 506 calls
mkiv lua stats > used backend - pdf (backend for directly generating pdf output)
mkiv lua stats > loaded patterns - cs::16 en::2
mkiv lua stats > jobdata time - 0.000 seconds saving, 0.000 seconds loading
mkiv lua stats > callbacks - 802 direct, 590 indirect, 1392 total
mkiv lua stats > lxml preparation time - 0.000 seconds, 0 nodes, 11 lpath calls, 0 cached calls
mkiv lua stats > result saved in file - recepty.context.pdf
mkiv lua stats > loaded fonts - 37 files: stmary10.afm eufb10.tfm eufb7.tfm eufm10.tfm eufm5.tfm eufm7.tfm msam10.tfm msam5.tfm msam7.tfm msbm10.tfm msbm5.tfm msbm7.tfm lmmono8-regular.otf lmmono9-regular.otf lmroman5-bold.otf lmroman5-regular.otf lmroman7-bold.otf lmroman7-regular.otf lmroman9-bold.otf lmroman9-regular.otf lmsans10-regular.otf lmsans8-regular.otf lmsans9-oblique.otf lmsans9-regular.otf lmex10.tfm lmmi5.tfm lmmi7.tfm lmmi9.tfm lmmib10.tfm lmmib5.tfm lmmib7.tfm lmsy5.tfm lmsy7.tfm lmsy9.tfm rm-lmr5.tfm rm-lmr7.tfm rm-lmr9.tfm
mkiv lua stats > fonts load time - 0.220 seconds
mkiv lua stats > luatex banner - this is luatex, version beta-0.70.2-2012091206 (tex live 2012/debian)
mkiv lua stats > control sequences - 33699 of 65536 + 100000
mkiv lua stats > current memory usage - 52 MB (ctx: 54 MB)
mkiv lua stats > runtime - 2.058 seconds, 2 processed pages, 3 shipped pages, 1.458 pages/second
答案1
ConTeXt 表的语法是:
\starttable[...]
\NC ... \NC ... \NC \NR
\NC ... \NC ... \NC \NR
\stoptable
您缺少最后一个\NC
。如果您添加它,那么文档就可以正确编译。
但是,我会使用不同的方法来标记文档。
代替
\define[3]\Recipe{% \section[#1]{#2}% \startcolumns[n=2,rule=on] #3 \stopcolumns}
和
\Recipe{reference}{title} {...}
使用
\definehead[recipe][section] \setuphead[recipe][beforesection={\startcolumns[n=2, rule=on]}, aftersection={\stopcolumns}]
和
\startrecipe[reference={....}, title={....}] .... \stoprecipe
代替
\define[1]\Ingredients{% \subsubject{Ingredience}% \it \starttable[|r|l|] #1 \stoptable} \Ingredients{ \NC ... \NC .. \NC \NR \NC ... \NC .. \NC \NR }
使用
\definetabulate[ingredients][|r|l|] \setuptabulate[ingredients][before={\startsubsubject[title={Ingredience}]}, after={\stopsubsubject}] \startingredients \NC ... \NC .. \NC \NR \NC ... \NC .. \NC \NR \stopingredients
代替
\long\def\Steps#1{% \groupedcommand{\subsubject{Příprava}}{}{#1}}
和
\Steps{...}
使用
\definestartstop[steps][before={\startsubsubject[title={Příprava}]}, after={\stopsubsubject}]
和
\startsteps .... \stopsteps
代替
\completecontent
使用
\definecombinedlist[recipes][chapter,recipe] \setupheadtext[recipes={List of Recipes}]
和
\completerecipes%[criterium=all]
因此,您的文档将如下所示:
\setuppapersize[A4]
\setupbodyfont[sansserif,9pt]
\language[cz]
\definehead[recipe][section]
\setuphead[recipe][beforesection={\startcolumns[n=2, rule=on]}, aftersection={\stopcolumns}]
\definecombinedlist[recipes][chapter,recipe]
\setupheadtext[recipes={List of Recipes}]
\definetabulate[ingredients][|r|l|]
\setuptabulate[ingredients][before={\startsubsubject[title={Ingredience}]}, after={\stopsubsubject}]
\definestartstop[steps][before={\startsubsubject[title={Příprava}]}, after={\stopsubsubject}]
%\showframe
\starttext
\startalignment[center]
\title{Recepty}
\currentdate
\stopalignment
\chapter{Bábovky}
\startrecipe[title={Bábovka}, reference={babovka}]
\startingredients
\NC 40~dkg \NC polohrubá mouka \NC\NR
\NC 15~dkg \NC cukr \NC \NR
\NC 10~dkg \NC tuk \NC \NR
\NC 1~ks \NC prášek do pečiva \NC \NR
\stopingredients
\startsteps
A word word word word. \par Another word word word word word word
word word word word word word word word word word word word word
word word word word word word word word word word word word word
word word word word word word word word. \par Yet another word
word word word word word word word word word word word word word
word word word word word word word word word word word word word
word word word word word word word word word word word word word
word word word word.\par
\stopsteps
\stoprecipe
Between. Between. Between. Between. Between. Between. Between.
\startrecipe[title={Bábovka}, reference={babovka2}]
\startsteps
Word word word word word word word word word word word word word
word word word word word word word word word word word word word
word word word word word word word word word word word word word.
\stopsteps
\stoprecipe
\page
\completerecipes[criterium=all]
\stoptext
这与创建宏的 ConTeXt 风格更加一致。