support for Dagstuhl LIPIcs style with demo document;
authorwenzelm
Mon, 31 Oct 2022 15:50:13 +0100
changeset 76395 fac28b6c37e8
parent 76394 9d3b9e89455f
child 76396 389d77e6be9f
support for Dagstuhl LIPIcs style with demo document;
Admin/components/components.sha1
Admin/components/main
NEWS
doc/Contents
etc/build.props
src/Doc/Demo_LIPIcs/Document.thy
src/Doc/Demo_LIPIcs/document/root.bib
src/Doc/Demo_LIPIcs/document/root.tex
src/Doc/ROOT
src/Pure/Admin/build_lipics.scala
src/Pure/System/isabelle_tool.scala
src/Pure/Tools/build_docker.scala
--- a/Admin/components/components.sha1	Mon Oct 31 11:04:54 2022 +0100
+++ b/Admin/components/components.sha1	Mon Oct 31 15:50:13 2022 +0100
@@ -279,6 +279,7 @@
 377e36efb8608e6c828c7718d890e97fde2006a4 linux_app-20131007.tar.gz
 759848095e2ad506083d92b5646947e3c32f27a0 linux_app-20191223.tar.gz
 1a449ce69ac874e21804595d16aaaf5a0d0d0c10 linux_app-20200110.tar.gz
+5557b396f5a9aa22388d3e2171f9bc58e4bd6cd7 lipics-3.1.2.tar.gz
 0aab4f73ff7f5e36f33276547e10897e1e56fb1d macos_app-20130716.tar.gz
 ad5d0e640ce3609a885cecab645389a2204e03bb macos_app-20150916.tar.gz
 400af57ec5cd51f96928d9de00d077524a6fe316 macos_app-20181205.tar.gz
--- a/Admin/components/main	Mon Oct 31 11:04:54 2022 +0100
+++ b/Admin/components/main	Mon Oct 31 15:50:13 2022 +0100
@@ -15,6 +15,7 @@
 jfreechart-1.5.3
 jortho-1.0-2
 kodkodi-1.5.7
+lipics-3.1.2
 minisat-2.2.1-1
 mlton-20210117-1
 nunchaku-0.5
--- a/NEWS	Mon Oct 31 11:04:54 2022 +0100
+++ b/NEWS	Mon Oct 31 15:50:13 2022 +0100
@@ -7,6 +7,13 @@
 New in this Isabelle version
 ----------------------------
 
+*** Document preparation ***
+
+* The Dagstuhl LIPIcs style is included as Isabelle component. The
+session "Demo_LIPIcs" provides an example document, which is also
+included in the regular Isabelle documentation as "demo_lipics".
+
+
 *** HOL ***
 
 * Theory "HOL.Fun":
--- a/doc/Contents	Mon Oct 31 11:04:54 2022 +0100
+++ b/doc/Contents	Mon Oct 31 15:50:13 2022 +0100
@@ -18,6 +18,9 @@
   system          The Isabelle System Manual
   jedit           Isabelle/jEdit
 
+Demo Documents
+  demo_lipics     Demo for Dagstuhl LIPIcs style
+
 Old Isabelle Manuals
   tutorial        Tutorial on Isabelle/HOL
   intro           Old Introduction to Isabelle
--- a/etc/build.props	Mon Oct 31 11:04:54 2022 +0100
+++ b/etc/build.props	Mon Oct 31 15:50:13 2022 +0100
@@ -11,8 +11,8 @@
   src/HOL/Tools/Mirabelle/mirabelle.scala \
   src/HOL/Tools/Nitpick/kodkod.scala \
   src/Pure/Admin/afp.scala \
+  src/Pure/Admin/build_csdp.scala \
   src/Pure/Admin/build_cvc5.scala \
-  src/Pure/Admin/build_csdp.scala \
   src/Pure/Admin/build_cygwin.scala \
   src/Pure/Admin/build_doc.scala \
   src/Pure/Admin/build_e.scala \
@@ -21,6 +21,7 @@
   src/Pure/Admin/build_jcef.scala \
   src/Pure/Admin/build_jdk.scala \
   src/Pure/Admin/build_jedit.scala \
+  src/Pure/Admin/build_lipics.scala \
   src/Pure/Admin/build_log.scala \
   src/Pure/Admin/build_minisat.scala \
   src/Pure/Admin/build_pdfjs.scala \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Doc/Demo_LIPIcs/Document.thy	Mon Oct 31 15:50:13 2022 +0100
@@ -0,0 +1,64 @@
+theory Document
+  imports Main
+begin
+
+section \<open>Some section\<close>
+
+subsection \<open>Some subsection\<close>
+
+subsection \<open>Some subsubsection\<close>
+
+subsubsection \<open>Some subsubsubsection\<close>
+
+paragraph \<open>A paragraph.\<close>
+
+text \<open>Informal bla bla.\<close>
+
+definition "foo = True"  \<comment> \<open>side remark on \<^const>\<open>foo\<close>\<close>
+
+definition "bar = False"  \<comment> \<open>side remark on \<^const>\<open>bar\<close>\<close>
+
+lemma foo unfolding foo_def ..
+
+
+paragraph \<open>Another paragraph.\<close>
+
+text \<open>See also @{cite \<open>\S3\<close> "isabelle-system"}.\<close>
+
+
+section \<open>Formal proof of Cantor's theorem\<close>
+
+text_raw \<open>\isakeeptag{proof}\<close>
+text \<open>
+  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>\<open>http://mathworld.wolfram.com/CantorDiagonalMethod.html\<close>
+  \<^item> \<^url>\<open>https://en.wikipedia.org/wiki/Cantor's_diagonal_argument\<close>
+\<close>
+
+theorem Cantor: "\<nexists>f :: 'a \<Rightarrow> 'a set. \<forall>A. \<exists>x. A = f x"
+proof
+  assume "\<exists>f :: 'a \<Rightarrow> 'a set. \<forall>A. \<exists>x. A = f x"
+  then obtain f :: "'a \<Rightarrow> 'a set" where *: "\<forall>A. \<exists>x. A = f x" ..
+  let ?D = "{x. x \<notin> f x}"
+  from * obtain a where "?D = f a" by blast
+  moreover have "a \<in> ?D \<longleftrightarrow> a \<notin> f a" by blast
+  ultimately show False by blast
+qed
+
+
+subsection \<open>Lorem ipsum dolor\<close>
+
+text \<open>
+  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec id ipsum
+  sapien. Vivamus malesuada enim nibh, a tristique nisi sodales ac. Praesent
+  ut sem consectetur, interdum tellus ac, sodales nulla. Quisque vel diam at
+  risus tempus tempor eget a tortor. Suspendisse potenti. Nulla erat lacus,
+  dignissim sed volutpat nec, feugiat non leo. Nunc blandit et justo sed
+  venenatis. Donec scelerisque placerat magna, et congue nulla convallis vel.
+  Cras tristique dolor consequat dolor tristique rutrum. Suspendisse ultrices
+  sem nibh, et suscipit felis ultricies at. Aliquam venenatis est vel nulla
+  efficitur ornare. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+\<close>
+
+end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Doc/Demo_LIPIcs/document/root.bib	Mon Oct 31 15:50:13 2022 +0100
@@ -0,0 +1,4 @@
+@manual{isabelle-system,
+  author = {Makarius Wenzel},
+  title = {The {Isabelle} System Manual},
+  note = {\url{https://isabelle.in.tum.de/doc/system.pdf}}}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Doc/Demo_LIPIcs/document/root.tex	Mon Oct 31 15:50:13 2022 +0100
@@ -0,0 +1,59 @@
+\documentclass[a4paper,UKenglish,cleveref,autoref]{lipics-v2021}
+
+\usepackage{isabelle,isabellesym}
+\isabellestyle{it}
+
+\isadroptag{theory}
+\isafoldtag{proof}
+
+
+\bibliographystyle{plainurl}% the mandatory bibstyle (e.g. from texlive-bibtex-extra)
+
+\title{Isabelle document preparation with Dagstuhl LIPIcs style}
+
+\author{Makarius Wenzel}{Augsburg, Germany \and \url{https://sketis.net}}{}{https://orcid.org/0000-0002-3753-8280}{}
+\authorrunning{M. Wenzel}
+
+\Copyright{}
+
+\ccsdesc[100]{General and reference~General literature}
+\ccsdesc[100]{General and reference}
+
+\keywords{Document preparation}
+
+\category{}
+
+\nolinenumbers
+
+%\hideLIPIcs  %uncomment to remove references to LIPIcs series (logo, DOI, ...), e.g. when preparing a pre-final version to be uploaded to arXiv or another public repository
+
+%Editor-only macros:: begin (do not touch as author)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\EventEditors{John Q. Open and Joan R. Access}
+\EventNoEds{2}
+\EventLongTitle{42nd Conference on Very Important Topics (CVIT 2016)}
+\EventShortTitle{CVIT 2016}
+\EventAcronym{CVIT}
+\EventYear{2016}
+\EventDate{December 24--27, 2016}
+\EventLocation{Little Whinging, United Kingdom}
+\EventLogo{}
+\SeriesVolume{42}
+\ArticleNo{23}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\begin{document}
+
+\maketitle
+
+\begin{abstract}
+Isabelle is a formal document preparation system. This example shows how to
+use it together with the Dagstuhl LIPIcs style. See
+\url{https://www.dagstuhl.de/en/publications/lipics/instructions-for-authors}
+for further information.
+\end{abstract}
+
+\input{session}
+
+\bibliography{root}
+
+\end{document}
--- a/src/Doc/ROOT	Mon Oct 31 11:04:54 2022 +0100
+++ b/src/Doc/ROOT	Mon Oct 31 15:50:13 2022 +0100
@@ -488,3 +488,16 @@
   document_files
     "root.tex"
     "style.sty"
+
+session Demo_LIPIcs (doc) in "Demo_LIPIcs" = HOL +
+  options [document_variants = "demo_lipics",
+    document_build = "pdflatex", document_heading_prefix = "", document_comment_latex]
+  theories
+    Document
+  document_files (in "$ISABELLE_LIPICS_HOME")
+    "cc-by.pdf"
+    "lipics-logo-bw.pdf"
+    "lipics-v2021.cls"
+  document_files
+    "root.bib"
+    "root.tex"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/Admin/build_lipics.scala	Mon Oct 31 15:50:13 2022 +0100
@@ -0,0 +1,107 @@
+/*  Title:      Pure/Admin/build_lipics.scala
+    Author:     Makarius
+
+Build Isabelle component for Dagstuhl LIPIcs style.
+
+See also:
+
+  - https://github.com/dagstuhl-publishing/styles
+  - https://submission.dagstuhl.de/documentation/authors
+  - https://www.dagstuhl.de/en/publications/lipics
+*/
+
+package isabelle
+
+
+object Build_LIPIcs {
+  /* build lipics component */
+
+  val default_url = "https://github.com/dagstuhl-publishing/styles/archive/refs/tags/v2021.1.2.tar.gz"
+
+  def build_lipics(
+    download_url: String = default_url,
+    target_dir: Path = Path.current,
+    progress: Progress = new Progress
+  ): Unit = {
+    Isabelle_System.with_tmp_file("download", ext = "tar.gz") { download_file =>
+      Isabelle_System.with_tmp_dir("download") { download_dir =>
+
+        /* download */
+
+        Isabelle_System.download_file(download_url, download_file, progress = progress)
+        Isabelle_System.gnutar("-xzf " + File.bash_path(download_file),
+          dir = download_dir, strip = 1).check
+
+        val lipics_dir = download_dir + Path.explode("LIPIcs/authors")
+
+
+        /* component */
+
+        val version = {
+          val Version = """^*.* v(.*)$""".r
+          val changelog = Path.explode("CHANGELOG.md")
+          split_lines(File.read(lipics_dir + changelog))
+            .collectFirst({ case Version(v) => v })
+            .getOrElse(error("Failed to detect version in " + changelog))
+        }
+
+        val component = "lipics-" + version
+        val component_dir = Isabelle_System.new_directory(target_dir + Path.basic(component))
+        progress.echo("Component " + component_dir)
+
+        Isabelle_System.copy_dir(lipics_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_LIPICS_HOME="$COMPONENT/authors"
+""")
+
+
+        /* README */
+
+        File.write(component_dir + Path.basic("README"),
+          """This is the Dagstuhl LIPIcs style for authors from
+""" + download_url + """
+
+
+    Makarius
+    """ + Date.Format.date(Date.now()) + "\n")
+      }
+    }
+  }
+
+
+  /* Isabelle tool wrapper */
+
+  val isabelle_tool =
+    Isabelle_Tool("build_lipics", "build component for Dagstuhl LIPIcs style",
+      Scala_Project.here,
+      { args =>
+        var target_dir = Path.current
+        var download_url = default_url
+
+        val getopts = Getopts("""
+Usage: isabelle build_lipics [OPTIONS]
+
+  Options are:
+    -D DIR       target directory (default ".")
+    -U URL       download URL (default: """" + default_url + """")
+
+  Build component for Dagstuhl LIPIcs style.
+""",
+          "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_lipics(download_url = download_url, target_dir = target_dir, progress = progress)
+      })
+}
--- a/src/Pure/System/isabelle_tool.scala	Mon Oct 31 11:04:54 2022 +0100
+++ b/src/Pure/System/isabelle_tool.scala	Mon Oct 31 15:50:13 2022 +0100
@@ -163,6 +163,7 @@
   Build_JCEF.isabelle_tool,
   Build_JDK.isabelle_tool,
   Build_JEdit.isabelle_tool,
+  Build_LIPIcs.isabelle_tool,
   Build_Minisat.isabelle_tool,
   Build_PDFjs.isabelle_tool,
   Build_PolyML.isabelle_tool1,
--- a/src/Pure/Tools/build_docker.scala	Mon Oct 31 11:04:54 2022 +0100
+++ b/src/Pure/Tools/build_docker.scala	Mon Oct 31 15:50:13 2022 +0100
@@ -20,7 +20,12 @@
   val package_collections: Map[String, List[String]] =
     Map("X11" -> List("libx11-6", "libxext6", "libxrender1", "libxtst6", "libxi6"),
       "latex" ->
-        List("texlive-fonts-extra", "texlive-font-utils", "texlive-latex-extra", "texlive-science"))
+        List(
+          "texlive-bibtex-extra",
+          "texlive-fonts-extra",
+          "texlive-font-utils",
+          "texlive-latex-extra",
+          "texlive-science"))
 
   def all_packages: List[String] =
     packages ::: package_collections.valuesIterator.flatten.toList