branch: externals/auctex commit b59075b4b6c1db93372b1a6f74e50a564ba2d18e Author: Arash Esbati <arash.esb...@gmail.com> Commit: Arash Esbati <arash.esb...@gmail.com>
Do not insert a new line if \label is omitted * style/subcaption.el (LaTeX-arg-subcaption-subcaption): Insert a new line only if \label is given. --- style/subcaption.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/style/subcaption.el b/style/subcaption.el index 7a116c2..fc5fc63 100644 --- a/style/subcaption.el +++ b/style/subcaption.el @@ -60,9 +60,13 @@ caption, insert only a caption." ;; Fill the \subcaption paragraph before inserting the \label: (LaTeX-fill-paragraph) (unless star - (LaTeX-newline) - (indent-according-to-mode) - (LaTeX-label currenv 'environment)))) + (save-excursion + (LaTeX-label currenv 'environment)) + ;; Move \label into next line if we have one: + (when (looking-at (regexp-quote "\\label{")) + (LaTeX-newline) + (indent-according-to-mode) + (end-of-line))))) (defun LaTeX-arg-subcaption-subcaptionbox (optional &optional star) "Query for the arguments of \"\\subcaptionbox\" incl. a label and insert them.