package forester
A tool for tending mathematical forests
Install
Dune Dependency
Authors
Maintainers
Sources
4.2.0.tar.gz
md5=7543fe7acbdfeb2056dc0b774965239f
sha512=2317bf84588692bbbd40e5fa944faab4889474e4a058e336bd1165f6dd8e55e8979affab098248c87354acdc3b6e6927305553ff5ab6b002b6739719814ec080
doc/src/forester.render/Build_latex.ml.html
Source file Build_latex.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
open Eio.Std open Forester_prelude type 'a env = 'a constraint 'a = < cwd : Eio.Fs.dir_ty Eio.Path.t; process_mgr : _ Eio.Process.mgr; stdout : _ Eio.Flow.sink; .. > as 'a let tex_fp name = Format.sprintf "%s.tex" name let dvi_fp name = Format.sprintf "%s.dvi" name let build_dir cwd = Eio.Path.(cwd/"build") let tex_fname name = name ^ ".tex" let dvi_fname name = name ^ ".dvi" let write_tex_file ~env ~name ~preamble ~source = let cwd = Eio.Stdenv.cwd env in let path = Eio.Path.(build_dir cwd / tex_fname name) in let create = `Or_truncate 0o644 in Eio.Path.with_open_out ~create path @@ fun sink -> Eio.Buf_write.with_flow sink @@ fun writer -> let fmt = Eio_util.formatter_of_writer writer in LaTeX_template.write fmt ~source ~preamble let render_dvi_file ~env ~name ~source = let cwd = build_dir @@ Eio.Stdenv.cwd env in Eio_util.ensure_remove_file Eio.Path.(cwd / dvi_fname name); Eio_util.run_process ~env ~cwd ["latex"; "-halt-on-error"; "-interaction=nonstopmode"; tex_fname name] let render_svg_file ~env ~name ~source = let cwd = build_dir @@ Eio.Stdenv.cwd env in let fname = dvi_fname name in Eio_util.run_process ~env ~cwd ["dvisvgm"; "--exact"; "--clipjoin"; "--font-format=woff"; "--bbox=papersize"; "--zoom=1.5"; fname; "--output=%f"]; Eio_util.ensure_remove_file Eio.Path.(cwd / fname) let build_latex ~env ~ignore_tex_cache ~name ~preamble ~source : Eio.Fs.dir_ty Eio.Path.t list = let cwd = Eio.Stdenv.cwd env in let svg_path = Eio.Path.(build_dir cwd / (name ^ ".svg")) in write_tex_file ~env ~name ~preamble ~source; if ignore_tex_cache || not @@ Eio_util.file_exists svg_path then begin render_dvi_file ~env ~name ~source; render_svg_file ~env ~name ~source; [svg_path] end else []
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>