auctex-diffs
[Top][All Lists]
Advanced

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

[AUCTeX-diffs] [elpa] externals/auctex b59075b 06/36: Do not insert a ne


From: Tassilo Horn
Subject: [AUCTeX-diffs] [elpa] externals/auctex b59075b 06/36: Do not insert a new line if \label is omitted
Date: Thu, 22 Dec 2016 13:08:11 +0000 (UTC)

branch: externals/auctex
commit b59075b4b6c1db93372b1a6f74e50a564ba2d18e
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>

    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.



reply via email to

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