(require 'svg)
(let ((buf "svg-file-motion-demo")
(ims '(("red" 146 29)
("green" 106 29)
("blue" 151 29))))
(with-current-buffer (get-buffer-create buf)
(erase-buffer)
(visual-line-mode 1)
(insert "tellus. $\\gamma(t) = \\log\\left(\\sqrt{\\tan(t)}\\right)$ Donec hendrerit tempor tellus. $\\chi(y) = \\sqrt{\\frac{1}{\\log(y)}}$ Phasellus lacus. $\\tau(t) = \\exp\\left(\\sqrt{\\exp(t)}\\right)$ Curabitur lacinia pulvinar nibh.
JUMPS HERE")
(goto-char (point-min))
(while (re-search-forward (rx ?$ (* (not ?$)) ?$) nil t)
(let* ((ov (make-overlay (match-beginning 0) (match-end 0)))
(im (pop ims))
(svg (svg-create (nth 1 im) (nth 2 im))))
(svg-rectangle svg 0 0 (nth 1 im) (nth 2 im) :fill-color (car im))
(overlay-put ov 'display (svg-image svg :ascent 'center)))))
(pop-to-buffer buf))