# HG changeset patch # User wenzelm # Date 1667249074 -3600 # Node ID d0a1f3eb09823d1650b3c1600d90a951c0f2b506 # Parent fc35958d2e738a9d450946a89702681faf3df8f6 support for FoilTeX with demo document; diff -r fc35958d2e73 -r d0a1f3eb0982 Admin/components/components.sha1 --- a/Admin/components/components.sha1 Mon Oct 31 17:59:33 2022 +0100 +++ b/Admin/components/components.sha1 Mon Oct 31 21:44:34 2022 +0100 @@ -105,6 +105,7 @@ 9534b721b7b78344f3225067ee4df28a5440b87e flatlaf-1.6.4.tar.gz 212a0f1f867511722024cc60156fd71872a16f92 flatlaf-1.6.tar.gz 6d4dbb6f2bde5804298d9008e3edceb0b9ee20ae flatlaf-2.4.tar.gz +b1c40ce6c087da7e70e221ddd3fcadfa569acb2f foiltex-2.1.4b.tar.gz f339234ec18369679be0095264e0c0af7762f351 gnu-utils-20210414.tar.gz 71259aa46134e6cf2c6473b4fc408051b3336490 gnu-utils-20211030.tar.gz 683acd94761ef460cca1a628f650355370de5afb hol-light-bundle-0.5-126.tar.gz diff -r fc35958d2e73 -r d0a1f3eb0982 Admin/components/main --- a/Admin/components/main Mon Oct 31 17:59:33 2022 +0100 +++ b/Admin/components/main Mon Oct 31 21:44:34 2022 +0100 @@ -8,6 +8,7 @@ e-2.6-1 easychair-3.5 flatlaf-2.4 +foiltex-2.1.4b idea-icons-20210508 isabelle_fonts-20211004 isabelle_setup-20221028 diff -r fc35958d2e73 -r d0a1f3eb0982 NEWS --- a/NEWS Mon Oct 31 17:59:33 2022 +0100 +++ b/NEWS Mon Oct 31 21:44:34 2022 +0100 @@ -13,6 +13,7 @@ with demo documents in the regular Isabelle "doc" space: - Easychair as session "Demo_Easychair" / doc "demo_easychair" + - FoilTeX as session "Demo_FoilTeX" / doc "demo_foiltex" - Dagstuhl LIPIcs style as session "Demo_LIPIcs" / doc "demo_lipics" diff -r fc35958d2e73 -r d0a1f3eb0982 doc/Contents --- a/doc/Contents Mon Oct 31 17:59:33 2022 +0100 +++ b/doc/Contents Mon Oct 31 21:44:34 2022 +0100 @@ -20,6 +20,7 @@ Demo Documents demo_easychair Demo for Easychair style + demo_foiltex Demo for FoilTeX: slides in LaTeX demo_lipics Demo for Dagstuhl LIPIcs style Old Isabelle Manuals diff -r fc35958d2e73 -r d0a1f3eb0982 etc/build.props --- a/etc/build.props Mon Oct 31 17:59:33 2022 +0100 +++ b/etc/build.props Mon Oct 31 21:44:34 2022 +0100 @@ -17,6 +17,7 @@ src/Pure/Admin/build_doc.scala \ src/Pure/Admin/build_e.scala \ src/Pure/Admin/build_easychair.scala \ + src/Pure/Admin/build_foiltex.scala \ src/Pure/Admin/build_fonts.scala \ src/Pure/Admin/build_history.scala \ src/Pure/Admin/build_jcef.scala \ diff -r fc35958d2e73 -r d0a1f3eb0982 src/Doc/Demo_FoilTeX/Document.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Doc/Demo_FoilTeX/Document.thy Mon Oct 31 21:44:34 2022 +0100 @@ -0,0 +1,85 @@ +theory Document + imports Main +begin + +section \Abstract\ + +text \ + \small + Isabelle is a formal document preparation system. This example shows how to + use it together with Foil{\TeX} to produce slides in {\LaTeX}. See + \<^url>\https://ctan.org/pkg/foiltex\ for further information. +\ + + +chapter \Introduction\ + +section \Some slide\ + +paragraph \Point 1: + \plainstyle ABC\ + +text \ + \<^item> something + \<^item> to say \dots +\ + +paragraph \Point 2: + \plainstyle XYZ\ + +text \ + \<^item> more + \<^item> to say \dots +\ + + +section \Another slide\ + +paragraph \Key definitions:\ + +text \Informal bla bla.\ + +definition "foo = True" \ \side remark on \<^const>\foo\\ + +definition "bar = False" \ \side remark on \<^const>\bar\\ + +lemma foo unfolding foo_def .. + + +chapter \Application: Cantor's theorem\ + +section \Informal notes\ + +text_raw \\isakeeptag{proof}\ +text \ + Cantor's Theorem states that there is no surjection from + a set to its powerset. The proof works by diagonalization. E.g.\ see + \<^item> \<^url>\http://mathworld.wolfram.com/CantorDiagonalMethod.html\ + \<^item> \<^url>\https://en.wikipedia.org/wiki/Cantor's_diagonal_argument\ +\ + +section \Formal proof\ + +theorem Cantor: "\f :: 'a \ 'a set. \A. \x. A = f x" +proof + assume "\f :: 'a \ 'a set. \A. \x. A = f x" + then obtain f :: "'a \ 'a set" where *: "\A. \x. A = f x" .. + let ?D = "{x. x \ f x}" + from * obtain a where "?D = f a" by blast + moreover have "a \ ?D \ a \ f a" by blast + ultimately show False by blast +qed + + +chapter \Conclusion\ + +section \Lorem ipsum dolor\ + +text \ + \<^item> Lorem ipsum dolor sit amet, consectetur adipiscing elit. + \<^item> Donec id ipsum sapien. + \<^item> Vivamus malesuada enim nibh, a tristique nisi sodales ac. + \<^item> Praesent ut sem consectetur, interdum tellus ac, sodales nulla. +\ + +end diff -r fc35958d2e73 -r d0a1f3eb0982 src/Doc/Demo_FoilTeX/document/root.tex --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Doc/Demo_FoilTeX/document/root.tex Mon Oct 31 21:44:34 2022 +0100 @@ -0,0 +1,65 @@ +\documentclass[a4paper,landscape]{foils} +\usepackage[utf8]{inputenc} +\usepackage{amssymb} +\usepackage[svgnames]{xcolor} +\usepackage{graphicx} +\usepackage{isabelle,isabellesym} +\usepackage{pdfsetup} + + +\makeatletter + +%colors +\newcommand{\titlestyle}{\color{DarkGreen}} +\newcommand{\hilitecolor}{\color{Blue}} +\newcommand{\hilite}[1]{{\hilitecolor#1}} +\newcommand{\red}[1]{{\color{Red}#1}} +\newcommand{\green}[1]{{\color{DarkGreen}#1}} + +%headings +\renewcommand{\isamarkupchapter}[1]{\newpage\thispagestyle{empty}\MyLogo{\let\\=\relax #1}\vspace*{0.4\textheight}\begin{center}\LARGE\bf\color{DarkGreen} #1\end{center}} +\renewcommand{\isamarkupsection}[1]{\foilhead{\color{DarkGreen}#1}} +\renewcommand\isamarkupparagraph{\@startsection{paragraph}{4}{0pt}{\bigskipamount}{0.5ex \@plus .1ex}{\normalsize\bf\color{DarkBlue}}} + +%item spacing +\renewcommand\@listIa{\leftmargin\leftmargini +\topsep 0\p@ \@plus 0.5\p@ \@minus 1\p@ +\parsep 2\p@ \@plus 1\p@ \@minus 1\p@ +\itemsep 2\p@ \@plus 1\p@ \@minus 0.5\p@} + +\makeatother + + +\parindent 0pt\parskip 0.5ex + +\urlstyle{sf} +\isabellestyle{it} +\MyLogo{} + +\newcommand{\plainstyle}{\normalsize\sf\color{black}} +\renewcommand{\isastyletext}{\normalsize\sf} +\renewcommand{\isastyletxt}{\sf} +\renewcommand{\isastylecmt}{\sf} + +\isadroptag{theory} +\isafoldtag{proof} + + +\begin{document} + +\title{\titlestyle Simple slides with with FoilTeX} +\author{Makarius Wenzel, Augsburg \\ \url{https://sketis.net}} +\date{} +\maketitle + +\vfill + +\begin{center} + \includegraphics[width=0.15\textwidth]{isabelle_logo} +\end{center} + +\vfill + +\input{session} + +\end{document} diff -r fc35958d2e73 -r d0a1f3eb0982 src/Doc/ROOT --- a/src/Doc/ROOT Mon Oct 31 17:59:33 2022 +0100 +++ b/src/Doc/ROOT Mon Oct 31 21:44:34 2022 +0100 @@ -499,6 +499,18 @@ "root.bib" "root.tex" +session Demo_FoilTeX (doc) in "Demo_FoilTeX" = HOL + + options [document_variants = "demo_foiltex", + document_build = "pdflatex", document_logo = "FoilTeX"] + theories + Document + document_files (in "$ISABELLE_FOILTEX_HOME") + "fltfonts.def" + "foil20.clo" + "foils.cls" + document_files + "root.tex" + session Demo_LIPIcs (doc) in "Demo_LIPIcs" = HOL + options [document_variants = "demo_lipics", document_build = "pdflatex", document_heading_prefix = "", document_comment_latex] diff -r fc35958d2e73 -r d0a1f3eb0982 src/Pure/Admin/build_foiltex.scala --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Pure/Admin/build_foiltex.scala Mon Oct 31 21:44:34 2022 +0100 @@ -0,0 +1,117 @@ +/* Title: Pure/Admin/build_foiltex.scala + Author: Makarius + +Build Isabelle component for FoilTeX. + +See also https://ctan.org/pkg/foiltex +*/ + +package isabelle + + +object Build_Foiltex { + /* build FoilTeX component */ + + val default_url = "https://mirrors.ctan.org/macros/latex/contrib/foiltex.zip" + + def build_foiltex( + download_url: String = default_url, + target_dir: Path = Path.current, + progress: Progress = new Progress + ): Unit = { + Isabelle_System.require_command("unzip", test = "-h") + + Isabelle_System.with_tmp_file("download", ext = "zip") { download_file => + Isabelle_System.with_tmp_dir("download") { download_dir => + + /* download */ + + Isabelle_System.download_file(download_url, download_file, progress = progress) + Isabelle_System.bash("unzip -x " + File.bash_path(download_file), + cwd = download_dir.file).check + + val foiltex_dir = + File.read_dir(download_dir) match { + case List(name) => download_dir + Path.explode(name) + case bad => + error("Expected exactly one directory entry in " + download_file + + bad.mkString("\n", "\n ", "")) + } + + val README = Path.explode("README") + val README_flt = Path.explode("README.flt") + Isabelle_System.move_file(foiltex_dir + README, foiltex_dir + README_flt) + + Isabelle_System.bash("pdflatex foiltex.ins", cwd = foiltex_dir.file).check + + + /* component */ + + val version = { + val Version = """^.*Instructions for FoilTeX Version\s*(.*)$""".r + split_lines(File.read(foiltex_dir + README_flt)) + .collectFirst({ case Version(v) => v }) + .getOrElse(error("Failed to detect version in " + README_flt)) + } + + val component = "foiltex-" + version + val component_dir = Isabelle_System.new_directory(target_dir + Path.basic(component)) + progress.echo("Component " + component_dir) + + component_dir.file.delete + Isabelle_System.copy_dir(foiltex_dir, component_dir) + + + /* settings */ + + val etc_dir = Isabelle_System.make_directory(component_dir + Path.basic("etc")) + File.write(etc_dir + Path.basic("settings"), + """# -*- shell-script -*- :mode=shellscript: + +ISABELLE_FOILTEX_HOME="$COMPONENT" +""") + + + /* README */ + + File.write(component_dir + Path.basic("README"), + """This is FoilTeX from +""" + download_url + """ + + + Makarius + """ + Date.Format.date(Date.now()) + "\n") + } + } + } + + + /* Isabelle tool wrapper */ + + val isabelle_tool = + Isabelle_Tool("build_foiltex", "build component for FoilTeX", + Scala_Project.here, + { args => + var target_dir = Path.current + var download_url = default_url + + val getopts = Getopts(""" +Usage: isabelle build_foiltex [OPTIONS] + + Options are: + -D DIR target directory (default ".") + -U URL download URL (default: """" + default_url + """") + + Build component for FoilTeX: slides in LaTeX. +""", + "D:" -> (arg => target_dir = Path.explode(arg)), + "U:" -> (arg => download_url = arg)) + + val more_args = getopts(args) + if (more_args.nonEmpty) getopts.usage() + + val progress = new Console_Progress() + + build_foiltex(download_url = download_url, target_dir = target_dir, progress = progress) + }) +} diff -r fc35958d2e73 -r d0a1f3eb0982 src/Pure/System/isabelle_tool.scala --- a/src/Pure/System/isabelle_tool.scala Mon Oct 31 17:59:33 2022 +0100 +++ b/src/Pure/System/isabelle_tool.scala Mon Oct 31 21:44:34 2022 +0100 @@ -160,6 +160,7 @@ Build_Doc.isabelle_tool, Build_E.isabelle_tool, Build_Easychair.isabelle_tool, + Build_Foiltex.isabelle_tool, Build_Fonts.isabelle_tool, Build_JCEF.isabelle_tool, Build_JDK.isabelle_tool,