When typesetting drop-caps, if the opening sentence starts with a quotation mark, apostrophe, or single quotation mark, the leading character is typically rendered in a smaller font. For example:




I have a document written in plain Markdown, which is converted to XHTML, then typeset using ConTeXt's XML processing functionality. As part of this conversion, straight quotes are converted automatically to curly quotes. The user may not insert ConTeXt-specific macros into the source document. When writing text, the user may start a chapter with a quotation:

"We expected the machines to take control.

When typeset using ConTeXt, the default behaviour is to only to make the quotation mark drop caps:

drop caps with quotation mark

Note that there are many ways to open a quotation:

  • " -- straight quote
  • -- opening curly double quote
  • -- opening curly single quote (or apostrophe)
  • « -- opening double quote (French, Spanish, etc.)
  • -- opening single quote
  • -- opening Japanese quote


Here's the general form of what I'm imagining:

  % Matches any character in the set.
  % Applies the given font to only the matched character.
  % Applies the given colour to only the matched character (optional).

Here's a longer example:


  % The quotation mark is detected and applies the smaller font size.
  "We held ConTeXt in high esteem."

  % Applies drop caps to the first letter because no quotation mark is present.
  \input knuth

Mailing list

From the mailing list, Hans provided the following code:

    \resetfontfeature % might be needed in more places
      \c_attr_color       \attributeunsetvalue



  \setinitial[two]             Knuth   :\ignorespaces\input knuth \par
  \setinitial[two] \symbol[leftquotation]Knuth\symbol[rightquotation] :\ignorespaces\input knuth \par

However, this produces:


What I'm looking to produce is:


Using \quotation instead of \symbol[leftquotation] or produces a red closing quote:



As a follow up to my earlier question, I am wondering:

  • When using \placeinitial, how would you detect whether the first character is in a given set of characters, and, if so, override the \setupinitial to use m=2?

  • When using m=2 to capture a specific character, how would you change the font size of only the quotation mark, leaving the font size for the remaining characters the same?

  • Can such a configuration be accomplished using \setupinitial alone?

I've asked on the mailing list, no response so far.

1 Answer 1


We can use \futureexpandisap to look ahead in the input stream for an opening quotation mark, then a local box to typeset the quotation mark:





    \quoteinitial “We held ConTeXt in high esteem.” \samplefile{bryson}

    \quoteinitial We held ConTeXt in high esteem.   \samplefile{bryson}


  • Hi Max. Thank you! This is a good answer, although not quite the "ConTeXt way". I've updated my question with a code snippet from Hans. What do you think of Hans' idea? Commented Jul 11 at 19:27
  • @DaveJarvis Well, \futureexpandisap and local boxes are both new LuaMetaTeX engine additions, so in some ways it's as ConTeXt-y as it gets :). But I definitely agree, token lookahead like this isn't a great way to solve it when there are builtin mechanisms. Regarding Hans's idea: it definitely seems like the better approach, and it looks just like all of the other core ConTeXt code (unsurprisingly), but I think all that this snippet does is adds/resets the style/color keys for \setupinitial. Commented Jul 11 at 20:31
  • @DaveJarvis (I've been following the mailing list thread too) But why can't you add markup for the quotations to the XML? You're already remapping the straight quotes (") to curly opening/closing quotes (/), so why can't you remap the quotes to <q>/</q> instead? <q> is valid XHTML, and if you were to map it to the ConTeXt \quotation command it seems like it would solve a lot of your problems here. Commented Jul 11 at 20:37
  • There are a few reasons. On the same page, there can be many different styles of quotes (e.g., Spanish, American English, and Japanese). Not all quotes are guaranteed to have a terminating quotation mark. For example, quotations that span paragraphs and books that end mid-sentence. Commented Jul 11 at 22:55

You must log in to answer this question.

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