dpi support
This commit is contained in:
parent
d9dafb4ab8
commit
5d999b01b2
3 changed files with 8 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
move_uploaded_file($_FILES["file"]["tmp_name"], "tmp.tex");
|
move_uploaded_file($_FILES["file"]["tmp_name"], "tmp.tex");
|
||||||
$output = shell_exec("./tex2png.sh tmp.tex");
|
$dpi = isset($_POST['dpi']) ? intval($_POST['dpi']) : 200;
|
||||||
|
$output = shell_exec("./tex2png.sh tmp.tex $dpi");
|
||||||
|
|
||||||
if ($output !== null) {
|
if ($output !== null) {
|
||||||
$host = $_SERVER['HTTP_HOST'];
|
$host = $_SERVER['HTTP_HOST'];
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
file="$1"
|
file="$1"
|
||||||
|
dpi="$2"
|
||||||
[ "$file" ] || exit 1
|
[ "$file" ] || exit 1
|
||||||
out="${file%.tex}.png"
|
out="${file%.tex}.png"
|
||||||
|
|
||||||
makepng() {
|
makepng() {
|
||||||
latex -interaction nonstopmode "$file" >/dev/null 2>&1 || return 1
|
latex -interaction nonstopmode "$file" >/dev/null 2>&1 || return 1
|
||||||
dvipng -D 200 -T tight -bg Transparent -o "$out" "${file%.tex}.dvi" >/dev/null 2>&1 || return 1
|
dvipng -D "$dpi" -T tight -bg Transparent -o "$out" "${file%.tex}.dvi" >/dev/null 2>&1 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
makepng && echo "$out" || exit 1
|
makepng && echo "$out" || exit 1
|
||||||
|
|
14
texpngweb.el
14
texpngweb.el
|
@ -1,9 +1,7 @@
|
||||||
;; Sample emacs configuration for this setup
|
;; Sample emacs configuration
|
||||||
;; Adjust dpi in ./public/tex2png.sh
|
|
||||||
;; dvipng -D 350 looks good on my device (400dpi)
|
|
||||||
|
|
||||||
(if (eq system-type 'android)
|
(if (eq system-type 'android)
|
||||||
(progn
|
(progn ;; Android custom org-latex-preview
|
||||||
(setq org-preview-latex-process-alist
|
(setq org-preview-latex-process-alist
|
||||||
'((texpngweb
|
'((texpngweb
|
||||||
:programs ("curl")
|
:programs ("curl")
|
||||||
|
@ -12,10 +10,6 @@
|
||||||
:image-input-type "tex"
|
:image-input-type "tex"
|
||||||
:image-output-type "png"
|
:image-output-type "png"
|
||||||
:image-size-adjust (1.0 . 1.0)
|
:image-size-adjust (1.0 . 1.0)
|
||||||
;; This works in my pc, but not in android.
|
:latex-compiler ("")
|
||||||
;; :latex-compiler ("curl -F \"file=@%f\" http://0.0.0.0:8000")
|
:image-converter ("curl -F \"file=@%f\" -F \"dpi=%D\" http://0.0.0.0:8000 && curl http://0.0.0.0:8000/tmp.png -o %O"))))
|
||||||
;; For some reason this works in android (and also on pc)
|
|
||||||
;; And for whatever reason image-converter still needs to be set
|
|
||||||
:latex-compiler ("curl -F \"file=@%f\" http://0.0.0.0:8000 && curl http://0.0.0.0:8000/tmp.png -o %O")
|
|
||||||
:image-converter ("curl http://0.0.0.0:8000/tmp.png -o %O"))))
|
|
||||||
(setq org-latex-create-formula-image-program 'texpngweb)))
|
(setq org-latex-create-formula-image-program 'texpngweb)))
|
||||||
|
|
Loading…
Reference in a new issue