# HG changeset patch # User wenzelm # Date 1344176434 -7200 # Node ID 162579d4ba1543166abd9bab9267fb8bc47f10cb # Parent 181b91e1d1c126fd16016d2bf4d64fdd049b69e4 added mkroot: prepare session root directory; diff -r 181b91e1d1c1 -r 162579d4ba15 lib/Tools/mkroot --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/Tools/mkroot Sun Aug 05 16:20:34 2012 +0200 @@ -0,0 +1,170 @@ +#!/usr/bin/env bash +# +# Author: Makarius +# +# DESCRIPTION: prepare session root directory + + +## diagnostics + +PRG="$(basename "$0")" + +function usage() +{ + echo + echo "Usage: isabelle $PRG NAME" + echo + echo " Prepare session root directory, adding session NAME with" + echo " built-in document preparation." + echo + exit 1 +} + +function fail() +{ + echo "$1" >&2 + exit 2 +} + + +## process command line + +[ "$#" -ne 1 -o "$1" = "-?" ] && usage + +DIR_NAME="$1"; shift + +DIR="$(dirname "$DIR_NAME")" +NAME="$(basename "$DIR_NAME")" + + +## main + +[ -e "$DIR_NAME" ] && fail "Cannot overwrite existing \"$DIR_NAME\"" + +echo +echo "Preparing session \"$NAME\" ..." + +mkdir -p "$DIR_NAME" || fail "Bad directory: \"$DIR_NAME\"" + + +# example theory + +echo "creating $DIR_NAME/Ex.thy" +cat > "$DIR_NAME/Ex.thy" < "$DIR_NAME/document/root.tex" <, \, \, \, \, \, + %\, \, \, \, \, + %\, \, \ + +%\usepackage{eurosym} + %for \ + +%\usepackage[only,bigsqcap]{stmaryrd} + %for \ + +%\usepackage{eufrak} + %for \ ... \, \ ... \ (also included in amssymb) + +%\usepackage{textcomp} + %for \, \, \, \, \, + %\ + +% this should be the last package used +\usepackage{pdfsetup} + +% urls in roman style, theory text in math-similar italics +\urlstyle{rm} +\isabellestyle{it} + +% for uniform font size +%\renewcommand{\isastyle}{\isastyleminor} + + +\begin{document} + +\title{$TITLE} +\author{$AUTHOR} +\maketitle + +\tableofcontents + +% sane default for proof documents +\parindent 0pt\parskip 0.5ex + +% generated text of all theories +\input{session} + +% optional bibliography +%\bibliographystyle{abbrv} +%\bibliography{root} + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: +EOF + + +# ROOT + +if [ -e "$DIR/ROOT" ]; then + echo "appending to existing ROOT" + echo >> "$DIR/ROOT" +else + echo "creating ROOT" +fi + +cat >> "$DIR/ROOT" <