0
Notice that \inlinec{\n} represents only a single character.
An escape sequence like \inlinec{\n} provides
a general and extensible mechanism for representing
hard-to-type or invisible characters.
Among the others that C provides are \inlinec{\t} for tab,
\inlinec{\b} for backspace,
\inlinec{\"} for the double quote,
and \inlinec{\\} for the backslash itself.
There is a complete list in Section 2.3.

will produce

enter image description here

In the example above, highlighting does not work correctly. So, we shall provide more information to ConTeXt.

Is it possible to do some thing like \codecontext{printf("text\inline{\n}");} to produce the right highlighting for '\n', '\t', '\b', ...?

  • @Aditya filter expert – Little Pony Aug 11 '18 at 8:35
  • 2
    \n is not a valid C syntax! You'll get the right highlighting if you use \inlinec{"\n"}, which is valid C code. The highlighting produced by t-vim is the same as what you'll see if you type the content of the macro directly in vim and the the syntax to C. – Aditya Aug 11 '18 at 17:56
  • I understand. How ever, if we type \inlinec{"\n"}, we get extra double quotations. :D. – Little Pony Aug 11 '18 at 19:33
  • 3
    But that is how C syntax highlighting works. \n etc are special only inside a string. The easiest solution will be to write a vim syntax highlighting scheme for your "language" and then use \definevimtyping[...][syntax=mylangualge]. For example, if you set the syntax to context, everything starting with abackslash will be highlighted. – Aditya Aug 11 '18 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.