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 <stdio.h> 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 <stdio.h>
int main() {
printf("Hello ConTeXt!");
return 0;
}
\stopCPP
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________