在 Context 中结束悬挂缩进部分的正确方法是什么?

在 Context 中结束悬挂缩进部分的正确方法是什么?

在一个先前的问题我获得了帮助以使悬挂缩进在我的文本中发挥作用。

我现在怀疑我没有以正确的方式终止悬挂缩进。我尝试了一些不同的方法,但仍然无法在悬挂缩进部分后恢复常规缩进。

期待任何线索!

\setuppapersize[A5]
\starttext

\everypar{\hangafter=1\hangindent=1em\relax} % Comment out this line and it works

\subject{Section with hanging indent}

Jaynes, Julian. {\os 1990}.
{\em The Origin of Consciousness in the
Breakdown of the Bicameral Mind}. New York City: Houghton Mifflin Company.

Pye, David. {\os 1995}. {\em The Nature and Art of Workmanship}.
London: The Herbert Press.

\everypar{\hangafter=0\relax} % Comment out this line and it works

\setupindenting[yes, next, 9mm]
\subject{Section with regular identing}
I would expect this line to begin at the margin,
not having an indent \ldots\ and so is the case, but only
if I delete the above {\em Section with hanging indent}.

This next paragraph would be intented.
\stoptext

答案1

悬挂缩进部分后仍然无法恢复常规缩进。

首先,如果你想坚持你的解决方法,你应该对缩进进行局部修改。为此,只需将它们包装到一个组中:

\setuppapersize[A5]
\starttext

\bgroup
\everypar{\hangafter=1\hangindent=1em\relax}

\subject{Section with hanging indent}

Jaynes, Julian. {\os 1990}.
{\em The Origin of Consciousness in the
Breakdown of the Bicameral Mind}. New York City: Houghton Mifflin Company.

Pye, David. {\os 1995}. {\em The Nature and Art of Workmanship}.
London: The Herbert Press.

\everypar{\hangafter=0\relax}
\egroup

\setupindenting[yes,first, 9mm]
\subject{Section with regular identing}
I would expect this line to begin at the margin,
not having an indent \ldots\ and so is the case, but only
if I delete the above {\em Section with hanging indent}.

This next paragraph would be intented.
\stoptext

这样,原来的缩进行为就会恢复。

但是,我建议您改用高级 Context 接口吗?可以通过组合几个普通宏来实现反向缩进(至少就您给出的示例而言),并且代码看起来肯定更符合惯用语。我将调用环境否定对于“负缩进”。

\definestartstop [negindent] [
  before={%
    \startnarrower[left]%
    \setupindenting[-\leftskip,yes,first]%
    \setuphead[subject][indentnext=yes]%
  },
  after=\stopnarrower,
]

\setuppapersize[A5]

\starttext
  \startnegindent % ····················································%
    \subject{Section with hanging indent}

    Jaynes, Julian. {\os 1990}.
    {\em The Origin of Consciousness in the
    Breakdown of the Bicameral Mind}. New York City: Houghton Mifflin Company.

    Pye, David. {\os 1995}. {\em The Nature and Art of Workmanship}.
    London: The Herbert Press.
  \stopnegindent % ·····················································%

  \setupindenting[yes, next, 9mm]
  \subject{Section with regular identing}
  I would expect this line to begin at the margin,
  not having an indent \ldots\ and so is the case, but only
  if I delete the above {\em Section with hanging indent}.

  This next paragraph would be intented.
\stoptext

演示图像

更新:为了使其与 MkII 一起工作,必须提前注册缩进:

\defineindentingmethod [negative] {\parindent-\leftskip}

\definestartstop [negindent] [
  before={%
    \startnarrower[left]%
    \setupindenting[yes,first,negative]%
    \setuphead[subject][indentnext=yes]%
  },
  after=\stopnarrower,
]

相关内容