ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Apply a start/stop command pair to certain subsections
@ 2016-03-10 11:08 Tom Harrop
  2016-03-10 11:27 ` Andreas Schneider
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Harrop @ 2016-03-10 11:08 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-10 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10 11:08 Apply a start/stop command pair to certain subsections Tom Harrop
2016-03-10 11:27 ` Andreas Schneider

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).