ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Tom Harrop <thomas.harrop@ird.fr>
To: ntg-context@ntg.nl
Subject: Apply a start/stop command pair to certain subsections
Date: Thu, 10 Mar 2016 12:08:19 +0100	[thread overview]
Message-ID: <56E155A3.9050001@ird.fr> (raw)

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.

Many thanks for reading,

Tom Harrop

---Example below---

\definestartstop [negindent] [
   before={%
     \startnarrower[left]%
     \setupindenting[-\leftskip,yes,first]%
     \setuphead[subsection][indentnext=yes]%
   },
   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

 
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

             reply	other threads:[~2016-03-10 11:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10 11:08 Tom Harrop [this message]
2016-03-10 11:27 ` Andreas Schneider

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56E155A3.9050001@ird.fr \
    --to=thomas.harrop@ird.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).