axiom-developer
[Top][All Lists]
Advanced

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

Re: [Axiom-developer] map instead of map! in src/doc/book.pamphlet


From: Ralf Hemmecke
Subject: Re: [Axiom-developer] map instead of map! in src/doc/book.pamphlet
Date: Fri, 17 Nov 2006 18:40:18 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20061025)



On 11/16/2006 11:47 PM, Vanuxem Grégory wrote:
Le jeudi 16 novembre 2006 à 23:04 +0100, Ralf Hemmecke a écrit :
On 11/16/2006 10:38 PM, Vanuxem Grégory wrote:
Hello,

A small typo in the Axiom book:

--- /home/greg/TDevel/cvs/axiom/src/doc/book.pamphlet
+++ src/doc/book.pamphlet
@@ -48550,7 +48548,7 @@
 \returnType{Type: TwoDimensionalArray Integer}
To change the array destructively, use
-\spadfunFrom{map}{TwoDimensionalArray} instead of
+\spadfunFrom{map!}{TwoDimensionalArray} instead of
 \spadfunFrom{map}{TwoDimensionalArray}.  If you need to make a copy of
 any array, use \spadfunFrom{copy}{TwoDimensionalArray}.


Beware I don't know what \spadfunFrom does.
I don't know either, but src/hyper/pages/util.ht says the stuff below...

Obviously, there are a lot of commands that look pretty much like LaTeX. But I guess, hypertex code is not really processed by THE TeX so what language is that actually? And any chance that there is a bit more documentation than that given in util.ht?

It seems that you didn't see that book.pamphlet is a LaTeX book (THE
Axiom book :-) (\spadfunFrom is a LaTeX macro here). I use \spadfunFrom
for Hyperdoc and I like it though it processes incorrectly function
ending with a number (no link are generated).

Ooops. I am really blind... :-( Thanks for telling me the obvious.

>>> Beware I don't know what \spadfunFrom does.

OK, then let's look at it.

% spadfunFrom records the function name and domain in the index
\newcommand{\spadfunFrom}[2]{{\bf #1}\index{#1 @\begingroup \string\it{} #1 \endgroup}\index{#2}}

From that one sees the intension. You write something like

\spadfunFrom{name}{Type}

prints "name" in the text and also puts two entries into the index. Namely "name" and "Type".

Now when I saw that you replaced "map" by "map!" I thought that must be wrong... But no, there are already other things in book.pamphlet that look like \spadfunFrom{concat!}{List}$(u,v)$. Oh, but then clearly the definition of \spadfunFrom is wrong. It does not consider the case that the exclamation mark is a special character for makeindex. Unfortunately, LaTeX, makeindex, bibtex are not totally compatible. The exclamation mark is used by makeindex to introduce subindices. So it must be escaped by " if it is part of the actual text.

Given that error, you will realize that the index in the Axiom-Book (at least in bookvol1.dvi) is wrong (or if you don't consider it wrong, it is at least ugly).

In order to show that at a small example and also to give a remedy for it I have created the file below where I check for ! (but only at the end of the word) and replace it by "!. In particular look what I did with the second \index entry and how that appears in the index.

Replace \iffalse by \iftrue and investigate the differences in the .dvi file.

Have fun!

Ralf

%%%BEGIN spadfunFrom.tex
\documentclass{article}
\usepackage{makeidx}
\makeindex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Replace \iffalse by \iftrue and call ...
% latex spadfunFrom.tex
% makeindex spadfunFrom
% latex spadfunFrom.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\iftrue
\iffalse
\usepackage{hyperref}
\usepackage{color}

\makeatletter
address@hidden@name#1{\expandafter\rhx@@address@hidden
\def\rhx@@address@hidden
  \ifx\\#2\\%
    \edef\rhx@@indexlabel{#1}%
    \edef\rhx@@indextext{#1}%
  \else
    \edef\rhx@@indexlabel{#1"!}%
    \edef\rhx@@indextext{#1"!}%
  \fi
}
\newcommand{\spadfunFrom}[2]{%
  address@hidden@name{#1}%
  \spadfunTextStyle{#1}%
  \index{\rhx@@indexlabel
    @\protect\spadfunIndexStyle{\rhx@@indextext}%
    !\protect\spadTypeIndexStyle{#2}}%
  \index{#2%
    @\protect\spadTypeIndexStyle{#2}%
    !\protect\spadfunIndexStyle{\rhx@@indextext}}%
}

\def\spadfunTextStyle#1{\textcolor{blue}{\textbf{#1}}}
\def\spadfunIndexStyle#1{\textcolor{red}{#1}}
\def\spadTypeIndexStyle#1{\textcolor{blue}{\textsf{#1}}}
\makeatother

\else %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% spadfunFrom records the function name and domain in the index
\newcommand{\spadfunFrom}[2]{{\bf #1}\index{#1 @\begingroup \string\it{} #1 \endgroup}\index{#2}}

\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

While these operations are common, others such as
\spadfunFrom{odd?}{Integer} and \spadfunFrom{bit?}{Integer} are not.
In addition the Exports section can contain symbols that represent
properties that can be tested. For example, the Category

The operation \spadfunFrom{concat!}{List}$(u,v)$ replaces the
last link of the list $u$ to point to some other list $v$.
Since $u$ refers to the original list, this change is seen by $u$.


To change the array destructively, use
\spadfunFrom{map}{TwoDimensionalArray} instead of
\spadfunFrom{map!}{TwoDimensionalArray}.  If you need to make a copy of
any array, use \spadfunFrom{copy}{TwoDimensionalArray}.
\newpage

To change the array destructively, use
\spadfunFrom{map}{TwoDimensionalArray} instead of
\spadfunFrom{map!}{TwoDimensionalArray}.  If you need to make a copy of
any array, use \spadfunFrom{copy}{TwoDimensionalArray}.

To change the array destructively, use
\spadfunFrom{map}{OneoDimensionalArray} instead of
\spadfunFrom{map!}{OneDimensionalArray}.  If you need to make a copy of
any array, use \spadfunFrom{copy}{TwoDimensionalArray}.

\printindex

\end{document}
%%%END spadfunFrum.tex





reply via email to

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