Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.

Fri, 29 May 2020 15:32:47 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Fri, 29 May 2020 15:32:47 -0500
changeset 24
7c7d9c0a314d
parent 20
2f22cc1afaad
child 25
08aa7e744f79

Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.

README.md file | annotate | diff | comparison | revisions
syntaxes/LaTeX.tmLanguage.json file | annotate | diff | comparison | revisions
--- a/README.md	Thu May 14 17:45:50 2020 -0500
+++ b/README.md	Fri May 29 15:32:47 2020 -0500
@@ -10,9 +10,12 @@
   a) Highlighting for the `todonotes` package: `\todo` as well as custom-defined
      `\XYtodo` for author initials `X` and `Y`.
 
-  b) Footnote highlighting (`\footnote`, `\footnotemark`, and `\footnotetext`).
+  b) Likewise (custom-defined) `\reply` and `\XYreply` macros are highlighted to
+     allow discussion of document review.
 
-  c) Highlighting of `comment` environments as comment blocks.
+  c) Footnote highlighting (`\footnote`, `\footnotemark`, and `\footnotetext`).
+
+  d) Highlighting of `comment` environments as comment blocks.
 
 The highlighting of todo-notes and footnotes has to be specifically configured:
 see below.
@@ -20,7 +23,7 @@
 ### Regarding `todonotes` and `footnote` support
 
 Unfortunately, VSCode does not appear to let extensions contribute token colours
-for syntax highlighting. Therefore, to enable syntax highlighting for `\todo` and
+for syntax highlighting. Therefore, to enable syntax highlighting for `\todo`, `\reply`, and
 `\footnote`, add the following (with possibly customised colours) to your user
 `settings.json` (Cmd+Shift+P, “Open Settings (JSON)”):
 
@@ -38,6 +41,16 @@
                 "foreground": "#d17000",
                 "fontStyle": "italic"
             }
+        },
+        {
+            "scope": [
+                "entity.name.todo.reply.latex",
+                "support.function.todo.reply.latex",
+            ],
+            "settings": {
+                "foreground": "#d17000",
+                "fontStyle": "italic bold"
+            }
         }
     ]
 }
@@ -51,4 +64,10 @@
 ```
 (The colour setting here only affects LaTeX output, not VSCode.)
 
+To define `\reply` for discussion inside todonotes, a simple one is
+```tex
+\newcommand{\reply}[1]{\textbf{#1}}
+```
+
+
   [texlab]: https://marketplace.visualstudio.com/items?itemName=efoerster.texlab
--- a/syntaxes/LaTeX.tmLanguage.json	Thu May 14 17:45:50 2020 -0500
+++ b/syntaxes/LaTeX.tmLanguage.json	Fri May 29 15:32:47 2020 -0500
@@ -995,6 +995,42 @@
       ]
     },
     {
+      "begin": "((\\\\)(?:[a-zA-Z][a-zA-Z])?reply)((?:\\[[^\\[]*?\\])*)(\\{)",
+      "beginCaptures": {
+        "1": {
+          "name": "support.function.todo.reply.latex"
+        },
+        "2": {
+          "name": "punctuation.definition.function.latex"
+        },
+        "3": {
+          "patterns": [
+            {
+              "include": "#optional-arg"
+            }
+          ]
+        },
+        "4": {
+          "name": "punctuation.definition.todo.reply.begin.latex"
+        }
+      },
+      "contentName": "entity.name.todo.reply.latex",
+      "end": "\\}",
+      "endCaptures": {
+        "0": {
+          "name": "punctuation.definition.todo.reply.end.latex"
+        }
+      },
+      "patterns": [
+        {
+          "include": "text.tex#braces"
+        },
+        {
+          "include": "$base"
+        }
+      ]
+    },
+    {
       "begin": "((\\\\)emph)(\\{)",
       "beginCaptures": {
         "1": {

mercurial