I am trying to typeset some TeX code inline with ConTeXt. In LaTeX, there's \verb to handle that, but I do not find the equivalent in ConTeXt.

In the Wiki, there is some suggestion code:

   \processinlineverbatim\egroup }

However, when I try to use that, I get this error:

tex error       > tex error on line 34 in file /.../xyz.tex: ! Undefined control sequence

\typeTEX ...cessinlineverbatim }\initializetyping 
                                                  {TEX}\startverbatimcolor \...

I have no idea what \initializetyping does and whether it is needed. If I remove it, I get the same message for \startverbatimcolor and so on. This macro does not seem usable. Is there any alternative?

  • Sounds like \type{...} is what you're looking for, here on the wiki. For TeX code specifically you can do, if you like, \type[option=tex]{...}. (The colour scheme of that is customizable, but the only way I know of changing it is a bit messy.)
    – 9tTn9B
    Jul 11, 2017 at 14:27
  • Your wiki link does not work. How would I write a } in with \type?
    – flyx
    Jul 11, 2017 at 14:36
  • Link should be fixed now. If the braces are balanced then you can just do \type{...{...}...}. Another option is using angle brackets as delimiters: \type<<}>>. Finally, you can also use the \verb style, and use any character you like to delimit: \type|}|.
    – 9tTn9B
    Jul 11, 2017 at 14:41
  • Do you want to post that as answer?
    – flyx
    Jul 11, 2017 at 14:42
  • Sure, I'll type it up now :)
    – 9tTn9B
    Jul 11, 2017 at 14:48

1 Answer 1


For typing code inline you can use \type, which is described here on the wiki. It can be used as:

  • \type[optional arg]{content with balanced braces}
  • \type[optional arg]<<content not containing the string ">>" anywhere>>
  • \type[optional arg]|content not containing the string "|" anywhere|

(In the third case here, you can use pretty much any single character as a delimiter, not just |, in the same way as LaTeX's \verb allows.) The optional argument [...], if given, should be a list of key-value pairs: the valid options are exactly those that \setuptype understands (here on the wiki). According to the installation on my machine,

ConTeXt  ver: 2017.06.30 19:45 MKIV beta  fmt: 2017.7.5

the options that you can pass to \type are:

color   = COLOR
command = CSNAME
compact = absolute last (all)
escape  = yes (no) TEXT PROCESSOR->TEXT
left    = COMMAND
lines   = yes (no) normal hyphenated
option  = mp lua xml parsed-xml nested tex context none NAME
right   = COMMAND
space   = on (off) normal fixed stretch
tab     = (yes) no NUMBER

where I mimic the wiki's style, and use brackets (...) to indicate the default value.

If you find yourself passing the same options to \type again and again, then you might find \definetype useful, which is here on the wiki. It works in the same way as all the \define... style commands in ConTeXt.

To mimic Taco's \typeTEX macro (which only works with MKII), you can define a new type as in the following





This will apply TeX syntax hightlighting to the contents of \typeTEX.

You must log in to answer this question.

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