# HG changeset patch # User Tuomo Valkonen # Date 1590784367 18000 # Node ID 7c7d9c0a314d6c0e2cb908bbc88d28867acb3484 # Parent 2f22cc1afaad81e0d301aba02913dc32b06960ee Support custom-defined `\reply` and `\XYreply` for discussion within todonotes. diff -r 2f22cc1afaad -r 7c7d9c0a314d README.md --- 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 diff -r 2f22cc1afaad -r 7c7d9c0a314d syntaxes/LaTeX.tmLanguage.json --- 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": {