support for Springer LLNCS with demo document;
authorwenzelm
Fri, 04 Nov 2022 20:15:54 +0100
changeset 76443 8dbb0b2f6576
parent 76442 3d491d1eeff7
child 76444 6abbbbebdd69
support for Springer LLNCS with demo document;
Admin/components/components.sha1
Admin/components/main
NEWS
doc/Contents
etc/build.props
src/Doc/Demo_LLNCS/Document.thy
src/Doc/Demo_LLNCS/ROOT
src/Doc/Demo_LLNCS/document/root.bib
src/Doc/Demo_LLNCS/document/root.tex
src/Doc/ROOTS
src/Pure/Admin/build_llncs.scala
src/Pure/System/isabelle_tool.scala
--- a/Admin/components/components.sha1	Fri Nov 04 20:02:54 2022 +0100
+++ b/Admin/components/components.sha1	Fri Nov 04 20:15:54 2022 +0100
@@ -282,6 +282,7 @@
 759848095e2ad506083d92b5646947e3c32f27a0 linux_app-20191223.tar.gz
 1a449ce69ac874e21804595d16aaaf5a0d0d0c10 linux_app-20200110.tar.gz
 5557b396f5a9aa22388d3e2171f9bc58e4bd6cd7 lipics-3.1.2.tar.gz
+71b6a272d10c53bb54cba23102e15334ec39bfce llncs-2.22.tar.gz
 0aab4f73ff7f5e36f33276547e10897e1e56fb1d macos_app-20130716.tar.gz
 ad5d0e640ce3609a885cecab645389a2204e03bb macos_app-20150916.tar.gz
 400af57ec5cd51f96928d9de00d077524a6fe316 macos_app-20181205.tar.gz
--- a/Admin/components/main	Fri Nov 04 20:02:54 2022 +0100
+++ b/Admin/components/main	Fri Nov 04 20:15:54 2022 +0100
@@ -18,6 +18,7 @@
 jortho-1.0-2
 kodkodi-1.5.7
 lipics-3.1.2
+llncs-2.22
 minisat-2.2.1-1
 mlton-20210117-1
 nunchaku-0.5
--- a/NEWS	Fri Nov 04 20:02:54 2022 +0100
+++ b/NEWS	Fri Nov 04 20:15:54 2022 +0100
@@ -15,6 +15,7 @@
   - 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"
+  - Springer LaTeX LNCS style as session "Demo_LLNCS" / doc "demo_llncs"
 
 
 *** HOL ***
--- a/doc/Contents	Fri Nov 04 20:02:54 2022 +0100
+++ b/doc/Contents	Fri Nov 04 20:15:54 2022 +0100
@@ -22,6 +22,7 @@
   demo_easychair  Demo for Easychair style
   demo_foiltex    Demo for FoilTeX: slides in LaTeX
   demo_lipics     Demo for Dagstuhl LIPIcs style
+  demo_llncs      Demo for Springer LaTeX LNCS style
 
 Old Isabelle Manuals
   tutorial        Tutorial on Isabelle/HOL
--- a/etc/build.props	Fri Nov 04 20:02:54 2022 +0100
+++ b/etc/build.props	Fri Nov 04 20:15:54 2022 +0100
@@ -24,6 +24,7 @@
   src/Pure/Admin/build_jdk.scala \
   src/Pure/Admin/build_jedit.scala \
   src/Pure/Admin/build_lipics.scala \
+  src/Pure/Admin/build_llncs.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_LLNCS/Document.thy	Fri Nov 04 20:15:54 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%27s%5fdiagonal%5fargument\<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_LLNCS/ROOT	Fri Nov 04 20:15:54 2022 +0100
@@ -0,0 +1,13 @@
+chapter Doc
+
+session Demo_LLNCS (doc) = HOL +
+  options [document_variants = "demo_llncs",
+    document_build = "pdflatex", document_heading_prefix = "", document_comment_latex]
+  theories
+    Document
+  document_files (in "$ISABELLE_LLNCS_HOME")
+    "llncs.cls"
+    "splncs04.bst"
+  document_files
+    "root.bib"
+    "root.tex"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Doc/Demo_LLNCS/document/root.bib	Fri Nov 04 20:15:54 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_LLNCS/document/root.tex	Fri Nov 04 20:15:54 2022 +0100
@@ -0,0 +1,37 @@
+\documentclass[runningheads]{llncs}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{amssymb}
+
+\usepackage{isabelle,isabellesym}
+\isabellestyle{it}
+
+\isadroptag{theory}
+\isafoldtag{proof}
+
+
+\title{Isabelle document preparation with Springer {\LaTeX} LNCS style}
+\author{Makarius Wenzel\inst{1}\orcidID{https://orcid.org/0000-0002-3753-8280}}
+\authorrunning{M. Wenzel}
+\institute{Augsburg, Germany \\ \url{https://sketis.net}}
+
+
+\begin{document}
+
+\maketitle
+
+\begin{abstract}
+Isabelle is a formal document preparation system. This example shows how to
+use it together with the Springer {\LaTeX} LNCS style. See
+\url{https://www.springer.com/gp/computer-science/lncs/conference-proceedings-guidelines}
+for further information.
+
+\keywords{Document preparation}
+\end{abstract}
+
+\input{session}
+
+\bibliographystyle{splncs04}
+\bibliography{root}
+
+\end{document}
--- a/src/Doc/ROOTS	Fri Nov 04 20:02:54 2022 +0100
+++ b/src/Doc/ROOTS	Fri Nov 04 20:15:54 2022 +0100
@@ -1,3 +1,4 @@
 Demo_Easychair
 Demo_FoilTeX
 Demo_LIPIcs
+Demo_LLNCS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Pure/Admin/build_llncs.scala	Fri Nov 04 20:15:54 2022 +0100
@@ -0,0 +1,117 @@
+/*  Title:      Pure/Admin/build_llncs.scala
+    Author:     Makarius
+
+Build Isabelle component for Springer LaTeX LNCS style.
+
+See also:
+
+  - https://ctan.org/pkg/llncs?lang=en
+  - https://www.springer.com/gp/computer-science/lncs/conference-proceedings-guidelines
+*/
+
+package isabelle
+
+
+object Build_LLNCS {
+  /* build llncs component */
+
+  val default_url = "https://mirrors.ctan.org/macros/latex/contrib/llncs.zip"
+
+  def build_llncs(
+    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 llncs_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.md")
+        File.change(llncs_dir + readme)(_.replace("&nbsp;", "\u00a0"))
+
+
+        /* component */
+
+        val version = {
+          val Version = """^_.* v(.*)_$""".r
+          split_lines(File.read(llncs_dir + readme))
+            .collectFirst({ case Version(v) => v })
+            .getOrElse(error("Failed to detect version in " + readme))
+        }
+
+        val component = "llncs-" + 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(llncs_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_LLNCS_HOME="$COMPONENT"
+""")
+
+
+        /* README */
+
+        File.write(component_dir + Path.basic("README"),
+          """This is the Springer LaTeX LNCS style for authors from
+""" + download_url + """
+
+
+    Makarius
+    """ + Date.Format.date(Date.now()) + "\n")
+      }
+    }
+  }
+
+
+  /* Isabelle tool wrapper */
+
+  val isabelle_tool =
+    Isabelle_Tool("build_llncs", "build component for Springer LaTeX LNCS style",
+      Scala_Project.here,
+      { args =>
+        var target_dir = Path.current
+        var download_url = default_url
+
+        val getopts = Getopts("""
+Usage: isabelle build_llncs [OPTIONS]
+
+  Options are:
+    -D DIR       target directory (default ".")
+    -U URL       download URL (default: """" + default_url + """")
+
+  Build component for Springer LaTeX LNCS 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_llncs(download_url = download_url, target_dir = target_dir, progress = progress)
+      })
+}
--- a/src/Pure/System/isabelle_tool.scala	Fri Nov 04 20:02:54 2022 +0100
+++ b/src/Pure/System/isabelle_tool.scala	Fri Nov 04 20:15:54 2022 +0100
@@ -166,6 +166,7 @@
   Build_JDK.isabelle_tool,
   Build_JEdit.isabelle_tool,
   Build_LIPIcs.isabelle_tool,
+  Build_LLNCS.isabelle_tool,
   Build_Minisat.isabelle_tool,
   Build_PDFjs.isabelle_tool,
   Build_PolyML.isabelle_tool1,