emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (Feature Request) have org-edit-special work inside non-environment


From: Nicolas Goaziou
Subject: Re: (Feature Request) have org-edit-special work inside non-environment LaTeX blocks, i.e. \( \) and \[ \]
Date: Mon, 25 May 2020 11:41:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

TEC <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]