TEC <tecos...@gmail.com> writes:

> I’m trying to work out what it is that should be happening with this. Looking 
> at
> `org-edit-footnote-reference’, as you pointed me to, and
> `org-edit-inline-src’:

>From `org-edit-footnote-reference':

--8<---------------cut here---------------start------------->8---
(add-text-properties
 0
 (progn (string-match (if inline? "\\`\\[fn:.*?:" "\\`.*?\\]") contents)
        (match-end 0))
 '(read-only "Cannot edit footnote label" front-sticky t rear-nonsticky t)
 contents)
 (when inline?
  (let ((l (length contents)))
    (add-text-properties
     (1- l) l
     '(read-only "Cannot edit past footnote reference"
               front-sticky nil rear-nonsticky nil)
     contents)))
--8<---------------cut here---------------end--------------->8---

The equivalent code will prevent a user from changing, deleting the
LaTeX markers, or writing past them : this is not the purpose of the
functionality.

In the same function:

(lambda ()
 (if (not inline?) (delete-region (point) (search-forward "]"))
   (delete-region (point) (search-forward ":" nil t 2))
   (delete-region (1- (point-max)) (point-max))
   (when (re-search-forward "\n[ \t]*\n" nil t)
     (user-error "Inline definitions cannot contain blank lines"))
   ;; If footnote reference belongs to a table, make sure to
   ;; remove any newline characters in order to preserve
   ;; table's structure.
   (when (org-element-lineage definition '(table-cell))
     (while (search-forward "\n" nil t) (replace-match "")))))

LaTeX fragments should not break paragraphs, or tables. So you need to
prevent inserting blank lines, or even newlines characters in the case
of tables.

Regards,

Reply via email to