Re: svg file from tikz picture

2023-08-05 Thread Akira Kyle



On Sat, Aug 05, 2023 at 07:29 PM, Bastien Guerry  
wrote:



Ihor Radchenko  writes:


Akira, may I know if you managed to clear the FSF paperwork?


I've just checked and Akira's is a registered FSF contributor 
since

last may.


Unfortunately I was informed that I am only allowed to make 
"small" contributions. I wasn't given any explicit metric of what 
qualifies as a "small" contribution, but was informed that patches 
such as this one are okay for me to contribute.


This is due to my university being unwilling to sign the FSF 
copyright disclaimer without involvement from their legal team 
(although they did sign a standard letter they have saying the 
would never claim copyright over emacs, but that disclaimer does 
not name me personally). I have been informed that this document 
my university has provided is queued with the FSF legal team for 
eventual review.


It's been five years since I initially wrote this patch and two 
years since I started my assignment processes so I haven't really 
had the time or motivation to get this patch into a merge-able 
state. I still use this code quite regularly myself so I'll 
probably get around to working on it again and some point in the 
future.


Akira



[PATCH] ox-html.el: Fix relative links with :html-link-use-abs-url

2023-06-17 Thread Akira Kyle


I'm pretty sure this fixes a bug and that the intended behavior is 
that when publishing with, say, ~:html-link-use-abs-url t~ and 
~:html-link-home mysite.com~, one would expect a link like 
~[[file:my/page.org]]~ to be exported to ~mysite.com/my/page.com~.


I may have have misunderstood something though.

>From e9b8b782dbf956c855e2e3cdec5b9e8aa47d47c1 Mon Sep 17 00:00:00 2001
From: Akira Kyle 
Date: Mon, 27 Feb 2023 12:12:32 -0700
Subject: [PATCH] org-html-link: Fix relative links with :html-link-use-abs-url

* lisp/ox-html.el (org-html-link): When publishing relative links with
both :html-link-use-abs-url and :html-link-home, ensure the correct
link is constructed.
---
 lisp/ox-html.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index b519402b1..27da1cc30 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -3227,7 +3227,7 @@ INFO is a plist holding contextual information.  See
 			 (org-trim (plist-get info :html-link-home)
 	  (when (and home
 			 (plist-get info :html-link-use-abs-url)
-			 (file-name-absolute-p raw-path))
+			 (not (file-name-absolute-p raw-path)))
 		(setq raw-path (concat (file-name-as-directory home) raw-path
 	;; Maybe turn ".org" into ".html".
 	(setq raw-path (funcall link-org-files-as-html-maybe raw-path info))
-- 
2.41.0



Re: svg file from tikz picture

2023-03-25 Thread Akira Kyle



On Sat, Mar 25, 2023 at 06:13 PM, Ihor Radchenko 
 wrote:



Do note that FSF should reply within 5 working days.
If not, please follow up and wait another 5 working days.
They should reply by then, but if still not, let us know - we 
will be

able to push them further.


The last message I received from them was over a month ago and my 
last follow up email to them was ten days ago.





Re: svg file from tikz picture

2023-03-24 Thread Akira Kyle



On Mon, Nov 14, 2022 at 05:52 AM, Ihor Radchenko 
 wrote:



Have you had a chance to look into my comments?


Sorry for the really slow replies, I do intend to follow up on 
this at some point.


Unfortunately, I'm still waiting for my fsf copyright assignment 
paperwork to go through, and I think I'm already at my maximum 
allowed copyright-exempt contributions for emacs.




Re: svg file from tikz picture

2022-09-23 Thread Akira Kyle

I've been using the attached patch for the last few years and I've meaning to 
send it here/start a discussion about ob-latex.el since I used it pretty much 
daily to write tikz figures in org mode. So I'm glad to see this discussion has 
been started!

I've found it to be incredibly productive to use babel to develop tikz diagrams 
as I can make come changes and quickly `org-ctrl-c-ctrl-c` to render them in 
the same buffer.

I think when I made this patch I had been caught by some of the quirks of the 
svg export. For example, sometimes I would have some latex equation which I use 
~org-latex-preview~ on as I was writing it, but then it would fail to render as 
mathjax upon html export since I would use some latex package that isn't 
available under mathjax. So by using ob-latex I could easily fix this by using 
the ~:file .svg~ header and get a nice html export. However due to the 
different way of assembling the ~.tex~ file sometimes ~org-latex-preview~ would 
work but ob-latex wouldn't. I think my use case may be fairly common and so I 
think ob-latex really should be updated so svg uses the ~org-latex-preview~ 
code. o

Also I think the ~.tikz~ extension doesn't really make any sense since one 
really can but arbitrary tex code in such a block, and I think that's why I 
renamed it in my patch. However I'm now realizing that this evaluation method 
probably doesn't make much since `:tangle` will already do this, with the added 
benefit of handling noweb references correctly. So perhaps this should be 
removed and document using tangling in lieu of ~:file *.tikz~?

PS: I'm not currently subbed to this mailing list, so please try to cc me

>From 5d94745dfbe0858d4fd7d6530b821445b06d5013 Mon Sep 17 00:00:00 2001
From: Akira Kyle 
Date: Tue, 4 Jan 2022 14:33:05 -0700
Subject: [PATCH] ob-latex: Create svg images the same way as png images

Also some cleanup of generation .html and .pdf files
---
 lisp/ob-latex.el | 161 +++
 1 file changed, 50 insertions(+), 111 deletions(-)

diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index a86699e22..71b01058c 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -39,7 +39,7 @@
 
 (declare-function org-create-formula-image "org" (string tofile options buffer  type))
 (declare-function org-latex-compile "ox-latex" (texfile  snippet))
-(declare-function org-latex-guess-inputenc "ox-latex" (header))
+(declare-function org-latex-make-preamble "ox-latex" (info  template snippet?))
 (declare-function org-splice-latex-header "org" (tpl def-pkg pkg snippets-p  extra))
 (declare-function org-at-heading-p "org" ( _))
 (declare-function org-back-to-heading "org" ( invisible-ok))
@@ -115,12 +115,6 @@ exporting the literal LaTeX source."
   :group 'org-babel
   :type 'string)
 
-(defcustom org-babel-latex-htlatex-packages
-  '("[usenames]{color}" "{tikz}" "{color}" "{listings}" "{amsmath}")
-  "Packages to use for htlatex export."
-  :group 'org-babel
-  :type '(repeat (string)))
-
 (defun org-babel-expand-body:latex (body params)
   "Expand BODY according to PARAMS, return the expanded body."
   (mapc (lambda (pair) ;; replace variables
@@ -142,132 +136,82 @@ This function is called by `org-babel-execute-src-block'."
 	 (extension (file-name-extension out-file))
 	 (tex-file (org-babel-temp-file "latex-" ".tex"))
 	 (border (cdr (assq :border params)))
-	 (imagemagick (cdr (assq :imagemagick params)))
-	 (im-in-options (cdr (assq :iminoptions params)))
-	 (im-out-options (cdr (assq :imoutoptions params)))
 	 (fit (or (cdr (assq :fit params)) border))
 	 (height (and fit (cdr (assq :pdfheight params
 	 (width (and fit (cdr (assq :pdfwidth params
 	 (headers (cdr (assq :headers params)))
 	 (in-buffer (not (string= "no" (cdr (assq :buffer params)
+	 (imagemagick (cdr (assq :imagemagick params)))
+	 (im-in-options (cdr (assq :iminoptions params)))
+	 (im-out-options (cdr (assq :imoutoptions params)))
 	 (org-latex-packages-alist
-	  (append (cdr (assq :packages params)) org-latex-packages-alist)))
+	  (append (cdr (assq :packages params)) org-latex-packages-alist))
+	 (org-format-latex-header
+	  (concat org-format-latex-header
+		  (mapconcat #'identity (cdr (assq :headers params)) "\n")
+		  (if fit "\n\\usepackage[active, tightpage]{preview}\n" "")
+		  (if border
+			  (format "\\setlength{\\PreviewBorder}{%s}" border) "")
+		  (if height
+			  (concat "\n" (format "\\pdfpageheight %s" height)) "")
+		  (if width
+			  (concat "\n" (format "\\pdfpagewidth %s" width)) "")))
+	 (body (if fit 
+		   (concat "\n\\begin

Suggestion: add org-latex-preview to org-ctrl-c-ctrl-c

2022-09-23 Thread Akira Kyle



I recently thought to add ~org-latex-preview~ to 
~org-ctrl-c-ctrl-c~ and it has been quite the productivity 
booster! Two arguments as to why this should be done:
- ~org-ctrl-c-ctrl-c~ currently does nothing when inside 
 latex-fragment or latex-environment so why not make it 
 ~org-latex-preview~?
- This intuitively matches my muscle memory from using 
 babel. LaTeX is code after all, and I'm often making mistakes, 
 so I want the fastest "edit-compile-edit" loop possible.


Here's what I currently have to achieve this in case anyone wants 
to give it a try right now :)


#+begin_src emacs-lisp
(defun my-org-ctrl-c-ctrl-c-latex-preview-hook ()
 (let ((element (car (org-element-context
   (if (or (eq element 'latex-fragment) (eq element 
   'latex-environment))

   (org-latex-preview

(add-hook 'org-ctrl-c-ctrl-c-final-hook
 'my-org-ctrl-c-ctrl-c-latex-preview-hook)
#+end_src



[O] setting org-html-htmlize-output-type as an export option

2018-10-08 Thread Akira Kyle

Hi,

I've been trying to customize the css of my exported org mode 
files and projects and I've found that in different cases I want 
different settings for org-html-htmlize-output-type. For example 
in a org publish project I may want to set it to css while for 
certain individual files I want it to be inline-css. So far I've 
been just setting this as a file local variable, however it seems 
it would be useful to have an export option to customize this. 
That way I could set it once in say org-publish-project-alist.


Does this seem like a reasonable addition or should I be setting 
this in with a different method? I did come across ~#+BIND:~ and 
it seems like this could perhaps be used to set 
org-html-htmlize-output-type inside a #+SETUPFILE:


Thanks!

Akira