From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/73870 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Syntax highlighting for C-code Date: Sun, 15 Jan 2012 12:06:03 +0100 Message-ID: <0BBB1DD6-ED73-49B4-990C-EF7810EF378F@googlemail.com> References: <4F100ED0.4000608@weickelt.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1326625594 20425 80.91.229.12 (15 Jan 2012 11:06:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 15 Jan 2012 11:06:34 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Jan 15 12:06:30 2012 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RmNuu-00055T-2l for gctc-ntg-context-518@m.gmane.org; Sun, 15 Jan 2012 12:06:28 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 943C8CB1E7; Sun, 15 Jan 2012 12:06:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id r8BYEyQeUVrF; Sun, 15 Jan 2012 12:06:12 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 54864CB1E1; Sun, 15 Jan 2012 12:06:12 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0DD41CB1E1 for ; Sun, 15 Jan 2012 12:06:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id SSvo1n6NZX-n for ; Sun, 15 Jan 2012 12:06:09 +0100 (CET) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 1891ECB1DF for ; Sun, 15 Jan 2012 12:06:08 +0100 (CET) Original-Received: from mail-ee0-f41.google.com (mail-ee0-f41.google.com [74.125.83.41]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id q0FB68Hi010701 for ; Sun, 15 Jan 2012 12:06:08 +0100 Original-Received: by eekc13 with SMTP id c13so119420eek.14 for ; Sun, 15 Jan 2012 03:06:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=m/g1RNB3RZgdpAoJqTgZ4Bu21QcxPj72Os4kWjCtwkc=; b=XRDEC15rh5ZItCLOzRrzSBrHUW6zBBDBWqfPpbfStqV+TDJnBh1qKM5U9D6h5VxgaY EWNr0C9eqF6x8CYahI+H7qMo1hPlokbK08Gxv9ylo2D3SgDkyzoeP2PF+SVQO3KdQ9yR /cy6BjcoTt8QXL1xqGhTvakh95vDCwpGn5aVk= Original-Received: by 10.213.108.132 with SMTP id f4mr1670655ebp.35.1326625568180; Sun, 15 Jan 2012 03:06:08 -0800 (PST) Original-Received: from [192.168.2.35] (p57AFA54A.dip.t-dialin.net. [87.175.165.74]) by mx.google.com with ESMTPS id 76sm56731001eeh.0.2012.01.15.03.06.05 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jan 2012 03:06:07 -0800 (PST) In-Reply-To: <4F100ED0.4000608@weickelt.de> X-Mailer: Apple Mail (2.1251.1) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=74.125.83.41; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0rGlL682n - eaed1c675ce0 - 20120115 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:73870 Archived-At: Am 13.01.2012 um 12:00 schrieb Richard Weickelt: > Hi, > = > I've tried to include some C-code into my document, but failed to enable = syntax highlighting. > = > Tested on: linux-64, context-2011.05.18 (same with the beta) stand-alone = mkIV > = > 1) \starttyping[option=3DC] just prints verbatim text. There seems to be = no formatter for C out of the box. There is no formatter for C code in MkIV but when you write one send the fi= le to Hans and he can include it in the distribution. > 2) t-vim did not work. It failed somewhere (unknown command sequence \ins= tallspacehandler) on loading (\usemodule[vim]) > = > 3) http://wiki.contextgarden.net/Verbatim_text > I tried to download pret-c and put it into the modules folder, but writin= g \installprettytype[C][C] failed, because it's not known (in mkIV). MkII and MkIV have different implementation to format source code. > 4) mkII does not complain to exec \installprettytype[C][C], but this does= not change anything either. \starttyping[option=3DC] seems to call a (mayb= e builtin?) formatter, but I could not get colors to work. The following is MkII only. There are two ways to have formatted C code, th= e first is to define a C environment with \definetype[C][option=3DC] and th= en you can put the code between \startC and \stopC, the second is to use th= e normal typing environment and pass =93option=3DC=94 as argument. To get c= olors in your code you have to enable them first with \setupcolors[state=3D= start]. % engine=3Dpdftex \setupcolors[state=3Dstart] \definetyping[C][option=3DC] \starttext \startC #include = int main() { printf("Hello World\n"); return 0; } \stopC \blank[2*line] \starttyping[option=3DC] #include = int main() { printf("Hello World\n"); return 0; } \stoptyping \stoptext Wolfgang ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________