5

I would like the first character of my \section head (I'm using a fancy germanic font) to be at (for example) \tfb while the rest is at \tfa.

I've tried adding \placeinitial to the style, but that merely creates a very large (5-6 line) whitespace before the \section, without benefit.

Is there a trivial way of accomplishing this?

Sample code:

\definefontfamily[germanic][gothic][ltcgoudytextw01lombardcap]

\setuphead[section]      [style={\setupbodyfont[germanic]\tfc\placeinitial},number=no]

\setupinitial[color=black,font=ltcgoudytextw01lombardcap at 26pt,distance=1pt,n=1,location=text,]

\starttext
\section{Character}
\input knuth

But I want to achieve
\blank
\setupbodyfont[germanic]
{\tfd C}{\tfb haracter}
\setupbodyfont[modern]

\input knuth

\stoptext

enter image description here

1

1 Answer 1

3

Hmm, this is quite convoluted, but I couldn't find a better solution... So: you lose the ability to set up your initial the way placeinitial allows, but if you're sure that you just want the first character to be bigger, here goes (I don't have your font, so I use pagella):

\setupbodyfont [pagella, 12pt]

\def\doChapterTitle#1%
   {\ctxlua{userdata.chaptertitle([==[#1]==])}}

\startluacode
  userdata = userdata or { }

  function userdata.chaptertitle(s)
    local initial, rest = s:sub(1, 1), s:sub(2, -1)
    context.bgroup()
    context.switchtobodyfont( { "30pt" } )
    context(initial)
    context.egroup()
    context(rest)
  end
\stopluacode

\define[1]\MyChapterTitle%
  {\doChapterTitle{#1}}

\setuphead [chapter]
           [number=no,
            deeptextcommand=\MyChapterTitle]

\starttext

\startchapter [title={Character}]

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras tellus. 

\stopchapter

\stoptext

Result:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .