[education/rkward/snippets] rkward: RKWardLaTeX.xml for LaTeX snippets started

Stefan Rödiger null at kde.org
Sat Jun 18 21:50:40 BST 2022


Git commit ec813bd4a85b262611dfcc295e2a6105344c36cb by Stefan Rödiger.
Committed on 18/06/2022 at 20:49.
Pushed by srodiger into branch 'snippets'.

RKWardLaTeX.xml for LaTeX snippets started

M  +1    -0    rkward/CMakeLists.txt
A  +85   -0    rkward/RKWardLaTeX.xml

https://invent.kde.org/education/rkward/commit/ec813bd4a85b262611dfcc295e2a6105344c36cb

diff --git a/rkward/CMakeLists.txt b/rkward/CMakeLists.txt
index 8026a97a..884c49e6 100644
--- a/rkward/CMakeLists.txt
+++ b/rkward/CMakeLists.txt
@@ -125,3 +125,4 @@ IF(SharedMimeInfo_FOUND)
 ENDIF(SharedMimeInfo_FOUND)
 
 INSTALL(FILES RKWardRMd.xml DESTINATION ${DATA_INSTALL_DIR}/ktexteditor_snippets/data)
+INSTALL(FILES RKWardLaTeX.xml DESTINATION ${DATA_INSTALL_DIR}/ktexteditor_snippets/data)
diff --git a/rkward/RKWardLaTeX.xml b/rkward/RKWardLaTeX.xml
new file mode 100644
index 00000000..d297e911
--- /dev/null
+++ b/rkward/RKWardLaTeX.xml
@@ -0,0 +1,85 @@
+<snippets name="LaTeX (RKWard)" filetypes="tex" authors="RKWard Team" namespace="SnippetsLaTeX" license="BSD">
+ <script>require("range.js")
+require("cursor.js")
+require("document.js")
+require("view.js")
+
+function fileName() { return document.fileName(); }
+function encoding() { return document.encoding(); }
+function year() { return new Date().getFullYear(); }
+function upper(x) { return x.toUpperCase(); }
+function lower(x) { return x.toLowerCase(); }
+function braces(text) { return "{" + text + "}"}
+function lineCommand(command) {
+    if (view.selectedText().length > 0) {
+        let prefix = view.selection().start.column > 0 ? "\n" : "";
+        let postfix = document.line(view.selection().end.line).length > view.selection().end.column ? "\n" : "";
+        return (prefix + command + " " + view.selectedText() + postfix);
+    }
+
+    let l = view.cursorPosition().line;
+    document.insertText(l, 0, command + " ");
+    return "";
+}
+
+function rangeCommand(command, def) {
+    if (view.selectedText().length > 0) {
+        return command.replace("%%1", view.selectedText());
+    } else {
+        return command.replace("%%1", def);
+    }
+}
+</script>
+ <item>
+  <match>Newline</match>
+  <fillin>\newline</fillin>
+ </item>
+ <item>
+  <match>x=y</match>
+  <fillin>$x = y$</fillin>
+ </item>
+ <item>
+  <match>α Α</match>
+  <fillin>$\alpha A$</fillin>
+ </item>
+ <item>
+  <match>|A|</match>
+  <fillin>$|A|$</fillin>
+ </item>
+ <item>
+  <match>x∈A</match>
+  <fillin>$x \in A$</fillin>
+ </item>
+ <item>
+  <match>P(A∣B)</match>
+  <fillin>$P(A \mid B)$</fillin>
+ </item>
+ <item>
+  <match>Overlined</match>
+  <fillin>$\overline{x}$</fillin>
+ </item>
+ <item>
+  <match>Hat</match>
+  <fillin>$\hat{x}$</fillin>
+ </item>
+ <item>
+  <match>Tile</match>
+  <fillin>$\tilde{x}$</fillin>
+ </item>
+ <item>
+  <match>Subset</match>
+  <fillin>$x \subset B$</fillin>
+ </item>
+ <item>
+  <match>Subset equal</match>
+  <fillin>$x \subseteq B$</fillin>
+ </item>
+ <item>
+  <match>Or</match>
+  <fillin>$A \cup B$</fillin>
+ </item>
+ <item>
+  <match>And</match>
+  <fillin>$A \cap B$</fillin>
+ </item>
+</snippets>


More information about the rkward-tracker mailing list