Fri, 29 May 2020 15:32:47 -0500
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
0 | 1 | # latex-syntax |
2 | ||
4 | 3 | This package provides rich LaTeX _syntax highlighting_ for VSCode. It provides |
4 | _only_ syntax highlighting: no annoying snippets etc. that only serve to mess | |
5 | up your work. It is recommended to be combined with [texlab][]. The latter | |
7 | 6 | provides language intelligence/auto-completion and a build system interface. |
4 | 7 | The present package complements texlab with richer syntax highlighting. The |
8 | grammar is derived from LaTeX-Workshop, but has improvements including | |
0 | 9 | |
5
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
10 | a) Highlighting for the `todonotes` package: `\todo` as well as custom-defined |
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
11 | `\XYtodo` for author initials `X` and `Y`. |
0 | 12 | |
24
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
13 | b) Likewise (custom-defined) `\reply` and `\XYreply` macros are highlighted to |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
14 | allow discussion of document review. |
0 | 15 | |
24
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
16 | c) Footnote highlighting (`\footnote`, `\footnotemark`, and `\footnotetext`). |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
17 | |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
18 | d) Highlighting of `comment` environments as comment blocks. |
0 | 19 | |
5
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
20 | The highlighting of todo-notes and footnotes has to be specifically configured: |
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
21 | see below. |
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
22 | |
0 | 23 | ### Regarding `todonotes` and `footnote` support |
24 | ||
11
3633d38b64bd
Explain that extensions cannot seem to be able to contribute token colours.
Tuomo Valkonen <tuomov@iki.fi>
parents:
9
diff
changeset
|
25 | Unfortunately, VSCode does not appear to let extensions contribute token colours |
24
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
26 | for syntax highlighting. Therefore, to enable syntax highlighting for `\todo`, `\reply`, and |
11
3633d38b64bd
Explain that extensions cannot seem to be able to contribute token colours.
Tuomo Valkonen <tuomov@iki.fi>
parents:
9
diff
changeset
|
27 | `\footnote`, add the following (with possibly customised colours) to your user |
3633d38b64bd
Explain that extensions cannot seem to be able to contribute token colours.
Tuomo Valkonen <tuomov@iki.fi>
parents:
9
diff
changeset
|
28 | `settings.json` (Cmd+Shift+P, “Open Settings (JSON)”): |
0 | 29 | |
30 | ```json | |
1 | 31 | "editor.tokenColorCustomizations": { |
32 | "textMateRules": [ | |
33 | { | |
20
2f22cc1afaad
More compact example colour definition
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
34 | "scope": [ |
2f22cc1afaad
More compact example colour definition
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
35 | "entity.name.todo.latex", |
2f22cc1afaad
More compact example colour definition
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
36 | "support.function.todo.latex", |
2f22cc1afaad
More compact example colour definition
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
37 | "entity.name.footnote.latex", |
2f22cc1afaad
More compact example colour definition
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
38 | "support.function.footnote.latex" |
2f22cc1afaad
More compact example colour definition
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
39 | ], |
1 | 40 | "settings": { |
41 | "foreground": "#d17000", | |
20
2f22cc1afaad
More compact example colour definition
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
42 | "fontStyle": "italic" |
1 | 43 | } |
24
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
44 | }, |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
45 | { |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
46 | "scope": [ |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
47 | "entity.name.todo.reply.latex", |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
48 | "support.function.todo.reply.latex", |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
49 | ], |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
50 | "settings": { |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
51 | "foreground": "#d17000", |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
52 | "fontStyle": "italic bold" |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
53 | } |
1 | 54 | } |
20
2f22cc1afaad
More compact example colour definition
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
55 | ] |
2f22cc1afaad
More compact example colour definition
Tuomo Valkonen <tuomov@iki.fi>
parents:
15
diff
changeset
|
56 | } |
0 | 57 | ``` |
58 | ||
5
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
59 | Initial-prefixed `\XYtodo` custom todonotes commands are also supported. |
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
60 | For example, `\lstodo{a latex-syntax todo}` will be highlighted if you do |
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
61 | the above colour customisations and in your LaTeX source define |
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
62 | ```tex |
7 | 63 | \newcommand{\lstodo}[2][]{\todo[color=DarkRed!40,#1]{#2}} |
5
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
64 | ``` |
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
65 | (The colour setting here only affects LaTeX output, not VSCode.) |
993903fd4434
Support initial-prefixed \XYtodo.
Tuomo Valkonen <tuomov@iki.fi>
parents:
4
diff
changeset
|
66 | |
24
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
67 | To define `\reply` for discussion inside todonotes, a simple one is |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
68 | ```tex |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
69 | \newcommand{\reply}[1]{\textbf{#1}} |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
70 | ``` |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
71 | |
7c7d9c0a314d
Support custom-defined `\reply` and `\XYreply` for discussion within todonotes.
Tuomo Valkonen <tuomov@iki.fi>
parents:
20
diff
changeset
|
72 | |
0 | 73 | [texlab]: https://marketplace.visualstudio.com/items?itemName=efoerster.texlab |