我正在用 ConTeXt 排版一本小说,我需要一种正确排版场景的方法。我小说中的一个场景只是一系列段落,与前一个段落之间用两个空行隔开(不过将来我可能会修改排版场景的命令以打印一些字符)。
我有两个疑问,以我有限的知识无法解决:
- 有些场景也会改变设置,我需要一种方法来排版一个带有场景描述的附加行,以及在其后的一个附加空白行
正常场景:
前一场景的文本
两个空行
下一幕的文本
设置发生变化的场景:
前一场景的文本
两个空行
新场景的位置
一个空白行
新场景文本
- 除此之外,场景的新命令(或重新定义的命令)最好在后台对场景进行编号,这样我就可以生成一个目录,供我在写作时细细阅读。为了真正发挥作用,我想知道在 ConTeXt 中是否有任何方法可以定义与场景相关的值,该值只会显示在这样的目录中。
我设想它大致是这样的:
\scene [description=A new exciting scene]
\scene [description=Another great scene][setting=With a change of setting]
第一个例子只会打印两行空白行,用于场景目录的描述,而第二个例子还会打印带有设置的附加行和其后的一行空白行。我对语法非常宽容。
当然,该命令可以是任何现有分段命令的重新定义,并且不命名为 \scene 而是 \subject。
根据所给的建议,我得到了以下示例代码,但发现了一个问题:没有描述的场景插入了超过两行垂直空间。
\setuppapersize[A5]
\setupindenting[always,small,first]
\definehead[scene][section]
\define\PlaceLocation
{\framed[frame=off,width=broad,align=flushright,style=slanted]
{\doifsomething{\structureuservariable{location}}
{\italic{\structureuservariable{location}}\blank[fixed,line]}}}
\setuphead
[scene]
[
style=slanted,
align=flushright,
placehead=empty,
command=\undefined,
number=no,
before={\blank[fixed,line]},
after={\blank[fixed,line]},
insidesection={\PlaceLocation}
]
\starttext
\startchapter[title=Dead Man Creek]
\startscene
[title={Arrival at Dead Man Creek}]
[location={Southern Indiana, United States\\March 1948}]
The Jeep was moving along a dirt road, covered here and there by a thick undergrowth, which made obvious that the path had seen little use for a long time. Flanked on both sides by a dense grove, whose branches were growing upward to form a sort of roofing, the silence in that place only broken by the noise of the vehicle motor.
\stopscene
\startscene
[title={Flashback: At Tony Smith's house}]
“Winters has been very kind lending me his personal notes… Well, he has been very kind letting me participate in his investigation, for starters.”
Karl Jegger was holding his pipe as he spoke, looking thoughtfully at the smoke coming from it while sitting in a comfortable armchair facing a window that offered a beautiful view of Fifth Avenue in New York. Beside him, in an identical armchair and enjoying a liquor that Karl had brought to him from Switzerland, was his cousin Tony Smith. Although Karl was talking to him as he spoke, it was clear he was talking more to himself.
\stopscene
\stopchapter
\stoptext
答案1
一种可能的解决方案是简单地使用默认head
机制。定义一个scene
具有正确属性的新头:
\setuppapersize[A5]
\setupindenting[always,small,first]
\definehead[scene][section]
\defineframed
[locationframed]
[
frame=off,
width=broad,
align=flushright,
foregroundstyle=italic,
]
\define\PlaceLocation
{\doifsomethingelse{\structureuservariable{location}}
{\doPlaceLocation}
{\noPlaceLocation}}
\define\doPlaceLocation
{\blank[line]%
\locationframed{\structureuservariable{location}}%
\blank[line]}
\define\noPlaceLocation{\blank[2*line]}
\setuphead
[scene]
[
style=slanted,
align=flushright,
placehead=empty,
number=no,
before=,
after=,
insidesection={\PlaceLocation},
]
\setuphead
[chapter]
[
after=,
]
\showgrid % To help with visual debugging
\starttext
\startchapter[title=Dead Man Creek]
\startscene
[title={Arrival at Dead Man Creek}]
[location={Southern Indiana, United States\\ March 1948}]
The Jeep was moving along a dirt road, covered here and there by a thick undergrowth, which made obvious that the path had seen little use for a long time. Flanked on both sides by a dense grove, whose branches were growing upward to form a sort of roofing, the silence in that place only broken by the noise of the vehicle motor.
\stopscene
\startscene
[title={Flashback: At Tony Smith's house}]
“Winters has been very kind lending me his personal notes… Well, he has been very kind letting me participate in his investigation, for starters.”
Karl Jegger was holding his pipe as he spoke, looking thoughtfully at the smoke coming from it while sitting in a comfortable armchair facing a window that offered a beautiful view of Fifth Avenue in New York. Beside him, in an identical armchair and enjoying a liquor that Karl had brought to him from Switzerland, was his cousin Tony Smith. Although Karl was talking to him as he spoke, it was clear he was talking more to himself.
\stopscene
这使:
几点说明:
- 我使用它
\showgrid
是为了方便进行可视化调试。 您看到大空格的原因是章节还增加了垂直空间。如果章节后面总是跟着一个场景,那么您可以使用
after=
(就像我做的那样)来删除垂直空间;如果没有,则需要其他技巧。通常,ConTeXt 会折叠多个空格,但如果您需要目录,那么锚需要放置在页面上。因此您得到的是Chapter title blank of chapter anchor for scene blank before location
锚不占用任何垂直空间,但可以防止位置前空白从看到章节后空白.因此有双倍空间。
- 虽然在这个设置中没有什么区别,但你也应该意识到,在行首使用框架会把它放在垂直模式而不是横向模式
\dontleavehmode
。您可以通过在框架前面添加一个来强制框架保持水平模式。另请参阅ConTeXt 常见问题解答。