Re: [NTG-context] ntg-context Digest, Vol 189, Issue 28
Hello Wolfgang, after a few attempts that didn't work I copy-pasted the
example from the wiki:
\definetyping[C][option=commands]\startC
#include
Send ntg-context mailing list submissions to ntg-context@ntg.nl
To subscribe or unsubscribe via the World Wide Web, visit https://mailman.ntg.nl/mailman/listinfo/ntg-context or, via email, send a message with subject or body 'help' to ntg-context-request@ntg.nl
You can reach the person managing the list at ntg-context-owner@ntg.nl
When replying, please edit your Subject line so it is more specific than "Re: Contents of ntg-context digest..."
Today's Topics:
1. Source Code with Bolded Keywords (Yves Cloutier) 2. Re: Source Code with Bolded Keywords (Wolfgang Schuster) 3. Quizz (Fabrice Couvreur) 4. Re: Quizz (Henning Hraban Ramm) 5. METAPOST vardef returning multiple and non-numeric types as a single answer? (Gerben Wierda)
----------------------------------------------------------------------
Message: 1 Date: Sat, 14 Mar 2020 11:54:31 -0400 From: Yves Cloutier
To: mailing list for ConTeXt users Subject: [NTG-context] Source Code with Bolded Keywords Message-ID: Content-Type: text/plain; charset="utf-8" Hello,
I am trying to typeset source code for a custom programming language and would like to have the keywords in bold text.
I tried following the example found here regarding verbatim displays:
https://www.contextgarden.net/Verbatim_text#Displayed_text
Specifically the C example, however this does not seem to work. No formatting is applied to my keywords.
Just wondering if the way to do it has changed or if there are other examples I could look at to compare with what I'm doing.
Regards,
yc
Yves Cloutier schrieb am 15.03.2020 um 16:09:
Hello Wolfgang, after a few attempts that didn't work I copy-pasted the example from the wiki:
\definetyping[C][option=commands] \startC #include
int main(){ return 0; /BTEX{\em unreachedCode;}/ETEX } \stopC This did not work.
However following the example you provided this works perfectly! Many thanks.
When your goal is to format C or C++ code you can load the scite module
which provides support for additional languages.
The \setuptyping line is necessary because the module selects the wrong
formatter for C++ but this should be fixed in the next ConTeXt release
and you can remove it when you make a update to the newest version.
\usemodule[scite]
\setuptyping[CPP][option=cpp]
\starttext
\startCPP
#include
participants (2)
-
Wolfgang Schuster
-
Yves Cloutier