Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
share|improve this question
    
In general, do not use \everypar in ConTeXt. Use \EveryPar instead. –  Aditya Mar 14 '13 at 12:32
    
See also this question regarding \everypar versus \EveryPar. –  PetaspeedBeaver Mar 25 '13 at 23:06
add comment

1 Answer 1

up vote 4 down vote accepted

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,
]
share|improve this answer
    
Thanks, can confirm that the first solution works perfectly! But I'm also very interested in the later one. However I get a l.13 \startnegindent when trying to compile the MWE. I'm using pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012) and ConTeXt version 2012.05.30 11:26 MKII fmt: 2012.12.8, but guess it has do to with my installation in some way? –  PetaspeedBeaver Mar 10 '13 at 20:22
1  
@PetaspeedBeaver I appended a snippet that works with MkII. Is there a reason as to why you still work with the legacy format? You’ll be running into tons of these situations. –  phg Mar 10 '13 at 20:48
    
No, there's no reason for that except I didn't know I was :) I have to read up on the versions of Context and move over! –  PetaspeedBeaver Mar 10 '13 at 22:20
    
How to use ConTeXt MkIV in TeXworks: If you have the latest TeX Live release you should just make sure TeXworks runs ConTeXt (LuaTeX) as default and ConTeXt MkIV will be used as standard. –  PetaspeedBeaver Mar 25 '13 at 21:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.