📚 The CoCalc Library - books, templates and other resources
License: OTHER
#! /bin/bash12# Sage and Linear Algebra Worksheets #3# Robert A. Beezer #4# Copyright 2017 License: CC BY-SA #5# See COPYING for more information #67# Sage for Linear Algebra worksheets8#9# History10#11# 2017-01-12 Initiated1213##############14# Instructions15##############1617# 1. Make this script executable18# 2. Check prerequisite binaries below1920# Prerequisite binaries/executables21# $ which <name> will return path if available22#23# install24# xsltproc25# A LaTeX installation26# texfot - utility to restrict output27# xelatex - preferable for Unicode characters28# MathBook XML distribution2930declare ROOT=${HOME}/books/fcla/sla31declare OUTPUT=${ROOT}/worksheets32declare SCRATCH=/tmp/sla33declare MBX=${HOME}/mathbook/mathbook34declare LATEX="texfot xelatex"3536# With output in a repository, dates in files is a bad idea37declare NODATE="-stringparam debug.datedfiles no"3839# FCLA sections that have worksheets, in order40ALLSECTIONS=(RREF NM SS MISLE CRS FS B PDM EE SD LT ILT SLT IVLT VR MR CB)4142# http://stackoverflow.com/questions/12303974/assign-array-to-variable43# assignment array variable b=( "${a[@]}" )44if [ "X${1}" == "X" ] ; then45echo "Output will be copied into repo, work on a branch"46echo "Provide the string 'all' or a section acronym"47exit48elif [ "${1}" == "all" ] ; then49declare SECTIONS=( "${ALLSECTIONS[@]}" );50else51declare SECTIONS=(${1})52fi5354# Create/use temp/scratch directory55install -d ${SCRATCH}56cd ${SCRATCH}5758echo "*******************"59echo "Processing Overview"60echo "*******************"61# Overview HTML, LaTeX62xsltproc -xinclude ${NODATE} ${MBX}/xsl/mathbook-html.xsl ${ROOT}/worksheets/overview.xml63xsltproc -xinclude -o overview.tex ${NODATE} ${MBX}/xsl/mathbook-latex.xsl ${ROOT}/worksheets/overview.xml64${LATEX} overview.tex65${LATEX} overview.tex66cp -a overview.html overview.pdf ${OUTPUT}6768for SEC in ${SECTIONS[*]}69do70echo "*****************"71echo "Processing "${SEC}72echo "*****************"73###############################74# PDF, process twice with LaTeX75###############################76xsltproc -stringparam numbering.theorems.level 0 ${NODATE} -xinclude \77-o ${SEC}.tex ${MBX}/xsl/mathbook-latex.xsl ${ROOT}/worksheets/${SEC}/${SEC}.xml78${LATEX} ${SEC}.tex79${LATEX} ${SEC}.tex80######81# HTML82######83xsltproc -stringparam numbering.theorems.level 0 -stringparam chunk.level 0 \84-stringparam html.knowl.exercise.inline no ${NODATE} -xinclude \85${MBX}/xsl/mathbook-html.xsl ${ROOT}/worksheets/${SEC}/${SEC}.xml86###############87# SageMathCloud88###############89xsltproc -stringparam numbering.theorems.level 0 -stringparam chunk.level 0 ${NODATE} -xinclude \90${MBX}/xsl/mathbook-smc.xsl ${ROOT}/worksheets/${SEC}/${SEC}.xml91#########92# Jupyter93#########94xsltproc -stringparam numbering.theorems.level 0 -stringparam chunk.level 0 ${NODATE} -xinclude \95${MBX}/xsl/mathbook-jupyter.xsl ${ROOT}/worksheets/${SEC}/${SEC}.xml96cp -a ${SEC}.pdf ${SEC}.html ${SEC}.sagews ${SEC}.ipynb ${OUTPUT}/${SEC}97done9899# restore working directory100cd - > /dev/null101102