Skip to content

czhang03/unicode-math-vscode

Repository files navigation

Unicode Math Input For VSCode

A fast and intuitive way to insert unicode math characters (and even Emoji 😯) using LaTeX command in any document!

Disclaimer: This extension is still under active development, all configurations/functionalities are subject to radical change until the 1.0 release. However, I will try my best to make configuration backward compatible if possible.

Install And Info

From OpenVSX

Open VSX Version Open VSX Rating

From VSCode Marketplace

Visual Studio Marketplace Version Visual Studio Marketplace Last Updated Visual Studio Marketplace Rating

From GitHub Release

GitHub release (latest by date) CodeQL

Features

Autocompletion

In any language, when you type \, this extension will start suggesting possible latex input. Autocompletion will also preview the character that you are currently typing

NOTICE, when LaTeX Workshop is activated, the \ trigger seems to be taken by LaTeX Workshop, you can set custom trigger string in the setting. I personally set the trigger strings as ["\", ";"] in my LaTeX project.

Tab Commit (deprecated)

We are phasing out tab commit, it will be disabled in next minor version for better experience.

Reasons to deprecate tab commit:

Rebinding key do not work, since we need to propagate the corresponding key press if the commit is unsuccessful. We can create command for all the keys that need to propagate (one for space, one for tab, and other keys that don't need to propagate), but that is not a good user experience.

Tab commit is also not a good experience in general, it is one more key to press to commit a command.

Tab commits has key conflict with completion, which is a very useful and essential feature.

We will replace it with a auto commit feature, which will automatically commit all committable symbol as you type. And of course this will be able to be turned off by setting, per file, or per line.

Custom Trigger String

User can set custom trigger string from setting besides \. they can be any strings, even "LaTeX", and there can be multiple ones. To disable this extension (typically used in LaTeX workspace), just set the trigger strings to empty list.

Custom Font Command

By default there is following font command:

font command font
^ superscript
sup superscript
_ subscript
sub subscript
b bold
bf bold
mbf bold
mathbf bold
i italic
it italic
mit italic
mathit italic
cal \mathcal
mcal \mathcal
mathcal \mathcal
frak \mathfrak
mfrak \mathfrak
mathfrak \mathfrak
bb \mathbb
Bbb \mathbb
mbb \mathbb
mathbb \mathbb
sf \mathsf
msf: \mathsf
mathsf \mathsf
tt \mathtt
mtt \mathtt
mathtt \mathtt
scr \mathscr
mscr \mathscr
mathscr \mathscr

When you type a trigger string (like \) followed by the extension will commit the unicode version of that font. For example \it{ABC} will be committed to 𝐴𝐵𝐶.

NOTICE: not all math font (including super and subscript) of common characters are supported in unicode. When the char do not have the math font, the extension will not convert anything.

Diagnostics

The extension will show diagnostics for texts that can be converted to unicode, and provide code action to convert them to unicode. This can be disabled per line by: adding UNICODE-MATH-INPUT: Do not warn current line to a line.

In the future there will be ways to disable per file, by setting, or disable/enable it until/from a certain line.

Known Issue: When a command is preceded/followed by characters in |()[]:!#$%&*+./<=>?@^-~\;{}, since all of these are valid characters in a command. For example the \top in (\top) or the \sigma in \sigma_{} will not be recognized by the diagnostic.

Disable in language

This extension can be configured to be dynamically disabled in all files with some language ids.

License Notice

Unicode Math Input For VSCode is free software is released under GPLv3 or later license

Unicode Math Input For VSCode is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Unicode Math Input For VSCode is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Unicode Math Input For VSCode. If not, see https://www.gnu.org/licenses/.

Acknowledgement

This project is a rewrite of Fast Unicode Math Characters by Guido Tapia.

The mapping from latex to unicode is provided by

The icon is provided by Material Design Icons, released under Apache2.0 license.

This project is definitely not possible without these projects.

Roadmap

  • auto-commit instead of tab commit.
  • disable diagnostics per file.
  • disable/enable feature from/until a certain line
  • push a warning when commit failed with font command.
  • Combine font command, like bold italic etc.
  • make the subscript _ and superscript ^ special trigger strings
  • custom symbols.
  • detect custom font/symbol has overlap.
  • detect testing environment and raise error for code that should not be reachable.
  • reverse search font command or latex command.
  • automated CI documentation.
  • automatically pull character from upstream.
  • automatically PR to upstream.
  • Screenshots/GIF on the readme.
  • more tests.