Changing messages in ConTeXt

While writing papers I normally finish a draft of the text before working on figures. However, I include a placeholder for a figure. ConTeXt makes this very easy, I just type

{A long and thoughtful caption that I write with the other text}

Normally, the last argument will be something like


But, if I omit the information, ConTeXt draws a dummy figure — a text frame with “unknown” written in the center.


This is useful, except for the “unknown” part. Other people reading the draft tend to think that something went wrong with the figure syntax and the “unknown” is LaTeX error message. (Yeah, many people think that I use LaTeX. It is not worth the effort to clarify the distinction between LaTeX and ConTeXt). So, I wanted to change the “unknown” to a more sensible message. ConTeXt has a multilingual interface. So, message are not hard-coded, but can be changed depending on the language. So, I just needed to figure out which message was \placefigure calling when the fourth argument was empty. A bit of hunting around in the source files revealed the answer. page-flt.tex file has the following code


So, when given an empty block, it typesets a frame with message 12 of float blocks library. So, I need to change that to something more sensible.

\startmessages  english  library: floatblocks
12: To be drawn

With this, I get


The above exercise also tells me that I can change the width of the framed box. For example, I can say


after which I get a bigger framed box.


The only drawback of this approach is that all float blocks (figures, tables, anything else that you may have defined) use the same error message. A “To be drawn” message for a table looks silly, but I don’t use tables that often, so it is not a big issue for me.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s