Hi

The following drives me crazy, after some testing I came to the conclusion that 
the automatic labeling should, like reftex have the filename as a prefix, so

Instead of 

%<*27>
This estimate needs to be explained, see the referee report for more details.
%</27>


It should be
%<*filename-27>
This estimate needs to be explained, see the referee report for more details.
%</filename-27>


Or 

%<*filename:27>
This estimate needs to be explained, see the referee report for more details.
%</filename:27>

It turns out that I don't understand the modification Arash did on my (stolen) 
counter function and that is why my attempt fails, I attach the diff of what I 
tried.

If somebody has an insight please let me know (I think it is a stupid mistake I 
oversee)

Uwe 

-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
diff --git a/style/catchfilebetweentags.el b/style/catchfilebetweentags.el
--- a/style/catchfilebetweentags.el
+++ b/style/catchfilebetweentags.el
@@ -47,34 +47,35 @@
 ;; Scanning function, stolen from markdown-mode
 (defun LaTeX-catchfilebetweentags-counter-inc ()
   "Increment `LaTeX-catchfilebetweentags-counter' and return the new value."
-  (when (null LaTeX-catchfilebetweentags-counter)
-    (setq LaTeX-catchfilebetweentags-counter 0)
-    (save-excursion
-      (goto-char (point-min))
-      (while (re-search-forward (concat "^%<\\*\\([^>]+\\)>$")
-                                (point-max) t)
-        (let ((fn (string-to-number (match-string 1))))
+  (let ((fn (string-to-number (match-string 1))))
+    (filename (file-name-sans-extension (file-name-nondirectory (buffer-file-name (current-buffer)))))
+    (when (null LaTeX-catchfilebetweentags-counter)
+      (setq LaTeX-catchfilebetweentags-counter 0)
+      (save-excursion
+        (goto-char (point-min))
+        (while (re-search-forward (concat "^%<\\*\\([^>]+\\)>$")
+                                  (point-max) t)
           (when (> fn LaTeX-catchfilebetweentags-counter)
-            (setq LaTeX-catchfilebetweentags-counter fn))))))
-  (setq LaTeX-catchfilebetweentags-counter
-        (1+ LaTeX-catchfilebetweentags-counter)))
+            (setq LaTeX-catchfilebetweentags-counter fn)))))
+    (setq LaTeX-catchfilebetweentags-counter
+          (concat filename   (1+ LaTeX-catchfilebetweentags-counter)))))
 
 (defun LaTeX-env-catchfilebetweentags (_environment)
   "Insert a tag-skeleton defined by `LaTeX-catchfilebetweentags'.
 ENVIRONMENT is ignored."
-  (let* ((fn (when LaTeX-catchfilebetweentags-use-numeric-label
-               (LaTeX-catchfilebetweentags-counter-inc)))
-         (tag  (TeX-read-string
-                (if fn (format "Tag (default %s): " fn) "Tag: ")
-                nil nil (when fn (number-to-string fn)))))
-    (unless (bolp)
-      (newline)
-      (delete-horizontal-space))
-    (save-excursion
-      (insert (concat (format "%%<*%s>" tag)
-                      "\n\n"
-                      (format "%%</%s>" tag)))))
-  (forward-line))
+  (let*
+      ((fn (when LaTeX-catchfilebetweentags-use-numeric-label))
+    (tag  (TeX-read-string
+           (if fn (format "Tag (default %s): " fn) "Tag: ")
+           nil nil (when fn (number-to-string fn)))))
+  (unless (bolp)
+    (newline)
+    (delete-horizontal-space))
+  (save-excursion
+    (insert (concat (format "%%<*%s>" tag)
+                    "\n\n"
+                    (format "%%</%s>" tag)))))
+        (forward-line))
 
 (TeX-add-style-hook
  "catchfilebetweentags"

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to