emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: chris <inkbottle007@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [BUG] org-latex-preview with custom sty file
Date: Fri, 24 Feb 2023 18:25:42 +0100	[thread overview]
Message-ID: <3485389.iIbC2pHGDl@pluto> (raw)

Dear all,

How to do it:

My org-latex-preview related config:

(with-eval-after-load 'org 
     (add-to-list 'org-latex-packages-alist '("" "stmaryrd" t)) 
     (add-to-list 'org-latex-packages-alist '("" "tikz-cd" t)) 
     (add-to-list 'org-latex-packages-alist '("" "thisisastupidtestfile" t)) 
     (setq org-latex-create-formula-image-program 'dvisvgm) 
     (setq org-format-latex-options 
           (plist-put org-format-latex-options :scale 0.80)))


in some org file (`hello.org`), add this latex formula:
`\(\calT \llbracket \tau_H \rrbracket \)`
Invoke `org-latex-preview` (`C-c C-x C-l`).
Open `thisisastupidtestfile.sty` which is situated in the same directory as our `hello.org` file.
Change the definition of: `\newcommand{\calT}{\mathcal{T}}` to `\newcommand{\calT}{\mathcal{K}}` and invoke `org-latex-preview`.

Result: There is no way you can have the image regenerated.

Analysis: the image is associated to the latex input through some hash function (see below). Editing `thisisastupidtestfile.sty` doesn't change the arguments of the hash function, consequently the image isn't regenerated.

I understand org-latex-preview images are associated to latex expression through some hash function:
(sha1 (prin1-to-string
       (list org-format-latex-header
	     forbuffer value fg bg)))

Now if I edit my custom sty file, the output of the hash function won't change, and therefore the generated image won't change neither.

Note: I haven't been able to compute the return value of the hash function for my latex expression, because I can't figure out what the arguments actually are, specifically `forbuffer`, `fg` and `bg`, but the above reasoning seems sound.
Note: Removing specifically the images looking like the image associated with the latex expression that refuses to be regenerated, using some file manager, and then invoking `org-latex-preview`, does the trick, but it's impractical.


             reply	other threads:[~2023-02-24 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 17:25 chris [this message]
2023-02-24 17:49 ` [BUG] org-latex-preview with custom sty file Timothy
2023-02-24 18:29   ` chris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3485389.iIbC2pHGDl@pluto \
    --to=inkbottle007@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).