Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not embed inline latex equations exported by dvisvgm in paragraph #714

Open
L-N1988 opened this issue Jun 14, 2023 · 1 comment
Open

Comments

@L-N1988
Copy link

L-N1988 commented Jun 14, 2023

Actual Behavior

I add #+options: tex:dvisvgm to the top of Org file, then C-c C-e H H.
The default output for \(\) or $ latex inline equation is:

<img src="/ltximg/20230613-foo_ff6e86928feda82fc31281adc877b3c3fe57ef35.svg" alt="\(\sum_{k=0}^{\infty} c_k (x-a)^k \)" class="org-svg" />

This standalone svg can not be embeded in context, instead the img breaks paragraph into two parts.

Expected Behavior

I want to export inline latex equations with embed tag by default.

<embed img src="/ltximg/20230613-foo_ff6e86928feda82fc31281adc877b3c3fe57ef35.svg" alt="\(\sum_{k=0}^{\infty} c_k (x-a)^k \)" class="org-svg" />

Example Org File

:PROPERTIES:
:ID:       64906ec7-86c8-4930-9d34-e96a64dab3fc
:END:
#+title: foo
#+options: tex:dvisvgm
#+date: [2023-06-13 Tue 23:15]

Pellentesque dapibus suscipit ligula.  Donec posuere \(\sum_{n=1}^{\infty} a_n z^n\)augue in quam.  Etiam vel tortor sodales tellus ultricies commodo. \(\int_{a}^bf(x)dx = F(b) - F(a)\) Suspendisse potenti.  

Generated Markdown File or Error

+++
title = "foo"
date = 2023-06-13T23:15:00+08:00
draft = false
+++

Pellentesque dapibus suscipit ligula.  Donec posuere <img src="/ltximg/20230613-foo_08e84e1dd07e16d4717c4fc6fbc017940454f709.svg" alt="\(\sum_{n=1}^{\infty} a_n z^n\)" class="org-svg" />augue in quam.  

A awkward method to add embed tag

change function org-blackfriday--update-ltximg-path in ox-blackfriday.el
from

        (format "%s%s%s"
                (match-string-no-properties 1 html-str)
                updated-img-path
                (match-string-no-properties 3 html-str)))

to

        (format "<embed img src=\"%s%s"
                ;; (match-string-no-properties 1 html-str)
                updated-img-path
                (match-string-no-properties 3 html-str)))

Ox-Hugo Debug Information

Debug information for ox-hugo

Emacs Version

GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo version 1.17.6)
 of 2023-01-03

Org Version

Org mode version 9.6.1 ( @ /home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/)

Hugo Version

hugo v0.111.3+extended linux/amd64 BuildDate=unknown

Org load-path shadows

Warning: Possible mixed installation of Org

/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-java hides /usr/share/emacs/28.2/lisp/org/ob-java
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-R hides /usr/share/emacs/28.2/lisp/org/ob-R
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-doi hides /usr/share/emacs/28.2/lisp/org/ol-doi
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-bibtex hides /usr/share/emacs/28.2/lisp/org/ol-bibtex
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob hides /usr/share/emacs/28.2/lisp/org/ob
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-id hides /usr/share/emacs/28.2/lisp/org/org-id
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-lilypond hides /usr/share/emacs/28.2/lisp/org/ob-lilypond
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-css hides /usr/share/emacs/28.2/lisp/org/ob-css
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-exp hides /usr/share/emacs/28.2/lisp/org/ob-exp
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-protocol hides /usr/share/emacs/28.2/lisp/org/org-protocol
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-ocaml hides /usr/share/emacs/28.2/lisp/org/ob-ocaml
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-w3m hides /usr/share/emacs/28.2/lisp/org/ol-w3m
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-list hides /usr/share/emacs/28.2/lisp/org/org-list
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/oc-biblatex hides /usr/share/emacs/28.2/lisp/org/oc-biblatex
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-C hides /usr/share/emacs/28.2/lisp/org/ob-C
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-footnote hides /usr/share/emacs/28.2/lisp/org/org-footnote
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-src hides /usr/share/emacs/28.2/lisp/org/org-src
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-capture hides /usr/share/emacs/28.2/lisp/org/org-capture
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-comint hides /usr/share/emacs/28.2/lisp/org/ob-comint
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-keys hides /usr/share/emacs/28.2/lisp/org/org-keys
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-tangle hides /usr/share/emacs/28.2/lisp/org/ob-tangle
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-publish hides /usr/share/emacs/28.2/lisp/org/ox-publish
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-processing hides /usr/share/emacs/28.2/lisp/org/ob-processing
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-latex hides /usr/share/emacs/28.2/lisp/org/ox-latex
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-python hides /usr/share/emacs/28.2/lisp/org/ob-python
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-goto hides /usr/share/emacs/28.2/lisp/org/org-goto
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-entities hides /usr/share/emacs/28.2/lisp/org/org-entities
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-attach-git hides /usr/share/emacs/28.2/lisp/org/org-attach-git
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-texinfo hides /usr/share/emacs/28.2/lisp/org/ox-texinfo
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-docview hides /usr/share/emacs/28.2/lisp/org/ol-docview
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/oc-csl hides /usr/share/emacs/28.2/lisp/org/oc-csl
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-ref hides /usr/share/emacs/28.2/lisp/org/ob-ref
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-clojure hides /usr/share/emacs/28.2/lisp/org/ob-clojure
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-matlab hides /usr/share/emacs/28.2/lisp/org/ob-matlab
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-mouse hides /usr/share/emacs/28.2/lisp/org/org-mouse
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-js hides /usr/share/emacs/28.2/lisp/org/ob-js
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-rmail hides /usr/share/emacs/28.2/lisp/org/ol-rmail
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-eval hides /usr/share/emacs/28.2/lisp/org/ob-eval
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-feed hides /usr/share/emacs/28.2/lisp/org/org-feed
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-odt hides /usr/share/emacs/28.2/lisp/org/ox-odt
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-attach hides /usr/share/emacs/28.2/lisp/org/org-attach
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-datetree hides /usr/share/emacs/28.2/lisp/org/org-datetree
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-table hides /usr/share/emacs/28.2/lisp/org/ob-table
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-macro hides /usr/share/emacs/28.2/lisp/org/org-macro
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-shell hides /usr/share/emacs/28.2/lisp/org/ob-shell
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-sqlite hides /usr/share/emacs/28.2/lisp/org/ob-sqlite
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-table hides /usr/share/emacs/28.2/lisp/org/org-table
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-element hides /usr/share/emacs/28.2/lisp/org/org-element
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-screen hides /usr/share/emacs/28.2/lisp/org/ob-screen
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-macs hides /usr/share/emacs/28.2/lisp/org/org-macs
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org hides /usr/share/emacs/28.2/lisp/org/org
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-clock hides /usr/share/emacs/28.2/lisp/org/org-clock
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-org hides /usr/share/emacs/28.2/lisp/org/ox-org
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-eshell hides /usr/share/emacs/28.2/lisp/org/ob-eshell
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-pcomplete hides /usr/share/emacs/28.2/lisp/org/org-pcomplete
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-bbdb hides /usr/share/emacs/28.2/lisp/org/ol-bbdb
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-scheme hides /usr/share/emacs/28.2/lisp/org/ob-scheme
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/oc hides /usr/share/emacs/28.2/lisp/org/oc
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-habit hides /usr/share/emacs/28.2/lisp/org/org-habit
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-sass hides /usr/share/emacs/28.2/lisp/org/ob-sass
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-lob hides /usr/share/emacs/28.2/lisp/org/ob-lob
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-maxima hides /usr/share/emacs/28.2/lisp/org/ob-maxima
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-forth hides /usr/share/emacs/28.2/lisp/org/ob-forth
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-calc hides /usr/share/emacs/28.2/lisp/org/ob-calc
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-plot hides /usr/share/emacs/28.2/lisp/org/org-plot
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-lint hides /usr/share/emacs/28.2/lisp/org/org-lint
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-num hides /usr/share/emacs/28.2/lisp/org/org-num
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-emacs-lisp hides /usr/share/emacs/28.2/lisp/org/ob-emacs-lisp
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-irc hides /usr/share/emacs/28.2/lisp/org/ol-irc
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-awk hides /usr/share/emacs/28.2/lisp/org/ob-awk
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-plantuml hides /usr/share/emacs/28.2/lisp/org/ob-plantuml
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/oc-basic hides /usr/share/emacs/28.2/lisp/org/oc-basic
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-koma-letter hides /usr/share/emacs/28.2/lisp/org/ox-koma-letter
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-julia hides /usr/share/emacs/28.2/lisp/org/ob-julia
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-colview hides /usr/share/emacs/28.2/lisp/org/org-colview
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-octave hides /usr/share/emacs/28.2/lisp/org/ob-octave
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-md hides /usr/share/emacs/28.2/lisp/org/ox-md
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-gnuplot hides /usr/share/emacs/28.2/lisp/org/ob-gnuplot
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-man hides /usr/share/emacs/28.2/lisp/org/ol-man
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-gnus hides /usr/share/emacs/28.2/lisp/org/ol-gnus
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-tempo hides /usr/share/emacs/28.2/lisp/org/org-tempo
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-inlinetask hides /usr/share/emacs/28.2/lisp/org/org-inlinetask
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-ctags hides /usr/share/emacs/28.2/lisp/org/org-ctags
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-loaddefs hides /usr/share/emacs/28.2/lisp/org/org-loaddefs
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-refile hides /usr/share/emacs/28.2/lisp/org/org-refile
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-core hides /usr/share/emacs/28.2/lisp/org/ob-core
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-compat hides /usr/share/emacs/28.2/lisp/org/org-compat
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-lisp hides /usr/share/emacs/28.2/lisp/org/ob-lisp
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-crypt hides /usr/share/emacs/28.2/lisp/org/org-crypt
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-dot hides /usr/share/emacs/28.2/lisp/org/ob-dot
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-agenda hides /usr/share/emacs/28.2/lisp/org/org-agenda
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-archive hides /usr/share/emacs/28.2/lisp/org/org-archive
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-eshell hides /usr/share/emacs/28.2/lisp/org/ol-eshell
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox hides /usr/share/emacs/28.2/lisp/org/ox
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-makefile hides /usr/share/emacs/28.2/lisp/org/ob-makefile
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-haskell hides /usr/share/emacs/28.2/lisp/org/ob-haskell
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-sql hides /usr/share/emacs/28.2/lisp/org/ob-sql
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol hides /usr/share/emacs/28.2/lisp/org/ol
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-icalendar hides /usr/share/emacs/28.2/lisp/org/ox-icalendar
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-latex hides /usr/share/emacs/28.2/lisp/org/ob-latex
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-info hides /usr/share/emacs/28.2/lisp/org/ol-info
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-timer hides /usr/share/emacs/28.2/lisp/org/org-timer
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-ascii hides /usr/share/emacs/28.2/lisp/org/ox-ascii
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-mhe hides /usr/share/emacs/28.2/lisp/org/ol-mhe
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-org hides /usr/share/emacs/28.2/lisp/org/ob-org
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-ditaa hides /usr/share/emacs/28.2/lisp/org/ob-ditaa
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-ruby hides /usr/share/emacs/28.2/lisp/org/ob-ruby
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-beamer hides /usr/share/emacs/28.2/lisp/org/ox-beamer
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-perl hides /usr/share/emacs/28.2/lisp/org/ob-perl
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-duration hides /usr/share/emacs/28.2/lisp/org/org-duration
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-sed hides /usr/share/emacs/28.2/lisp/org/ob-sed
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-groovy hides /usr/share/emacs/28.2/lisp/org/ob-groovy
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-indent hides /usr/share/emacs/28.2/lisp/org/org-indent
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-html hides /usr/share/emacs/28.2/lisp/org/ox-html
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-fortran hides /usr/share/emacs/28.2/lisp/org/ob-fortran
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-faces hides /usr/share/emacs/28.2/lisp/org/org-faces
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ol-eww hides /usr/share/emacs/28.2/lisp/org/ol-eww
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ob-lua hides /usr/share/emacs/28.2/lisp/org/ob-lua
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/ox-man hides /usr/share/emacs/28.2/lisp/org/ox-man
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/oc-natbib hides /usr/share/emacs/28.2/lisp/org/oc-natbib
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-mobile hides /usr/share/emacs/28.2/lisp/org/org-mobile
/home/liuning/.emacs.d/elpa/28.2/develop/org-9.6.1/org-version hides /usr/share/emacs/28.2/lisp/org/org-version

Study the output of M-x list-load-path-shadows.

ox-hugo defcustoms

org-hugo-section "posts"
org-hugo-use-code-for-kbd nil
org-hugo-preserve-filling t
org-hugo-delete-trailing-ws t
org-hugo-prefer-hyphen-in-tags t
org-hugo-allow-spaces-in-tags t
org-hugo-tag-processing-functions (org-hugo–tag-processing-fn-replace-with-spaces-maybe org-hugo–tag-processing-fn-replace-with-hyphens-maybe)
org-hugo-auto-set-lastmod nil
org-hugo-export-with-toc nil
org-hugo-export-with-section-numbers nil
org-hugo-front-matter-format "toml"
org-hugo-default-static-subdirectory-for-externals "ox-hugo"
org-hugo-external-file-extensions-allowed-for-copying ("jpg" "jpeg" "tiff" "png" "svg" "gif" "mp4" "pdf" "odt" "doc" "ppt" "xls" "docx" "pptx" "xlsx")
org-hugo-date-format "%Y-%m-%dT%T%z"
org-hugo-paired-shortcodes ""
org-hugo-suppress-lastmod-period 0.0
org-hugo-front-matter-format "toml"
Debug Info
@kaushalmodi
Copy link
Owner

Could this possibly be a CSS issue?

The img tag is an inline HTML tag per spec and it shouldn't force paragraph breaks.

You can try playing with HTML and CSS around img on https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants