axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] hyperlinked algebra


From: Ralf Hemmecke
Subject: Re: [Axiom-developer] hyperlinked algebra
Date: Tue, 13 Dec 2005 11:36:10 +0100
User-agent: Thunderbird 1.4 (X11/20050908)

Hi Bill,

I've looked at http://wiki.axiom-developer.org/images/book--main--1/endpaper3.pamphlet

and tried to find something for it.
Would you be satisfied to write something like

Abelian\-SemiGroup

in the LaTeX file instead of

Abelian\nSemiGroup?

If yes, then replace your \newcommand{\digraph}... by the following code.

\newcommand{\digraph}[2][scale=1]{%
\IfFileExists{#2.ps}%
{\includegraphics[#1]{#2}}%
{\fbox{
    \begin{tabular}{l}
      The file \texttt{#2.ps} hasn't been created from
      \texttt{#2.dot} yet.
    \end{tabular}
  }
}
\writedigraph{#2}}

\def\writedigraph#1#2{%
  \newwrite\dotfile
  \immediate\openout\dotfile=#1.dot
  \let\n\relax%define it.
  \expandafter\def\csname -\endcsname{\string\n}
  \immediate\write\dotfile{digraph #1 {#2}}
  \immediate\closeout\dotfile}

It basically does the following.

\digraph[OPTIONS]{FILENAME} checks whether FILENAME.ps is available and includes it. Then it puts \writedigraph{FILENAME} into the queue.

\writedigraph{FILENAME}{VIZGRAPH-STUFF} opens FILENAME.dot for writing,
writes out
  digraph #1 {#2}
to this file and closes the file.
During the write LaTeX commands are expanded. Since \- is defined to expand to the string "\n" you will see that at the .dot file.

Doing the same thing with \n instead of \- would be a bit more complicated. But I think for LaTeX-speakers \- is more natural anyway.

I hope, I made someone happy.

Ralf



Bill Page wrote:
On December 12, 2005 11:38 AM C Y wrote:
...
http://wiki.axiom-developer.org/SandBoxEndPaper/editform
Hmm - I seem to have a problem with my setup - it won't let
me see it.

Well, ah I presume that you at least get the page that says you
must set your name and email address in preferences before you
are allowed access to the edit page, right? Just do that and try
again. It should work.

...
This also makes it impossible at present to include hyperlinks in the graph.
I'll see if I can dig around with graphviz on my machine and
come up with something.

Great. Let me know what you find. So far the most relevant info
I have found is here:

http://www.graphviz.org/doc/info/output.html

Output Formats

ps2
    Produces PostScript output with PDF notations. It is assumed the
output will be directly converted into PDF format. The notations
include PDF bounding box information, so that the resulting PDF file
can be correctly used with pdf tools, such as pdflatex. In addition,
if a node has a URL attribute, this gets translated into PDF code
such that the node, when viewed in a PDF-viewer, e.g., acroread, is
a link to the given URL. If a URL is attached to the graph, this
serves as a base, such that relative URLs on nodes are derived from
it.

-----------

GraphViz can also be used to produce a png file directly. This
should produce a better quality image and would permit the use
of an image map for clickable hyperlinks on nodes and edges. To
do this will require another extension of MathAction to allow a
new pseudo-environment something like this:

\begin{graphviz}
  GraphViz commands including hyperlinks
\end{graphviz}

When clicking 'Save' this would be processed directly by GraphViz to a png graphic with an associated image map for display on the web page.

I said earlier that I wanted to stop doing web application
development and work more on Axiom, but if there is some interest in using GraphViz this way on MathAction, I would be
willing to add this functionality.
The thought that comes first to me is this would be an excellent
option to have if/when we start including these types of diagrams
in pamphlet files - hyperlinked pdf for pdf, image map png for
html.  But I think that's a bit down the road at present.


I haven't done the hyperlinking yet, but you can see what a
pamphlet file that contains GraphViz commands looks like at:

http://wiki.axiom-developer.org/book--main--1/Endpaper3

This contains both the Algebra and Data Structure diagrams (two
versions, one using abbreviations and one using the full category
names).

Right now I am looking into the problem of writing multi-line
labels that would allow me to write for example:

  Homogeneous
  Aggregate

instead of

  HomogeneousAggregate

This would allow the diagram to be narrower and with a larger
font size. The way this is supposed to be written in GraphViz
"dot" language is:

  HomogeneousAggregate [label="Homogeneous\nAggregate"];

but when I write the \n inside the LaTeX file, LaTeX insists
on interpreting this as an undefined command \nAggregate and
gives a LaTeX error instead of just writing it to the '*.dot'
file the way the GraphViz macro says it should. If anyone
know how to get LaTeX to write a string containing \n to a
file, please let me know. Right now I am stuck.

Regards,
Bill Page.




_______________________________________________
Axiom-developer mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/axiom-developer




reply via email to

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