[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] Re: [Axiom-mail] Re: noweb
From: |
Ralf Hemmecke |
Subject: |
[Axiom-developer] Re: [Axiom-mail] Re: noweb |
Date: |
Fri, 11 Aug 2006 23:50:33 +0200 |
User-agent: |
Thunderbird 1.5.0.5 (X11/20060719) |
| \begin{chunk}{MyCode} % The chunkname should not be optional!!
| false
| \end{chunk}
|
| \begin{chunk}{MyChunk} % The chunkname should not be optional!!
| apply(x: Boolean, y: Boolean): Boolean == x and y;
| (x: Boolean)/(y: Boolean): Boolean == x and y;
| MyCode: Boolean == true;
| use: Boolean := true;
| b: Boolean := MyCode /\ use/\use {MyCode} % How should that be parsed???
| \end{chunk}
| Doing that kind of programming in TeX is extremely difficult, since in
| one place \ must be taken literally and in another it is considered as
| a character that starts commands. If you want the code also reasonably
| readable as a LaTeX source, I don't think that going the LaTeX way is
| the right choice.
Is this issue similar to that the package fancyvrb faces?
I haven't used fancyvrb, so I am not completely sure whether my
reasoning is correct. But I have looked into the verbatim package.
You'll probably believe that there are quite some tricks to recognise
the \end{verbatim} in a stream of characters that TeX is actually
supposed to output literally.
I bet even fancyvrb cannot correctly do a line like
b: Boolean := MyCode /\ use/\use {MyCode}
You could write
\begin{Verbatim}[commandchars=\\\{\}]
b: Boolean := MyCode /\ use/\use {MyCode}
\end{Verbatim}
That would probably correctly expand "\use {MyCode}", but the backslash
after / is followed by a space and thus is expanded to output a space
character. So in the output you would probably see something like
b: Boolean := MyCode / use/<MyCode>
where I wanted
b: Boolean := MyCode /\ use/<MyCode>
One must escape the first \ somehow in such a case. Doable, but it makes
the code harder to read.
Of course you could write
\begin{Verbatim}[commandchars=|\{\}]
b: Boolean := MyCode /\ use/|use {MyCode}
\end{Verbatim}
and it would come out nicely, but then you have to make the
corresponding tangle command a bit smarter to recognise | as the
character that introduces TeX commands inside that Verbatim environment.
Anyway, fancyvrb seems to be quite smart, even though it does not solve
the problem that in the output of the above code I would like see
"Boolean" turn into a hyperlink to the definition of Boolean.
Fortunately, the documentation of fancyvrb refers to the listings
package for doing such fancy "pretty printing". But I have not yet
looked into listings more closely.
Ralf
- [Axiom-developer] RE: [Axiom-mail] Re: noweb, Page, Bill, 2006/08/08
- [Axiom-developer] Re: [Axiom-mail] Re: noweb,
Ralf Hemmecke <=
- [Axiom-developer] Re: [Axiom-mail] Re: noweb, Ralf Hemmecke, 2006/08/14
- [Axiom-developer] Re: [Axiom-mail] Re: noweb, Gabriel Dos Reis, 2006/08/14
- [Axiom-developer] Re: [Axiom-mail] Re: noweb, Ralf Hemmecke, 2006/08/14
- [Axiom-developer] Re: [Axiom-mail] Re: noweb, root, 2006/08/14
- [Axiom-developer] Re: [Axiom-mail] Re: noweb, Gabriel Dos Reis, 2006/08/14
- [Axiom-developer] Re: [Axiom-mail] Re: noweb, root, 2006/08/14
- [Axiom-developer] Re: [Axiom-mail] Re: noweb, Gabriel Dos Reis, 2006/08/14
- [Axiom-developer] Re: [Axiom-mail] Re: noweb, root, 2006/08/14
- [Axiom-developer] Re: [Axiom-mail] Re: noweb, Gabriel Dos Reis, 2006/08/14