wip: xelatex
This commit is contained in:
@@ -34,7 +34,7 @@ function do_command (cmd) {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return e
|
return {type: "error", error: e}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,6 +141,7 @@
|
|||||||
\newcommand{\definedto}{≔}
|
\newcommand{\definedto}{≔}
|
||||||
\newcommand{\equivto}{\simeq}
|
\newcommand{\equivto}{\simeq}
|
||||||
\newcommand{\homotopicto}{\sim}
|
\newcommand{\homotopicto}{\sim}
|
||||||
|
\newcommand{\homotopyto}{\sim}
|
||||||
\newcommand{\naturalto}{\Rightarrow}
|
\newcommand{\naturalto}{\Rightarrow}
|
||||||
\newcommand{\isoto}{\cong}
|
\newcommand{\isoto}{\cong}
|
||||||
\newcommand{\monicto}{\rightarrowtail}
|
\newcommand{\monicto}{\rightarrowtail}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
(ns net.deertopia.doerg.common
|
(ns net.deertopia.doerg.common
|
||||||
(:require [babashka.process :as p]
|
(:require [babashka.process :as p]
|
||||||
[clojure.string :as str]))
|
[clojure.string :as str]
|
||||||
|
[clojure.tools.logging :as l]))
|
||||||
|
|
||||||
(defn deref-with-timeout [process ms]
|
(defn deref-with-timeout [process ms]
|
||||||
(let [p (promise)
|
(let [p (promise)
|
||||||
@@ -16,3 +17,16 @@
|
|||||||
{:process process
|
{:process process
|
||||||
:timed-out-after-milliseconds ms}))
|
:timed-out-after-milliseconds ms}))
|
||||||
@p)))
|
@p)))
|
||||||
|
|
||||||
|
(defn invoke [opts & cmd]
|
||||||
|
(l/info (str/join " " (cons "$" cmd)))
|
||||||
|
(let [r (apply p/shell
|
||||||
|
(merge {:continue true
|
||||||
|
:in nil :out :string :err :string}
|
||||||
|
opts)
|
||||||
|
cmd)
|
||||||
|
bin (first cmd)]
|
||||||
|
(l/infof "%s (stdout): %s" bin (:out r))
|
||||||
|
(l/infof "%s (stderr): %s" bin (:err r))
|
||||||
|
(l/infof "%s exited with status %s" bin (str (:exit r)))
|
||||||
|
r))
|
||||||
|
|||||||
@@ -3,6 +3,37 @@
|
|||||||
[net.deertopia.doerg.common :as common]
|
[net.deertopia.doerg.common :as common]
|
||||||
[clj-cbor.core :as cbor]
|
[clj-cbor.core :as cbor]
|
||||||
[clojure.java.io :as io]))
|
[clojure.java.io :as io]))
|
||||||
|
|
||||||
|
;;; XeLaTeX
|
||||||
|
|
||||||
|
(def scale-divisor 66873.46948423679)
|
||||||
|
|
||||||
|
(def font-size 10)
|
||||||
|
|
||||||
|
(defn- invoke-xelatex [& {:keys [file output-dir]}]
|
||||||
|
(let [{:keys [out]} (common/invoke
|
||||||
|
{:dir output-dir}
|
||||||
|
"xelatex" "-no-pdf" "-interaction" "nonstopmode"
|
||||||
|
"-output-directory" output-dir file)
|
||||||
|
[tp1 tp2 tp3 tp4] (->> (re-find tightpage-regexp out)
|
||||||
|
(drop 1)
|
||||||
|
(map parse-long))]
|
||||||
|
(->> (re-find-all preview-end-regexp out)
|
||||||
|
(map #(let [[d1 d2 d3] (map parse-long (drop 1 %))
|
||||||
|
depth (/ (- d2 tp2)
|
||||||
|
scale-divisor
|
||||||
|
font-size)]
|
||||||
|
{:depth depth
|
||||||
|
:height (+ depth
|
||||||
|
(/ (+ d1 tp4)
|
||||||
|
tex-scale-divisor
|
||||||
|
tex-fontsize))
|
||||||
|
:width (/ (+ d3 tp3 (- tp2))
|
||||||
|
tex-scale-divisor
|
||||||
|
tex-fontsize)})))))
|
||||||
|
|
||||||
|
|
||||||
|
;;; Temml
|
||||||
|
|
||||||
(def ^:dynamic *tex-worker-timeout-duration*
|
(def ^:dynamic *tex-worker-timeout-duration*
|
||||||
"Number of milliseconds to wait before killing the external Uniorg
|
"Number of milliseconds to wait before killing the external Uniorg
|
||||||
|
|||||||
Reference in New Issue
Block a user