README.md

Thu, 25 Jun 2020 15:11:15 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Thu, 25 Jun 2020 15:11:15 -0500
changeset 26
c8a6390ebc58
parent 24
7c7d9c0a314d
child 27
f34b09beada4
permissions
-rw-r--r--

Basic changes-package support.
(\replaced does not do second argument yet. Not sure if it is even feasible.)

# latex-syntax

This package provides rich LaTeX _syntax highlighting_ for VSCode. It provides
_only_ syntax highlighting: no annoying snippets etc. that only serve to mess
up your work. It is recommended to be combined with [texlab][]. The latter
provides language intelligence/auto-completion and a build system interface.
The present package complements texlab with richer syntax highlighting. The
grammar is derived from LaTeX-Workshop, but has improvements including

  a) Highlighting for the `todonotes` package: `\todo` as well as custom-defined
     `\XYtodo` for author initials `X` and `Y`.

  b) Likewise (custom-defined) `\reply` and `\XYreply` macros are highlighted to
     allow discussion of document review.

  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.

### 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`, `\reply`, and
`\footnote`, add the following (with possibly customised colours) to your user
`settings.json` (Cmd+Shift+P, “Open Settings (JSON)”):

```json
"editor.tokenColorCustomizations": {
    "textMateRules": [
        {
            "scope": [
                "entity.name.todo.latex",
                "support.function.todo.latex",
                "entity.name.footnote.latex",
                "support.function.footnote.latex"
            ],
            "settings": {
                "foreground": "#d17000",
                "fontStyle": "italic"
            }
        },
        {
            "scope": [
                "entity.name.todo.reply.latex",
                "support.function.todo.reply.latex",
            ],
            "settings": {
                "foreground": "#d17000",
                "fontStyle": "italic bold"
            }
        }
    ]
}
```

Initial-prefixed `\XYtodo` custom todonotes commands are also supported.
For example, `\lstodo{a latex-syntax todo}` will be highlighted if you do
the above colour customisations and in your LaTeX source define
```tex
\newcommand{\lstodo}[2][]{\todo[color=DarkRed!40,#1]{#2}}
```
(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

mercurial