# [NTG-context] Apply a start/stop command pair to certain subsections

Tom Harrop thomas.harrop at ird.fr
Thu Mar 10 12:08:19 CET 2016

Hello,

I'm a new Context user, and I have a question about conditional
formatting of paragraphs.

I'm typsetting a CV. I am using pandoc to generate the .tex file from
Markdown before compiling the pdf with context. Because pandoc inserts
the body of the document from one variable (\$body), I would like to
avoid using e.g. \startmycommand and then \stopmycommand to modify
individual subsections.

What I can do from Markdown is tag the headings, so that (for example)
the "Publications" subsection starts as
"\subsection[pubs]{Publications}". I would like to know if there is a
way to automatically apply a start/stop command pair to the "pubs"
subsection(s), or if it better to do this with an external script that
modifies the .tex file before I call context.

Below is an example where I can get the output I'm looking for
(paragraphs in the "pubs" subsection have a hanging indent) by defining
a start/stop command pair and manually applying it to the "pubs"
subsection.

If anyone has any tips to apply this automatically to the "pubs"
subsection(s) but not the "text" subsections, I'd appreciate it! I have
searched the wiki, read through the "Context: an excursion" document and
looked around in the mail archive and stackexchange, but I didn't find
exactly what I want.

Tom Harrop

---Example below---

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

\starttext

\subsection[text]{Normal text}

I would like the text in this subsection to appear without indents.

In the following subsection I need hanging indents.

\startnegindent

\subsection[pubs]{Publications}

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.

Persson, Tomas. {\os 2008}. {\em Pictorial Primates: A Search for Iconic
Abilities in Great Apes}. Lund: Lund University Cognitive Studies.

\stopnegindent

\subsection[text]{More text}

This subsection should be back to normal.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.

\stoptext