On 2019-04-15, Enrico Forestieri wrote:
> On Mon, Apr 15, 2019 at 12:16:26PM +0200, Jean-Marc Lasgouttes wrote:

>> Le 12/04/2019 à 05:23, Isaac Oscar Gariano a écrit :
>> >   * It supports unicode input. LyX seems supports this as well, but when
>> >     I put '→' in the autocorrect file instead of '\rightarrow' it shows
>> >     in lyx with a different font, however it still outputs \rightarrow
>> >     in the LaTeX. It would be nice if I could change the font lyx uses
>> >     here, so I could at least copy and paste unicode symbols from other
>> >     programs.

>> I will pass on this one. Could someone comment on the use of unicode in
>> math?

(Unless using non-TeX fonts and Unicode math,) the formula inset accepts
and stores (supported) Unicode characters but writes them as LICR
commands to the LaTeX file.

So you can paste → into LyX and it is accepted in both, text and math mode.

The look in the GUI is differs from a rightarrow inserted as \rightarrow.

Copy paste *from* LyX varies: you get \rightarrow if it is from a math inset
(both LICR and literal char) and the litera → if it is from normal text.


> I am not sure I understand the question. LyX supports all unicode
> symbols defined in the unicodesymbols file. If one tries to paste
> on of such symbols, by default, LyX inserts a \text inset and then
> the literal unicode point corresponding to the symbol

It depends on LaTeX support:

* Some characters are supported in text and math mode (eventually with
  different LICR). For example → becomes either \textrightarrow or
  $\rightarrow$.
  
* Some characters are only supported in math mode and will be wrapped
  in a math inset if inserted in text mode.
  
* Some characters are only supported in text mode and will be wrapped
  in a text-in-math inset if inserted in math mode, e.g. the upright micro
  sign becomes $\text{\textmu}$ in the LaTeX file (and when copy-pasted back
  becomes \text{\textmu}).

...

> When exporting to latex, the definition in the unicodesymbols file
> is used, otherwise an error occurs because LyX does not know how to
> translate that codepoint to something understood by latex.

Unless using non-TeX fonts and Unicode math.

> Independently of the ability to translate to latex the symbol, one
> can copy such symbol from LyX and paste it to some other application.
> However, the symbol representing '\rightarrow' on screen will be
> pasted as the latex code '\rightarrow' and not '→'.

> Just to complete the description, if one dissolves the \text inset,
> the math version from the unicodesymbols file is used for the
> pasted symbol. So, pasting '→', when exporting to latex, one gets
> '\text{\textrightarrow}'. By dissolving the \text inset, the '→'
> now becomes '\rightarrow'.

Günter

Reply via email to