ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Andreas Schneider <aksdb@gmx.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Apply a start/stop command pair to certain subsections
Date: Thu, 10 Mar 2016 12:27:04 +0100	[thread overview]
Message-ID: <4cbd906a8eb220dfc0f0ab19dc9860aa@chemnitz.dyndns.aksdb.de> (raw)
In-Reply-To: <56E155A3.9050001@ird.fr>

You could take a look at my fork of Pablo's pandoc-xhtml:
https://github.com/aksdb/pandoc-xhtml

The basic idea is to use another step in between the generation: Pandoc 
-> XML -> PDF (since ConTeXt can read XML natively, given the 
appropriate environment file).

As you can see in the example Makefile, you should use pandoc with 
--section-divs which will (in my fork of pandoc-xhtml, not in the 
original) cause the use of \startchapter...\stopchapter, 
\startsection...\stopsection etc.

Therefore you can then also use \setuphead[chapter][insidesection=..., 
aftersection=...] and similar setups.

Best regards
Andreas


Am 2016-03-10 12:08, schrieb Tom Harrop:
> 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:27 UTC|newest]

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

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=4cbd906a8eb220dfc0f0ab19dc9860aa@chemnitz.dyndns.aksdb.de \
    --to=aksdb@gmx.de \
    --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).