ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* typing questions
@ 2005-04-19 17:14 Peter Münster
  2005-04-20  8:56 ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Münster @ 2005-04-19 17:14 UTC (permalink / raw)


Hello,
here a few questions about typing:

- Is there a module for pretty-printing C-code?

- How could I change the tabulator-width?

- First tab is only 7 spaces, the other 8, why?

- How could I embed ConTeXt macros?

- Where does the vertical space in \framed come from?

Some of these questions are illustrated in the following example:

\starttext
\starttyping
void test()
{
12345678 the first characters of the next lines are tabulations
	int i;
	for(i = 0; i < 10; i++)
		do_something();
1234567812345678
Here I would like to \embed{ some context-code }
}
\stoptyping

\framed[align=lohi,
  top=\vskip-1.8\baselineskip,bottom=\vskip-0.8\baselineskip]{%
\starttyping
Why do we need special top and bottom options?
type type type
type type type
\stoptyping
}
\stoptext

Thanks in advance for any help!
Cheers, Peter

-- 
http://pmrb.free.fr/contact/

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

* Re: typing questions
  2005-04-19 17:14 typing questions Peter Münster
@ 2005-04-20  8:56 ` Taco Hoekwater
  2005-04-28 11:44   ` Nikolai Weibull
  2005-05-14 16:02   ` Peter Münster
  0 siblings, 2 replies; 4+ messages in thread
From: Taco Hoekwater @ 2005-04-20  8:56 UTC (permalink / raw)




Peter Münster wrote:
> Hello,
> here a few questions about typing:
> 
> - Is there a module for pretty-printing C-code?

None that I know of, if anybody has a solution, I am
interested myself as well

> - How could I change the tabulator-width?

   \chardef\spacespertab=1 % \t will now become *two* spaces,
                           % default is 7, making 8 spaces

> - First tab is only 7 spaces, the other 8, why?

Looks like a bug, try this patch:

   \def\doprocesstabskipline#1%
     {\bgroup
      \scratchcounter0 % TH: was \plusone
      \dodoprocesstabskipline#1\relax
      \egroup}

> - How could I embed ConTeXt macros?

   \setuptyping[option=commands] % enable commands

   \starttyping
   Here I would like to /BTEX \italic{some context-code} /ETEX
   \stoptyping


> - Where does the vertical space in \framed come from?

 From a bug in \startpacked. Sorry, I don't know how to fix
that without breaking other stuff.

Greetings,

Taco

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

* Re: typing questions
  2005-04-20  8:56 ` Taco Hoekwater
@ 2005-04-28 11:44   ` Nikolai Weibull
  2005-05-14 16:02   ` Peter Münster
  1 sibling, 0 replies; 4+ messages in thread
From: Nikolai Weibull @ 2005-04-28 11:44 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 757 bytes --]

Taco Hoekwater, April 20:

> Peter Münster wrote:

> > Is there a module for pretty-printing C-code?

> None that I know of, if anybody has a solution, I am interested myself
> as well

I wrote one a while ago.  It's not great, but it works quite well.  It
even processes preprocessor directives correctly, albeit a bit
hackishly.  It's not too fun working with the verbatim code, though.
It's a bit restrictive in what can be done.

Anyway, I've attached it here.  Perhaps we can make something standard
of it?,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

[-- Attachment #2: verb-c.tex --]
[-- Type: application/x-tex, Size: 13304 bytes --]

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: typing questions
  2005-04-20  8:56 ` Taco Hoekwater
  2005-04-28 11:44   ` Nikolai Weibull
@ 2005-05-14 16:02   ` Peter Münster
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Münster @ 2005-05-14 16:02 UTC (permalink / raw)


On Wed, 20 Apr 2005, Taco Hoekwater wrote:

> > - First tab is only 7 spaces, the other 8, why?
> 
> Looks like a bug, try this patch:
> 
>    \def\doprocesstabskipline#1%
>      {\bgroup
>       \scratchcounter0 % TH: was \plusone
>       \dodoprocesstabskipline#1\relax
>       \egroup}

Hello,
thanks, Taco. Will this patch be integrated in the next ConTeXt version?

> > - Where does the vertical space in \framed come from?
> 
>  From a bug in \startpacked. Sorry, I don't know how to fix
> that without breaking other stuff.

Does some other person know, how to fix this?

Greetings, Peter

-- 
http://pmrb.free.fr/contact/

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

end of thread, other threads:[~2005-05-14 16:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-19 17:14 typing questions Peter Münster
2005-04-20  8:56 ` Taco Hoekwater
2005-04-28 11:44   ` Nikolai Weibull
2005-05-14 16:02   ` Peter Münster

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).