定义段落后的空白行

定义段落后的空白行

正如您在以下代码中看到的,我有一个章节定义,其后始终跟随着一个或多个场景。场景的标题不显示任何标题,而是显示两个空行(标题将显示在目录中)。

我创建了一个段落定义,用于排版场景的位置,以便在每次场景改变位置时使用它。我希望在段落和场景文本之间留出空白,但我无法做到这一点。

\setuppapersize[A5]

% Chapters
\define[2]\CustomChapter{\dontleavehmode\framed[frame=on,width=broad,align=middle]{#1.\\#2}}

\setuphead [chapter]
           [after=,
            before={\blank[force,line]},
            command=\CustomChapter]

% Scenes
\definehead[scene][section]

\setuphead
  [scene]
  [placehead=empty,
   number=no,
   before=,
   after=,
   insidesection={\blank[2*line]}
  ]

% Location
\startsetups[paragraph:location]
  \setupalign[flushright]
\stopsetups

\defineparagraph
  [location]
  [style=italic,
   after={\blank[line]},
   setups=paragraph:location]

\showgrid

\starttext

\startchapter[title={One}]

\startscene[title={Karl llega a Dead Man Creek}]

\startparagraph[location]
South of Indiana, United States

March 1948

\stopparagraph

This is Chapter One, and you should see one line between the location and this text.

Each scene typesets two blank lines in its inside section.
\stopscene

\stopchapter

\startchapter[title={Two}]
\startscene[title={This is a scene}]
This is Chapter Two, and this scene typesets, again, two lines in its inside section.
\stopscene
\stopchapter

\stoptext

答案1

您最好使用简单的\definestartstop。段落似乎不是适合您所做工作的正确工具。基本上,您可以使用自定义开始-停止作为替代品,其优点是值after有效。

\definestartstop
  [location]
  [style=italic,
   after={\blank[line]},
   setups=paragraph:location]
\prependvalue{stoplocation}{\par}

最后一行还偷偷夹带了一个\par之前的内容\stoplocation,这样您就可以省略 1948 年 3 月之后的额外空白行。我还修改了您的文档,使其更好地遵循“ConTeXt 方式”。

\setuppapersize[A5]

% Chapters
\starttexdefinition unexpanded CustomChapter #1#2
  \dontleavehmode
  \startframed[frame=on,width=broad,align=middle]
    #1.\\#2
  \stopframed
\stoptexdefinition

\setuphead
  [chapter]
  [after=,
   before={\blank[force,line]},
   command=\CustomChapter]

% Scenes
\definehead
  [scene]
  [section]
  [placehead=empty,
   number=no,
   before=,
   after=,
   insidesection={\blank[2*line]}]

% Location
\startsetups[paragraph:location]
  \setupalign[flushright]
\stopsetups

\definestartstop
  [location]
  [style=italic,
   after={\blank[line]},
   setups=paragraph:location]
\prependvalue{stoplocation}{\par}

\showgrid

\starttext

\startchapter[title={One}]

  \startscene[title={Karl llega a Dead Man Creek}]

    \startlocation
      South of Indiana, United States

      March 1948
    \stoplocation

    This is Chapter One, and you should see one line between the location and this text.

    Each scene typesets two blank lines in its inside section.
  \stopscene

\stopchapter

\startchapter[title={Two}]
  \startscene[title={This is a scene}]
    This is Chapter Two, and this scene typesets, again, two lines in its inside section.
  \stopscene
\stopchapter

\stoptext

相关内容