GNU bug report logs - #78586
TeX-make-inline

Previous Next

Package: auctex;

Reported by: "Paul D. Nelson" <ultrono <at> gmail.com>

Date: Sun, 25 May 2025 14:03:02 UTC

Severity: normal

Done: "Paul D. Nelson" <ultrono <at> gmail.com>

Full log


Message #8 received at 78586 <at> debbugs.gnu.org (full text, mbox):

From: Arash Esbati <arash <at> gnu.org>
To: "Paul D. Nelson" <ultrono <at> gmail.com>
Cc: 78586 <at> debbugs.gnu.org
Subject: Re: bug#78586: TeX-make-inline
Date: Tue, 27 May 2025 14:57:56 +0200
Hi Paul,

"Paul D. Nelson" <ultrono <at> gmail.com> writes:

> We had discussed in an earlier thread (bug#78006) the possibility of
> adding some of my editing commands to AUCTeX (as standalone commands,
> without default binds).

Thanks for sharing.  I have some comments below:

> We could start with this one, discussed a bit in that thread:
>
> (defcustom TeX-make-inline-delims '("$" . "$")
>   "Delimiters for `TeX-make-inline' to surround inline LaTeX math."
>   :type '(radio (const :tag "Dollar ($...$)" ("$" . "$"))
>                 (const :tag "Paren (\\(...\\))" ("\\(" . "\\)"))
>                 (cons :tag "Custom delimiters"
>                       (string :tag "Left") (string :tag "Right"))))

Do we really need this?  Can we just take the value of
`TeX-electric-math', and make an assumption if it's nil?

> (defun TeX-make-inline ()

This function is LaTeX centric, right?  So I would call is
`LaTeX-make-inline-math' or something and put it in latex.el.

>   "Convert LaTeX display math environment at point to inline math.
> Removes the enclosing math environment (such as \\[...\\] or
> \\begin{equation}...\\end{equation}).  Replaces it with inline math
> surrounded by `TeX-make-inline-delims',

surrounded by `TeX-electric-math' if non-nil, or \"$..$\",

> fitting the result onto one
> line.  Leaves any trailing punctuation outside the math delimiters."
>   (interactive)
>   (when (texmathp)
>     (when (fboundp 'preview-clearout-at-point)
>       (preview-clearout-at-point))
>     (save-excursion
>       (let* ((env (car texmathp-why))
>              (pos (cdr texmathp-why))
>              (delims TeX-make-inline-delims))

(delims (or TeX-electric-math '("$" . "$")))

>         (cond
>          ((member env '("\\(" "$")))
>          ((member env '("\\[" "$$"))
>           (goto-char pos)
>           (delete-char 2)
>           (let ((start (point))
>                 (end-delim (if (equal env "\\[") "\\]" "$$")))
>             (search-forward end-delim)
>             (delete-char -2)
>             (TeX-make-inline--finalize-region start (point) delims)))
>          (t
>           (goto-char pos)
>           (kill-line)
>           (let ((start (point)))
>             (search-forward (concat "\\end{" env "}"))
>             (beginning-of-line)
>             (kill-line)
>             (TeX-make-inline--finalize-region start (point) delims))))))))
>
> (defun TeX-make-inline--finalize-region (start end delims)

(defun LaTeX--whatever-we-agree-to (...)

Would it be possible to write an ERT-test for feature?

> I haven't prepared this as a patch because I'm not sure where to put it
> or where to document it.  I looked around, and couldn't find a natural
> place.

I will have a look, will try to make a suggestion.

> For what it's worth, there are a couple of other editing-related
> commands I'd be inclined to propose.

👍

Best, Arash




This bug report was last modified 3 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.