[Tex/LaTex] the correct way to end a hanging indent section in Context

contextindentation

In an earlier question I got help to get hanging indents working in my text.

I now suspect that I've not been terminating the hanging indent in the right way. Have tried some different things, but still can't get back the regular indent after the hanging indent section.

Looking forward to any clues!

\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

Best Answer

still can't get back the regular indent after the hanging indent section.

Firstly, if you want to stick with your workaround, you should make the modifications to indentation local. To do so, just wrap them into a group:

\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

This way the original indentation behavior should return.

However, may I suggest you use the high-level Context interface instead? The inverted indentation can be achieved by combining a couple ordinary macros (at least as far as the example you gave is concerned), and the code certainly looks a bit more idiomatic. I’ll call the environment negindent for “negative indentation”.

\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

Demo image

Update: In order to make this work with MkII, the indenting has to be registered in advance:

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

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