Tweaks to fic export setup

master
trémeur 1 year ago
parent a4be2e0260
commit 333e8d185a

@ -62,12 +62,12 @@
(if multichapter (if multichapter
(setq chaptertitles (y-or-n-p "Titled chapters?"))) (setq chaptertitles (y-or-n-p "Titled chapters?")))
(setq ffx (y-or-n-p "FFX fic?")))) (setq ffx (y-or-n-p "FFX fic?"))))
(setq draftmode (y-or-n-p "Edit LaTeX file manually?")) ;; (setq draftmode (y-or-n-p "Edit LaTeX file manually?"))
;; (org-format) ;; (org-format)
(save-buffer) (save-buffer)
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "\\[fn:\\([0-9]*\\):\\(.*\\)\\]" nil t) (while (re-search-forward "\\[fn:\\([0-9]*\\):\\(.*\\)\\]" nil t)
(replace-match "@@html:<label for=\"\\1\" class=\"margin-toggle sidenote-number\"></label><input type=\"checkbox\" id=\"\\1\" class=\"margin-toggle\"/><span class=\"sidenote\">\\2</span>@@@@latex:\\\\footnote{\\2}@@")) (replace-match "@@html:<label for=\"\\1\" class=\"margin-toggle sidenote-number\"></label><input type=\"checkbox\" id=\"\\1\" class=\"margin-toggle\"/><span class=\"sidenote\">@@@@latex:\\\\footnote{@@\\2@@html:</span>@@@@latex:}@@"))
(let ((user-full-name "ovely") (let ((user-full-name "ovely")
(org-html-head "<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"/><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin/><link href=\"https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,700;1,400;1,700&display=swap\" rel=\"stylesheet\"/><link rel=\"stylesheet\" href=\"/fic/tufte.css\"/>") (org-html-head "<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"/><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin/><link href=\"https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,700;1,400;1,700&display=swap\" rel=\"stylesheet\"/><link rel=\"stylesheet\" href=\"/fic/tufte.css\"/>")
(org-export-with-author t) (org-export-with-author t)
@ -144,6 +144,9 @@
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t) (while (re-search-forward "label{\\(.*\\)}\n\\([A-Z]\\)\\([a-z]*\\)" nil t)
(replace-match "label{\\1}\n\\\\lettrine{“\\2}{\\3}")) (replace-match "label{\\1}\n\\\\lettrine{“\\2}{\\3}"))
(goto-char (point-min))
(while (re-search-forward "label{\\(.*\\)}\n«~\\([A-Z]\\)\\([a-z]*\\)" nil t)
(replace-match "label{\\1}\n\\\\lettrine{«~\\2}{\\3}"))
(if ffx (if ffx
(progn (progn
(goto-char (point-min)) (goto-char (point-min))
@ -221,15 +224,16 @@
(replace-match "\\begin{document}\n\\pagestyle{plain}" nil t))))) (replace-match "\\begin{document}\n\\pagestyle{plain}" nil t)))))
(goto-char (point-max)) (goto-char (point-max))
(save-buffer) (save-buffer)
(unless draftmode ;; (unless draftmode
(shell-command (shell-command
(format "xelatex -interaction=batchmode %s" (format "xelatex -interaction=batchmode %s"
(shell-quote-argument (buffer-file-name)))) (shell-quote-argument (buffer-file-name))))
(shell-command (shell-command
(format "xelatex -interaction=batchmode %s" (format "xelatex -interaction=batchmode %s"
(shell-quote-argument (buffer-file-name))))) (shell-quote-argument (buffer-file-name))))
;; )
(kill-current-buffer)) (kill-current-buffer))
(unless draftmode ;; (unless draftmode
(delete-file "FFXYevon.ttf") (delete-file "FFXYevon.ttf")
(if (file-exists-p (concat (file-name-base) ".aux")) (if (file-exists-p (concat (file-name-base) ".aux"))
(delete-file (concat (file-name-base) ".aux"))) (delete-file (concat (file-name-base) ".aux")))
@ -241,5 +245,6 @@
(delete-file (concat (file-name-base) ".toc"))) (delete-file (concat (file-name-base) ".toc")))
(if (file-exists-p "texput.log") (if (file-exists-p "texput.log")
(delete-file "texput.log")) (delete-file "texput.log"))
(delete-file texfile)) (delete-file texfile)
;; )
(message "Done"))) (message "Done")))

@ -119,6 +119,9 @@
(while (re-search-forward "  :" nil t) (while (re-search-forward "  :" nil t)
(replace-match " :")) (replace-match " :"))
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "#+TITLE :" nil t)
(replace-match "#+TITLE:"))
(goto-char (point-min))
(while (re-search-forward " !" nil t) (while (re-search-forward " !" nil t)
(replace-match "!")) (replace-match "!"))
(goto-char (point-min)) (goto-char (point-min))

@ -0,0 +1,4 @@
# name: latex-indent
# key: texindent
# --
@@latex:\hspace{28pt}@@
Loading…
Cancel
Save