ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to display source in ConTeXt?
@ 2012-11-13  9:45 yang.zhao
  2012-11-13 10:42 ` Marco Patzer
  0 siblings, 1 reply; 10+ messages in thread
From: yang.zhao @ 2012-11-13  9:45 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 183 bytes --]

Hi everybody,
is there a good way to display source(such as C language)  in ConTeXt?
or a Module to deal these things (indent, hightlight)
just as listings package in LaTeX?

Thanks.

[-- Attachment #1.2: Type: text/html, Size: 204 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to display source in ConTeXt?
  2012-11-13  9:45 How to display source in ConTeXt? yang.zhao
@ 2012-11-13 10:42 ` Marco Patzer
  2012-11-13 12:43   ` yang.zhao
  0 siblings, 1 reply; 10+ messages in thread
From: Marco Patzer @ 2012-11-13 10:42 UTC (permalink / raw)
  To: ntg-context

2012-11-13 yang.zhao:

> is there a good way to display source(such as C language)  in ConTeXt?

There is the vim module. It uses the editor vim to mark up the
source with syntax highlighting code. However, it does only
highlighting, not indentation. But it might be possible to hook in
an auto-indenter or a formatter like `astyle`. Here's an example:

\usemodule
  [vim]

\definevimtyping
  [C]
  [syntax=c,
   style=smalltype,
   tab=2]

\starttext

\startC
void EBI_BankByteLaneEnable(uint32_t banks, bool enable)
{
  EFM_ASSERT((banks & ~(EBI_BANK0 | EBI_BANK1 | EBI_BANK2 | EBI_BANK3)) == 0);

  /* Configure byte lane support for each selected bank */
  if (banks & EBI_BANK0)
  {
    BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL_SHIFT, enable);
  }
  if (banks & EBI_BANK1)
  {
    BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL1_SHIFT, enable);
  }
}
\stopC

\stoptext


Marco

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to display source in ConTeXt?
  2012-11-13 10:42 ` Marco Patzer
@ 2012-11-13 12:43   ` yang.zhao
  2012-11-13 13:19     ` Martin Schröder
  0 siblings, 1 reply; 10+ messages in thread
From: yang.zhao @ 2012-11-13 12:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1864 bytes --]

Thank you, it works.
and I could add line number too.
Now just the indent problem, but i can control this in the source file..
One more thing, how to change font in the  \startDEFINE \stopDEFIN ?

I find using ConTeXt as the back-end of WEB system(D E.Knuth, LP) is very
well,
because ConTeXt deal Chinese very easy and good.


2012/11/13 Marco Patzer <homerow@lavabit.com>

> 2012-11-13 yang.zhao:
>
> > is there a good way to display source(such as C language)  in ConTeXt?
>
> There is the vim module. It uses the editor vim to mark up the
> source with syntax highlighting code. However, it does only
> highlighting, not indentation. But it might be possible to hook in
> an auto-indenter or a formatter like `astyle`. Here's an example:
>
> \usemodule
>   [vim]
>
> \definevimtyping
>   [C]
>   [syntax=c,
>    style=smalltype,
>    tab=2]
>
> \starttext
>
> \startC
> void EBI_BankByteLaneEnable(uint32_t banks, bool enable)
> {
>   EFM_ASSERT((banks & ~(EBI_BANK0 | EBI_BANK1 | EBI_BANK2 | EBI_BANK3)) ==
> 0);
>
>   /* Configure byte lane support for each selected bank */
>   if (banks & EBI_BANK0)
>   {
>     BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL_SHIFT, enable);
>   }
>   if (banks & EBI_BANK1)
>   {
>     BITBAND_Peripheral(&(EBI->CTRL), _EBI_CTRL_BL1_SHIFT, enable);
>   }
> }
> \stopC
>
> \stoptext
>
>
> Marco
>
>
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>



-- 
K.I.S.S.

[-- Attachment #1.2: Type: text/html, Size: 3424 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to display source in ConTeXt?
  2012-11-13 12:43   ` yang.zhao
@ 2012-11-13 13:19     ` Martin Schröder
  2012-11-13 13:29       ` Pontus Lurcock
                         ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Martin Schröder @ 2012-11-13 13:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2012/11/13 yang.zhao <hckjsnzf@gmail.com>:
> Thank you, it works.

PLEASE switch of Comic Sans!
http://bancomicsans.com/
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to display source in ConTeXt?
  2012-11-13 13:19     ` Martin Schröder
@ 2012-11-13 13:29       ` Pontus Lurcock
  2012-11-13 15:41         ` Alan BRASLAU
  2012-11-13 14:16       ` Martin Schröder
  2012-11-13 16:46       ` Khaled Hosny
  2 siblings, 1 reply; 10+ messages in thread
From: Pontus Lurcock @ 2012-11-13 13:29 UTC (permalink / raw)
  To: ntg-context

On Tue 13 Nov 2012, Martin Schröder wrote:

> PLEASE switch of Comic Sans!
> http://bancomicsans.com/

Yang Zhao's message did include a text/plain version too.
Unfortunately it seems it may be impossible to display this by default
in Gmail:
http://webapps.stackexchange.com/questions/4289/how-to-disable-content-type-html-in-gmail . Another reason to use Mutt :-).

Pont
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to display source in ConTeXt?
  2012-11-13 13:19     ` Martin Schröder
  2012-11-13 13:29       ` Pontus Lurcock
@ 2012-11-13 14:16       ` Martin Schröder
  2012-11-13 16:46       ` Khaled Hosny
  2 siblings, 0 replies; 10+ messages in thread
From: Martin Schröder @ 2012-11-13 14:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2012/11/13 Martin Schröder <martin@oneiros.de>:
> 2012/11/13 yang.zhao <hckjsnzf@gmail.com>:
>> Thank you, it works.
>
> PLEASE switch of Comic Sans!
> http://bancomicsans.com/

Apologies: I forgot a ":-)"

Best
   Martin
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to display source in ConTeXt?
  2012-11-13 13:29       ` Pontus Lurcock
@ 2012-11-13 15:41         ` Alan BRASLAU
  0 siblings, 0 replies; 10+ messages in thread
From: Alan BRASLAU @ 2012-11-13 15:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: pont

On Tue, 13 Nov 2012 13:29:01 +0000
Pontus Lurcock <pont@talvi.net> wrote:

> Another reason to use Mutt :-).

Or Claws mail (a decent gui alternative to mutt) ;)

Alan
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to display source in ConTeXt?
  2012-11-13 13:19     ` Martin Schröder
  2012-11-13 13:29       ` Pontus Lurcock
  2012-11-13 14:16       ` Martin Schröder
@ 2012-11-13 16:46       ` Khaled Hosny
  2012-11-14  1:04         ` yang.zhao
  2 siblings, 1 reply; 10+ messages in thread
From: Khaled Hosny @ 2012-11-13 16:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Nov 13, 2012 at 02:19:13PM +0100, Martin Schröder wrote:
> 2012/11/13 yang.zhao <hckjsnzf@gmail.com>:
> > Thank you, it works.
> 
> PLEASE switch of Comic Sans!
> http://bancomicsans.com/

I like Comic Sans (I really do, no idea why it is so much hated).

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to display source in ConTeXt?
  2012-11-13 16:46       ` Khaled Hosny
@ 2012-11-14  1:04         ` yang.zhao
  2012-11-14  1:20           ` Aditya Mahajan
  0 siblings, 1 reply; 10+ messages in thread
From: yang.zhao @ 2012-11-14  1:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1168 bytes --]

Sorry for font in this mail.
Back to ConTeXt.
Now I use vim module, can I change the font of the source display?
I read the  ~/context/tex/texmf-modules/doc/context/third/vim/vim.txt,
I search "font" ,there is just  \setupbodyfont. I try this, but dosen't
work..

Thanks.


2012/11/14 Khaled Hosny <khaledhosny@eglug.org>

> On Tue, Nov 13, 2012 at 02:19:13PM +0100, Martin Schröder wrote:
> > 2012/11/13 yang.zhao <hckjsnzf@gmail.com>:
> > > Thank you, it works.
> >
> > PLEASE switch of Comic Sans!
> > http://bancomicsans.com/
>
> I like Comic Sans (I really do, no idea why it is so much hated).
>
>
> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>



-- 
K.I.S.S.

[-- Attachment #1.2: Type: text/html, Size: 2483 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: How to display source in ConTeXt?
  2012-11-14  1:04         ` yang.zhao
@ 2012-11-14  1:20           ` Aditya Mahajan
  0 siblings, 0 replies; 10+ messages in thread
From: Aditya Mahajan @ 2012-11-14  1:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 14 Nov 2012, yang.zhao wrote:

> Sorry for font in this mail.
> Back to ConTeXt.
> Now I use vim module, can I change the font of the source display?
> I read the  ~/context/tex/texmf-modules/doc/context/third/vim/vim.txt,
> I search "font" ,there is just  \setupbodyfont. I try this, but dosen't
> work..

Search for style:

\definevimtyping
    [ctyping]
    [style={\switchtobodyfont[small,tt]}]

\starttext
\startctyping
#include <stdio.h>
\stopctyping
\stoptext

Or if you want to globally change the style of all typing environments:

\setupvimtyping
   [style=....]


Also see http://wiki.contextgarden.net/Style_Alternatives

Aditya
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-11-14  1:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-13  9:45 How to display source in ConTeXt? yang.zhao
2012-11-13 10:42 ` Marco Patzer
2012-11-13 12:43   ` yang.zhao
2012-11-13 13:19     ` Martin Schröder
2012-11-13 13:29       ` Pontus Lurcock
2012-11-13 15:41         ` Alan BRASLAU
2012-11-13 14:16       ` Martin Schröder
2012-11-13 16:46       ` Khaled Hosny
2012-11-14  1:04         ` yang.zhao
2012-11-14  1:20           ` Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).