axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Pamphlet files and Axiom


From: C Y
Subject: Re: [Axiom-developer] Pamphlet files and Axiom
Date: Sat, 21 Jul 2007 11:52:55 -0700 (PDT)

--- Stephen Wilson <address@hidden> wrote:
> > But do the sequences << followed by >> occur on the same line in
> > source code often?  That is the only possibility that would require
> > an escape.
> 
> Yes.  Particularly in C and C++ where these sequences are used for
> logical shifts.

And you think such events would be sufficiently common to merit going
away from them as tags for references?

> I considered the `full form' parsing rule, requiring that both paired
> delimiters are required to activate the sequence.  But I rejected it
> because it was not very consistent.  I prefer simple rules which
> would treat both this line containing the << and >> pair as being
> active, as opposed to this line with just one <<.

Hmm.  I'll have to try out your solution and see how it works.

> > Out of curosity, can you think of an example use of << in Spad or
> > Aldor that would cause cl-web in its current form to make a
mistake? 
> 
> I havent tried to break cl-web in this case.  If you want me to I can
> give it a go :)

Don't worry about it if it would distract you from your tool.  I just
want us to decide on how to write pamphlets so we can start writing
said pamphlets.
 
> > Does this mean the document must begin with an @ symbol?
> 
> No.  In my code the `mode' is a documentation chunk at the start.
> However, if you do not start your document with an @ sign, then the
> first chunk is interpreted as a prelude, which is to contain latex
> commands to appear before \begin{document} is (automatically)
> inserted.

Hmm. OK.

> > OK.  Does this mean you are working only off of these rules and not
> > altering your parsing rules inside a chunk body?
> 
> Im not sure I understand your question.  Could you elaborate?

In cl-web, the only time the << >> combination has significance to the
scanner is inside a code chunk.  In documentation, it has no unusual
significant at all.

> > OK.  I think I understand what you are doing.  You are deliberately
> > making chunk references the same in both document and code, and
> > only treating them differently based on environment in the tangle
> > step?
> 
> Correct.

I'm curious when you plan to refer to code chunks in documentation. 
Thus far most of the references I've made are from chunk to chunk. 

> I considered that but the weave stage generates the label references
> automatically for you, so unless you have a sixth sense about such
> things, you cannot predict what the tag might be.

I just used the chunk name as the label name in LaTeX, so a
\ref{chunkname} would work every time.
 
> Note that one of the main reasons of automatically defining the
> labels is to enable chunk names to contain LaTeX, which cannot
> be used as the label used to target the hyperlinks.   I like being
> able to say:
> 
>    @<The \texttt{WEAVE} command@>= ....

Erm.  That didn't occur to me.  I always viewed simple non-LaTeX chunk
names as sufficient.
 
> > Again out of curiosity, can you propose a scenario in the cl-web
> > context that would require any character escaping?
> 
> Sure, give the following code a try:
> 
>   <<chunk>>=
>     (defun hello-world () (format t "Hello World!")
>   @
> 
> You wont get the `!' typeset, as its active.  Try replacing the
> string with "!\LaTeX!" and see what happens.

In cl-web, they both come out literally as they went in.  Isn't that
desired behavior?

\index{chunk}
\begin{lstlisting}[caption={chunk}, label=chunk, escapeinside={(s*t@ }{
@e*t)}]
    (defun hello-world () (format t ""!\LaTeX!"")
\end{lstlisting}


\index{chunk}
\begin{lstlisting}[caption={chunk}, label=chunk, escapeinside={(s*t@ }{
@e*t)}]
    (defun hello-world () (format t "Hello World!")
\end{lstlisting}

> Hey, you already have that feature in cl-web :)

Only as an automatic part of the weave process itself.  
 
> Seriously though, I would use the feature to typeset comments without
> needing to teach the tool what characters introduce comments and have
> it do the escape to latex for me.

So you want LaTeX typset comments inside the source code chunks? 
 
> I dont follow.  I meant that <<chunkname>>[latex=true] would be an
> escape to latex.

Oh, we're on different pages.  I ment
<<chunkname>>[lisp]=
lisp code
@

<<chunkname>>[latex]
latex documentation
@

With the idea that Axiom could ask for the LaTeX documentation
associated with chunkname.

> Note the ambiguity.  I used the string "chunkname"
> to indicate that in the two contexts it has a different
> interpretation, not quite what you would expect.

I may be missing something.  From my standpoint, the user will never
expect to have anything inside a source chunk typeset except what the
weave command itself automatically generates by redoing weave
references.  The author escaping to LaTeX themselves is a non-issue -
it would never be done.

> Well, I have played with @( to be an mechanism to escape into lisp.
> So if I write:
> 
>              "@((format t "HI!~%")@) 
> 
> Then when tangle or weave is called, and the form exists in a chunk
> they process, the programs will print "HI!".

OK, I think you are using escapes differently from how I'm thinking
about them.  I'd better wait for your code - I seem to be stuck in a
more narrow view of how I want pamphlets to work.
 
Cheers,
CY


       
____________________________________________________________________________________
Need a vacation? Get great deals
to amazing places on Yahoo! Travel.
http://travel.yahoo.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]