Hmmm... I did some work on this before the all-tex-fonts feature branch.
Let me see what I forgot, I'll come back on this...

;-)
/PA

On Mon, 10 Nov 2025 at 04:26, Trevor Murphy <[email protected]>
wrote:

> Hey, folks.  I've been writing more latex in org recently, and I
> stumbled over the bug named in the subject line.  Here's a test case
> you can evaluate in a scratch buffer in emacs -Q:
>
> ```
> (with-temp-buffer
>   (org-mode)
>   (insert "* \\phi wraps
> :PROPERTIES:
> :ALT_TITLE: \\psi should wrap
> :END:")
>   (org-export-as 'latex nil nil t))
> ;; say `eval-print-last-sexp' (C-j)
> ;;
> ;; expected:
> ;; "\\section[\\(\\psi\\) should wrap]{\\(\\phi\\) wraps}
> ;; \\label{...}
> ;; "
> ;;
> ;; actual:
> ;; "\\section[\\psi should wrap]{\\(\\phi\\) wraps}
> ;; \\label{...}
> ;; "
> ```
>
> When this happens in a real export I get a warning and my latex
> compiler (pdflatex) guesses, badly, where to insert dollar signs.
>
> I'd like to fix this.  I dug into the issue and the root cause seems
> kind of gnarly.  When `org-latex-headline' pulls the alt title it
> correctly parses any entities / latex fragments in the property value,
> but it doesn't wrap them into latex-math-block objects because
> secondary string parsing doesn't give :filter-parse-tree functions a
> chance to run.  I couldn't see any way to use the existing machinery
> to do the math-block wrapping, so I just added an extra step in o-l-h.
>
> Patch attached (including a new test).
>
> Note that in developing this patch I worked off of today's main branch
> (commit 2815a6).  Therefore this patch includes an extra diff hunk to
> accommodate 35d12c, even though that commit isn't included in any of
> the release builds.  If you'd prefer a patch that applies cleanly on
> top of the latest release, I can resend without that hunk.
>
> Thanks,
>
> Trevor
>
> Emacs  : GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.50, cairo version 1.18.4)
> Package: Org mode version 9.7.35 (9.7.35-7fbe36 @
> /home/trevor/.emacs.d/elpa/org-9.7.35/)
>


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

"Sagen's Paradeiser" (ORF: Als Radiohören gefährlich war) => write BE!
Year 1 of the New Koprocracy

Reply via email to