ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Grabbing first letter of a sentence
@ 2010-11-15 16:38 Mathieu Boespflug
  0 siblings, 0 replies; only message in thread
From: Mathieu Boespflug @ 2010-11-15 16:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

I'd like to get access to the first letter of a chapter for the
purpose of laying out the chapter heading, but I'm having difficulty
with expansion.

Here's my attempt:

\def\MyChapterTitle#1#2{%
  \def\doMyChapterTitle##1##2^{%
      {\tfb ##1}##2
  }
  #1 \doMyChapterTitle#2^
}

setuphead[chapter][command=\MyChapterTitle]

\starttext

\chapter{Foo}

bar

\stoptext

This doesn't work because the chapter title isn't expanded out before
passing it to \MyChapterTitle. I know there is deeptextcommand but I
need the chapter title during the layout of chapter number + title, so
I need to use command instead of deeptextcommand. I attempted to get
hold of the chapter title using the following

\def\MyChapterTitle#1#2{%
  \def\doMyChapterTitle##1##2^{%
      {\tfb ##1}##2
  }
  #1 \expandafter\doMyChapterTitle\expandafter{\fetchmark[chapter][first]}^
}

but that doesn't seem to work either. Any ideas?

Many thanks,

M
___________________________________________________________________________________
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] only message in thread

only message in thread, other threads:[~2010-11-15 16:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-15 16:38 Grabbing first letter of a sentence Mathieu Boespflug

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