referencing line numbers of a typing environment
I usually present C/C++ code in a typing environment. If I need to frequently reference statements I put a line number environment around that. Now I would like to use line numbers and experimented a bit with \setuptyping[option=commands,escape=/], but did not yet get the desired results. Any hint is welcome Thanks Marko
Marko Schuetz
I usually present C/C++ code in a typing environment. If I need to frequently reference statements I put a line number environment around that. Now I would like to use line numbers and experimented a bit with \setuptyping[option=commands,escape=/], but did not yet get the desired results.
what about this? \starttext \setuptyping[option=commands] \startlinenumbering \starttyping Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse /startline[line:a]molestie, lorem nec tempor condimentum, enim pede sollicitudin /blackrule ante, non mollis est lectus et ligula. Integer at libero. Fusce sagittis magna vel libero. Sed ut quam. /startline[line:b]Sed faucibus purus in sem. Phasellus ut \stoptyping \stoplinenumbering See \inline [line:a] and \inline[line:b] \stoptext Patrick
Patrick,
From: Patrick Gundlach
what about this?
\starttext \setuptyping[option=commands]
\startlinenumbering \starttyping Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse /startline[line:a]molestie, lorem nec tempor condimentum, enim pede sollicitudin /blackrule ante, non mollis est lectus et ligula. Integer at libero. Fusce sagittis magna vel libero. Sed ut quam. /startline[line:b]Sed faucibus purus in sem. Phasellus ut
\stoptyping \stoplinenumbering
See \inline [line:a] and \inline[line:b] \stoptext
Yes, it works. I thought I had tried this, then noticed I had always tested this within my project, product, and environment. Seems there are some interferences... Thank you for the help. Marko
From: Marko Schuetz
Patrick,
From: Patrick Gundlach
Subject: [NTG-context] Re: referencing line numbers of a typing environment Date: Mon, 07 Apr 2003 19:00:10 +0200 [..]
what about this?
\starttext \setuptyping[option=commands]
\startlinenumbering \starttyping Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Suspendisse /startline[line:a]molestie, lorem nec tempor condimentum, enim pede sollicitudin /blackrule ante, non mollis est lectus et ligula. Integer at libero. Fusce sagittis magna vel libero. Sed ut quam. /startline[line:b]Sed faucibus purus in sem. Phasellus ut
\stoptyping \stoplinenumbering
See \inline [line:a] and \inline[line:b] \stoptext
Yes, it works. I thought I had tried this, then noticed I had always tested this within my project, product, and environment. Seems there are some interferences...
It's not my environment... I narrowed it down to this \starttext \setuptyping[option=commands] \starttyping cout << "Test!"; \stoptyping \stoptext This does not work here. TeX stops at a *-prompt. Marko
Just in case anyone else runs into the same problem.
From: Marko Schuetz
It's not my environment...
I narrowed it down to this
\starttext
\setuptyping[option=commands] \starttyping cout << "Test!"; \stoptyping
\stoptext
This does not work here. TeX stops at a *-prompt.
This works: \starttext \def\cout{<<} \setuptyping[option=commands] \starttyping cout /cout "Test"; \stoptyping \stoptext and so does this: \starttext \starttyping cout << "Test"; \stoptyping \stoptext and also this: (where reserve.cpp contains <<) \starttext \setuptyping[option=commands] \typefile{reserve.cpp} \stoptext but this does not work: \starttext \setuptyping[option=commands] \starttyping cout << "Test"; \stoptyping \stoptext Marko
At 16:52 08/04/2003 +0200, you wrote:
Just in case anyone else runs into the same problem.
From: Marko Schuetz
Subject: Re: [NTG-context] Re: referencing line numbers of a typing environment Date: Mon, 07 Apr 2003 20:22:50 +0200 (CEST) It's not my environment...
I narrowed it down to this
\starttext
\setuptyping[option=commands] \starttyping cout << "Test!"; \stoptyping
\stoptext
This does not work here. TeX stops at a *-prompt.
This works:
\starttext \def\cout{<<} \setuptyping[option=commands] \starttyping cout /cout "Test"; \stoptyping \stoptext
and so does this:
\starttext \starttyping cout << "Test"; \stoptyping \stoptext
and also this: (where reserve.cpp contains <<)
\starttext \setuptyping[option=commands] \typefile{reserve.cpp} \stoptext
but this does not work:
\starttext \setuptyping[option=commands] \starttyping cout << "Test"; \stoptyping \stoptext
this is a side effect: option=commands => <> so, in commands mode the << and >> act as braces option=slanted => <<this comes out slanted>> and here it does a font switch. Maybe we need another option -) Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
From: Hans Hagen
this is a side effect:
option=commands =>
<>
so, in commands mode the << and >> act as braces
option=slanted =>
<<this comes out slanted>>
and here it does a font switch.
Ahh, I understand. Thank you.
Maybe we need another option -)
I didn't find the "<< >> as braces" in the docs. IMHO mentioning it in the docs would suffice. Marko
Marko Schuetz
Maybe we need another option -)
Yes, please :) I was playing with this yesterday, but couldn't think of another name. Perhaps options=nogroups disables << and >>?
I didn't find the "<< >> as braces" in the docs. IMHO mentioning it in the docs would suffice.
It is mentioned in the source ;-) and in cont-en?.pdf in chpater 5.8, but under \type{} and not \starttyping Patrick
participants (3)
-
Hans Hagen
-
Marko Schuetz
-
Patrick Gundlach