tecosaur / LaTeX-Utilities

An add-on to LaTeX Workshop that provides some features that go beyond the bare essentials
MIT License
494 stars 30 forks source link

Working with unicode-math #164

Closed kexplorning closed 4 years ago

kexplorning commented 4 years ago

Feature Request: Working with unicode-math

Unicode Input Method

Sometimes, it seems more clear when the souce code is unicode (not LaTeX macro), e.g.

% load unicode-math package
\begin{align*}
  & \vdash \forall x [(Fx \vee Gx) \to \mathord{\sim} Hx] \\
  & \vDash \neg \exists y \forall x [x \in y \leftrightarrow x \notin x]  \\
  & \nvDash x \cap (y \cup z) \neq (x \cap y) \cup (x \cap z) \\
  & \vdash \lBrack\alpha\rBrack = \aleph_0 \to \alpha \ncong \wp(\alpha) \\
  & \vdash (P \rightfishtail Q) \rightfishtail
    (\mdlgwhtsquare P \rightfishtail \mdlgwhtdiamond Q)
\end{align*}

\begin{align*}
  & ⊢ ∀x [(Fx ∨ Gx) → \mathord{∼} Hx] \\
  & ⊨ ¬∃y∀x[x∈y ↔ x∉x]  \\
  & ⊭ x ∩ (y ∪ z) ≠ (x ∩ y) ∪ (x ∩ z) \\
  & ⊢ ⟦α⟧ = ℵ₀ → α ≇ ℘(α) \\
  & ⊢ (P ⥽ Q) ⥽ (□P ⥽ ◇Q)
\end{align*}

Maybe a solution

Add a selection of Unicode-math in LaTeX math macro snippets.

Or like JuliaLang - unicode input, when user input \neg and then type TAB, it shows ¬ (but obviously TAB conflict with VSCode). Another example is Mathematica's method, using ESC. (I mean if using Mathematica's method, it may make writing more efficient.)

There is a realization in Emacs: https://github.com/Christoph-D/LaTeX-unicode-math-mode

Or maybe a flexible solution is needed, some may think using unicode-math to input \forall, \cup, \vdash, etc. is a good idea, but may think \sum, \int, \cdots, \vdots, etc. is not a good idea. And some character like x, y etc. (using unicode-math strictly) it may be a bad idea. And something like \vec{a}, keep its origin form is a good idea. And for math arrows, it may be too small to distinguish them (\leftarrow, \Leftarrow, \longleftarrow, \Longleftarrow).

Additional context

It may have conflict with converting unicode to LaTeX macro.

tecosaur commented 4 years ago

If you use XeLaTeX, I think you can already achieve a decent solution to this. In XeLaTeX you can define Unicode charachters to represent maths commands, e.g. have expand to \forall. The other half of the functionality can already be done with this extension. Using Live Snippets, just make \forall expand to :smiley: