new TexFormat (outputs LaTeX)

The .spad file is a literate document and can be turned into
a .tex file by the following awk script.

Usage: awk -f totex.awk tex.spad > tex.tex

--- totex.awk
/^)abb[a-z]* / && abbrev_seen==0 {abbrev=$0; abbrev_seen=1; next}

/^$/ {emptyline++; next}

/^)if LiterateDoc/ {
    if (open_code) {print "\\end{spadcode}"; open_code=0}
    while (emptyline>0) {print ""; emptyline--}
    open_literal=1
    open_code=0
    next
}

/^)endif/ {
    if (!open_literal) {print; next}
    open_literal=0
    open_code=1
    # swallow the following empty lines and only output something if
    # there is a non-empty line following.
    while (getline > 0) {
        if ($0 != "") {
            while (emptyline>0) {print ""; emptyline--}
            print "\\begin{spadcode}"
            if (abbrev) {print abbrev; abbrev=""}
            print
            next
        }
        emptyline++
    }
    # coming here means EOF or error in reading
    next
}

{
    while (emptyline>0) {print ""; emptyline--}
    print
}
test code for new TexFormat domain

cd fricas
echo ")read src/input/textest.input" \
  | fricas -nosman \
  | perl tftextest.pl > textest.tex
TEXINPUTS=src/doc/:$TEXINPUTS pdflatex textest.tex
fix efricas for new TexFormat and fricasmath environment