[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[BUG] org-latex-preview with custom sty file
From: |
chris |
Subject: |
[BUG] org-latex-preview with custom sty file |
Date: |
Tue, 11 Apr 2023 16:54:14 -0000 |
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
org-latex-default-packages-alist
org-latex-packages-alist
org-format-latex-options
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.
Best,
Chris
- [BUG] org-latex-preview with custom sty file,
chris <=