# Zero-width space for Persian typing in lyx [closed]

I want to use Lyx to write in Persian. In Persian we have a space character named "zero-width space" or "half-space" and in a standard keyboard, we type it with "Shift-Space" shortcut. It is "U-200C" in utf-8 encoding.

(More about zero-width space: https://en.wikipedia.org/wiki/Zero-width_space)

In Lyx I cannot type that, when pressing "Shift-Space" nothing happens. I tried to specify a new shortcut to mimic that, but Lyx cannot recognize such combination in Persian keyboard. Also, I changed some definitions in .kmap but it didn't work.

I think the problem is that when I hold shift-key, Lyx remap the keyboard and "Shift-Space" has no mean then. Also when I copy-paste some Persian text that include zero-width space, Lyx replaces all of them with simple space. In other latex editors there is no problem, not in typing and not in compiling.

Thank you.

• You might want to report this to the devs as a bug. Unfortunately, this isn’t really a question or on-topic here. This isn’t really something that TeX coding can help you with. – Davislor May 21 at 8:42
• You might be able to type the character with the left-alt key on Windows or the Compose key on Linux, but neither is a great workaround. – Davislor May 21 at 8:43
• If you wanted to make it very explicit in your source that you are using this character, you could define it as ^^^^200c, but that also isn’t what you were asking. – Davislor May 21 at 8:46
• @MdRaHP Are you using the Persian kmap file in LyX? – scottkosty May 21 at 14:22
• A LyX bug report was opened here: tex.stackexchange.com/questions/545399/… – scottkosty May 22 at 13:58

Using LyX 2.3.3 with Linux with UTF-8 system locales and typing the UTF-8 character U+200B will produce this in the hidden LaTeX preamble (visible only in the Code Preview Pane):

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.

\newcommand*\LyXZeroWidthSpace{\hspace{0pt}}


And the character is changed by the \LyXZeroWidthSpace macro in the body of the document, showing nothing in the main edit window.

How to type U+200B is your keyboard is another question, because is OS-dependent, program-dependent and probably keyboard-language dependent.

In my Linux with Spanish keyboard and UTF-8 system locales, is type:

CtrlShift+u200b

I cannot test in Windows, but Google say that, making sure that Num Lock is turned on, you can type this using the numeric keypad:

Alt+{8203} or maybe

Alt+{200}B

That is, maintaining Alt pressed while typing all the numbers with the number keys of the right, but not those usually under the Fx keys.

If none of this work, there must be another specific method for your OS/keyboard to type special uft-8 characters that have not dedicated keys in your keyboard.

The case of U+200C ('ZERO WIDTH NON-JOINER', not "ZERO WIDTH SPACE") is similar, but simpler, since it is substituted by \textcompwordmark that is already defined (therefore, nothing is added to the preamble). In Superuser there a question of how type u+200C that include an answer specific for Persian or Arabic keyboards.