On 11/02/2015 12:40 PM, Alasdair McAndrew wrote:
> Many thanks - I did in fact have a look through those pages. But they seem
> more geared to producing stand-alone hypertex files. What I was hoping to
> find was how to format text on lines starting with ++ in a spad file.
Most interesting is perhaps the part from
util.ht that I give below.
https://github.com/fricas/fricas/blob/master/src/doc/ht/util.ht
BUT... I shouldn't recommend this. Personally, I'd rather want
reStructuredText in ++ docstrings. It would be much more readable
(although it probably won't work together with HyperDoc).
All this LaTeX-looking stuff is not handled by TeX, but by an adhoc
program in FriCAS. One can do basic things but not fancy LaTeX stuff.
As I said normally people learn from other .spad files. This is highly
unsatisfactory, because errors my easily be propagated. But I don't know
of any better way to learn how to write ++ docstrings.
Ralf
==================================================================
% use this for syntax punctuation: \spadSyntax{::}
\newcommand{\spadSyntax}[1]{``{\tt #1}''}
% constructors
\newcommand{\spadtype}[1]{\lispdownlink{#1}{(|spadType| '|#1|)}}
\newcommand{\nonLibAxiomType}[1]{{\it #1}} % things that browse
can't handle
\newcommand{\pspadtype}[1]{\nonLibAxiomType{#1}}
\newcommand{\spad} [1]{{\tt #1}} % note font
\newcommand{\spadvar} [1]{\spad{#1}} % exists in ++ comments;
to be removed
\newcommand{\s} [1]{\spad{#1}}
\newcommand{\httex}[2]{#1}
\newcommand{\texht}[2]{#2}
% Function names:
%
% The X versions below are used because AXIOM function names that end
% in ``!'' cause problems for makeindex for had-copy.
%
% Example: \spadfunFromX{reverse}{List} prints as reverse!
%
% In the "From" versions, the first arg is function name, second is
constructor
% where exported.
%
% Use the "op" flavors of "-", "+", "*" etc, otherwise the "fun" flavors
\newcommand{\userfun} [1]{{\bf #1}} % example, non-library
function names
\newcommand{\fakeAxiomFun}[1]{{\bf #1}} % not really a library
function
\newcommand{\pspadfun} [1]{\fakeAxiomFun{#1}}
\newcommand{\spadfun} [1]{\lispdownlink{#1}{(|oPage| '|#1|)}}
\newcommand{\spadfunX}[1]{\spadfun{#1!}}
\newcommand{\spadfunFrom}[2]{\lispdownlink{#1}{(|oPageFrom| '|#1| '|#2|)}}
\newcommand{\spadfunFromX}[2]{\spadfunFrom{#1!}{#2}}
\newcommand{\spadop} [1]{\lispdownlink{#1}{(|oPage| '|#1|)}}
\newcommand{\spadopFrom}[2]{\lispdownlink{#1}{(|oPageFrom| '|#1| '|#2|)}}
% redundant defns for system commands
\newcommand{\syscom}[1]{\lispdownlink{)#1}{(|syscomPage| '|#1|)}}
%
\newcommand{\spadsyscom}[1]{{\tt #1}}
\newcommand{\spadcmd}[1]{\spadsyscom{#1}}
\newcommand{\spadsys}[1]{\spadsyscom{#1}}
% Following macros should be phased out in favor of ones above:
\newcommand{\gloss}[1]{\spadgloss{#1}}
\newcommand{\spadglos}[1]{\spadgloss{#1}}
\newcommand{\glossSee}[2]{\spadglossSee{#1}{#2}}