Skip to content

Commit

Permalink
generate book.pdf with postscript files
Browse files Browse the repository at this point in the history
  • Loading branch information
hemmecke committed Jun 18, 2024
1 parent fbea5d9 commit 46df998
Show file tree
Hide file tree
Showing 15 changed files with 183 additions and 246 deletions.
76 changes: 46 additions & 30 deletions src/doc/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#------------------------------------------------------------------
#---
#--- FriCAS
#--- Copyright (C) 2013, 2014, 2020 Ralf Hemmecke <[email protected]>
#--- Copyright (C) 2013, 2014, 2020, 2024 Ralf Hemmecke <[email protected]>
#--- Copyright (C) 2024 Qian Yun <[email protected]>
#---
#------------------------------------------------------------------
# The main targets of this Makefile are "all" and "doc".
# Other useful targets are "localdoc", "book.pdf", "stamp-html".
# Other useful targets are "localdoc", "book.pdf", "stamp-html", "viewports".

# Whereas "all" is made during normal FriCAS build, "doc" must be
# invoked separately.
Expand Down Expand Up @@ -46,7 +47,7 @@
#
# "make book.pdf" does the following:
# - Copy pictures from the ps/ directory for (documentation of HyperDoc).
# - Copy pictures from tmp/*.VIEW/image.ps (target stamp-pics).
# - Copy pictures from tmp/*.VIEW/image.ps (target stamp-book-viewports).
# - Generate tmo/ug09.tex with the list of examples.
# - Create tmp/*.input from htex/*.htex (target ${HTEX_FILES_INPUT}).
# The .input files contain the commands that should be executed.
Expand All @@ -56,6 +57,10 @@
# tmp/*.spool files (target ${HTEX_FILES_SPOOL}).
# - Turn the tmp/*.spool files into tmp/*.tex files (target ${HTEX_FILES_TEX}).
# - Create tmp/info.tex with version information.
# - Create tmp/vp-*.input files by prepending ")assert CreateGraphics"
# to tmp/*.input files for .htex files that contain \spadgraph commands.
# - Run the tmp/vp-input files through fricas (target ${HTEX_VIEWPORTS_STAMP})
# in order to produce the postscript pictures for the book.
# - LaTeX book.tex, call makeindex, and re-latex to get references right.
# - Convert book.dvi to book.ps.
# - Convert book.ps to book.pdf.
Expand Down Expand Up @@ -252,11 +257,16 @@ GEN_HTFILES = xmpexp coverex gloss
# The reason for this delayed execution is that generation of the .xpm
# files in *.VIEW/ without the xvfb-run program will pop up image
# windows in X and will make working during compilation impossible.
VIEWPORTFILES = coverex \
$(shell grep -lRe 'graphpaste{\|spadgraph{' ${srcdir}/ht/* ${srcdir}/htex/* \
HT_VIEWPORTFILES = coverex \
$(shell grep -lRe '^\\graphpaste{' ${srcdir}/ht/* \
| sed 's,.*/,,;s,\..*,,' \
| grep -v util \
| sort)
| sort -u)
# HTEX_VIEWPORTFILES is also used in stamp-book-viewports.
HTEX_VIEWPORTFILES = \
$(shell grep -lRe '^\\spadgraph{' ${srcdir}/htex/* \
| sed 's,.*/,,;s,\..*,,' \
| sort -u)
VIEWPORTFILES = ${HT_VIEWPORTFILES} ${HTEX_VIEWPORTFILES}
# This should give
# VIEWPORTFILES = coverex explot2d explot3d graphics SEGBIND \
# ug00 ug01 ug07 ug08 ug10 ug11
Expand All @@ -267,11 +277,8 @@ VIEWPORTFILES = coverex \
# that do contain "paste" commands, i.e., for which .pht files must be
# generated.
HT_PASTEFILES = \
$(shell grep -R '\\\(graph\|spad\)paste{' ${srcdir}/ht/*.ht \
| sed 's/%.*//' \
| grep 'paste{' \
| sed 's,.*/ht/,,;s,\.ht:.*,,' \
| grep -v util \
$(shell grep -lRe '^\\\(graph\|spad\)paste{' ${srcdir}/ht/*.ht \
| sed 's,.*/,,;s,\..*,,' \
| sort -u)
# This should give
# HT_PASTEFILES = exdiff exint exlap exlimit exmatrix explot2d explot3d \
Expand All @@ -282,10 +289,8 @@ HT_PASTEFILES = \
# and \graphpaste, respectively, in the .ht file during generation via
# ht.awk.
HTEX_PASTEFILES = \
$(shell grep -R '\\spad\(command\|graph\){' ${srcdir}/htex/*.htex \
| sed 's/%.*//' \
| grep '\\spad\(command\|graph\){' \
| sed 's,.*/htex/,,;s,\.htex:.*,,' \
$(shell grep -lRe '^\\spad\(command\|graph\){' ${srcdir}/htex/*.htex \
| sed 's,.*/,,;s,\..*,,' \
| sort -u)

###################################################################
Expand All @@ -294,8 +299,12 @@ HTEX_PASTEFILES = \
# HyperDoc and book.pdf.
# The list can be generated by the following command.
# grep -R '\\spadcommand{)read' *| sed 's/[^ ]* //;s/[ \].*//'|sort -u
# Additionally there are ntube, tknot, images1, and knot3 that
# generate more .ps files for their use in the book.
# All these files are going to be generated from the sources in the
# .htex files in a future release of FriCAS.
INPUT_EXTRA = arrows bouquet newton ribbon vectors \
ntube tknot images1 ug-pics
ntube tknot images1 knot3

###################################################################
# For these files .ht files will be generated.
Expand Down Expand Up @@ -507,7 +516,7 @@ mobius.VIEW: ${inputsrcdir}/mobius.input
# is set. This is supposed to be done through configure.ac.
# The copy command should actually appear during the "copy-to-target"
# below, but it would needlessly complicate this Makefile.
viewports: ${GEN_VIEWPORTFILES_PHT} mobius.VIEW
viewports: ${GEN_VIEWPORTFILES_PHT} mobius.VIEW stamp-book-viewports
${MKDIR_P} ${viewportstargetdir}
cp -r *.VIEW ${viewportstargetdir}
${STAMP} $@
Expand Down Expand Up @@ -627,7 +636,7 @@ HTEX_FILES = $(HTEX_UGCHAPTERS) $(HTEX_EXAMPLES)
HTEX_FILES_INPUT = $(patsubst %, tmp/%.input, ${HTEX_FILES})
${HTEX_FILES_INPUT}: tmp/%.input: ${htexsrcdir}/%.htex
${MKDIR_P} tmp
${HTEX2INPUT} $< | ${AWK} -f ${srcdir}/skip-graphics.awk > $@
${HTEX2INPUT} $< > $@

HTEX_FILES_SPOOL = ${patsubst %, tmp/%.spool, ${HTEX_FILES}}
${HTEX_FILES_SPOOL}: tmp/%.spool: tmp/%.input
Expand Down Expand Up @@ -657,21 +666,28 @@ PS_FILES_PS = ${patsubst %, %.ps, ${PS_FILES}}
${PS_FILES_PS}: %.ps: ${pssrcdir}/%.ps
cp $< $@

HTEX_PICS = SEGBIND ug00 ug01 ug07 ug08 ug10 ug11
HTEX_PICS_INPUT = ${patsubst %, tmp/pics-%.input, ${HTEX_PICS}}
${HTEX_PICS_INPUT}: tmp/pics-%.input: ${htexsrcdir}/%.htex
# Note that one tmp/vp-*.input file may produces several postscript
# files.
HTEX_VIEWPORTS_INPUT = ${patsubst %, tmp/vp-%.input, ${HTEX_VIEWPORTFILES}}
HTEX_VIEWPORTS_STAMP = ${patsubst %, tmp/stamp-%, ${HTEX_VIEWPORTFILES}} \
tmp/stamp-knot3

${HTEX_VIEWPORTS_INPUT}: tmp/vp-%.input: tmp/%.input
${MKDIR_P} tmp
${HTEX2INPUT} $< > $@
(echo ")assert CreateGraphics"; cat $<) > $@

tmp/vp-knot3.input: knot3.input ${INPUT_EXTRA_INPUT}
cp $< $@

${HTEX_VIEWPORTS_STAMP}: tmp/stamp-%: tmp/vp-%.input
unset DAASE; FRICAS=${FRICAS}; export FRICAS; \
echo ")read $@" | FRICAS_INITFILE='' ${XVFB} \
echo ")read $<" | FRICAS_INITFILE='' ${XVFB} \
${FRICAS}/bin/fricas -noht -noclef > /dev/null
${STAMP} $@

stamp-pics: ${INPUT_EXTRA_INPUT} ${HTEX_PICS_INPUT} ${PS_FILES_PS}
(unset DAASE; FRICAS=${FRICAS}; export FRICAS; \
echo ')read ug-pics' | FRICAS_INITFILE='' ${XVFB} \
${FRICAS}/bin/fricas -noht -noclef)
stamp-book-viewports: ${HTEX_VIEWPORTS_STAMP} ${PS_FILES_PS}
for f in tmp/*.VIEW/image.ps; do \
cp $$f `echo $$f | cut -d / -f 2 | cut -d . -f 1`.ps; \
cp $$f `echo $$f | sed 's,tmp/\(.*\)\.VIEW/image,\1,'`; \
done
${STAMP} $@

Expand Down Expand Up @@ -704,7 +720,7 @@ tmp/info.tex:
# Convince latex to abort on error.
LATEX=latex -halt-on-error -file-line-error -interaction=nonstopmode

book.dvi: stamp-pics tmp/ug09.tex tmp/info.tex ${HTEX_FILES_TEX}
book.dvi: stamp-book-viewports tmp/ug09.tex tmp/info.tex ${HTEX_FILES_TEX}
TEXINPUTS=$$TEXINPUTS:${srcdir}:tmp:. ${LATEX} book.tex \
|| (echo "==> Detected problem while running LaTeX."; \
echo "==> LaTeX must be installed."; \
Expand Down
2 changes: 0 additions & 2 deletions src/doc/fricas.sty
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
% and Robert Sutor for the FriCAS system.

\usepackage{graphicx}
\def\epsffile[#1]#2{\begin{center}\includegraphics[height=.24\textheight]{#2}\end{center}}

\usepackage{fricasmath}
\usepackage{verbatim} % Needed for the discard environment.
\usepackage{hyperref}
Expand Down
1 change: 0 additions & 1 deletion src/doc/ht/util.ht
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ The page you requested was not found in the \HyperName{} database.
\newcommand{\ell}{\inputbitmap{\htbmdir{}/ell.bitmap}}
\newcommand{\emptyset}{\inputbitmap{\htbmdir{}/emptyset.bitmap}}
\newcommand{\epsilon}{\inputbitmap{\htbmdir{}/epsilon.bitmap}}
\newcommand{\epsffile}{}
\newcommand{\eta}{\inputbitmap{\htbmdir{}/eta.bitmap}}
\newcommand{\exists}{\inputbitmap{\htbmdir{}/exists.bitmap}}
\newcommand{\forall}{\inputbitmap{\htbmdir{}/forall.bitmap}}
Expand Down
9 changes: 2 additions & 7 deletions src/doc/htex/SEGBIND.htex
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ syntax for arguments to certain operations.
}{
\spadcommand{sum(i^2, i = 0..n)}
}
\begin{htonly}
\spadgraph{draw(x^2, x = -2..2)}
\end{htonly}
\begin{texonly}

\psXtc{
The \spadfun{draw} operation uses a \spadtype{SegmentBinding}
argument as a range of coordinates.
Expand All @@ -60,10 +57,8 @@ other \spadfun{draw} options use more than one
}{
\spadgraph{draw(x^2, x = -2..2)}
}{
% window was 256 x 256
\epsffile[72 72 300 300]{SEGBIND.ps}
SEGBIND
}
\end{texonly}

\xtc{
The left-hand side must be of type \spadtype{Symbol} but the
Expand Down
2 changes: 1 addition & 1 deletion src/doc/htex/ug00.htex
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Draw \texht{$J_0(\sqrt{x^2+y^2})$}{\spad{J_0(sqrt(x^2+y^2))}} for
}{
\spadgraph{draw(5*besselJ(0,sqrt(x^2+y^2)), x=-20..20, y=-20..20)}
}{
\epsffile[0 0 295 295]{bessintr.ps}
bessintr
}

Graphs in \Language{} are interactive objects you can manipulate with
Expand Down
6 changes: 2 additions & 4 deletions src/doc/htex/ug01.htex
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,7 @@ This PostScript image was produced by clicking on the
}{
\spadgraph{draw(cos(5*t/8), t=0..16*\%pi, coordinates==polar)}
}{
% window was 256 x 256
\epsffile[0 0 300 324]{rose-1.ps}
rose-1
}

\psXtc{
Expand All @@ -690,8 +689,7 @@ of \Language{}'s numeric and graphics capabilities.
}{
\spadgraph{draw((x,y) +-> real atan complex(x,y), -\%pi..\%pi, -\%pi..\%pi, colorFunction == (x,y) +-> argument atan complex(x,y))}
}{
% window was 256 x 256
\epsffile[72 72 285 285]{atan-1.ps}
atan-1
}

An exhibit of \Gallery{} is given in the
Expand Down
Loading

0 comments on commit 46df998

Please sign in to comment.