LyX: keyboard layout


In LyX, under Tools> Preferences> Editing> Keyboard / Mouse , where Keyboard is , there is a checkbox for Use Keyboard Layout . Nobody knows why he is?


This seemingly inconspicuous checkbox provides a fairly significant edge between LyX and other "true LaTeX editors". I will not say that LyX has an advantage over these editors in all respects due to its insufficient competence in this matter, but from this side it definitely surpasses them. So, this function is needed so that from one keyboard (without switching the input language, which, however, is not important yet), you can enter unusual (there, diacritics, etc.) characters.
Namely: we press the View button for the first and Select for the second keyboard (where these buttons are located is indicated in the first post of this topic) and install by selecting the appropriate files with the .kmap extension (just in case, I will say that these files are located in C:\Program Files\LyX 2.0\Resources\kbd ), as it is most convenient, which language (which keyboard layout) on which keyboard (first or second) to hang. Click the Save button and the settings dialog box will close (in this case, you can click the Apply button, then you can do something in the main LyX window without limiting the functionality, write there, execute commands of all menus without closing the Settings dialog box, but we click Save , because we should preferably restart LyX right away). Then, again, it's best to restart LyX. The input language in the LyX window is set to English. Switching layouts is carried out by the keyboard shortcuts Alt + K + 1 or Alt + K + 2 respectively. The Alt + K + Т combination switches between the selected layouts in a circle (as it says in the manual). Well, these are all little things. I would like to point out, however, that the manual says that this feature does not work on all systems. And, indeed, for me, on Windows 7 maximum (before that on professional), this works (worked) only partially: when the first one specifies any layout, switching to the second does not occur. But on the other hand, when you enable this function, regardless of the selected first layout, when switching to mathematical ( Ctrl + M ) or off ( Ctrl + Shift + M ) modes, the input language becomes English! When exiting the mathematical (or off) mode (you can click with the mouse outside the rectangle indicated by the red corners, in which the cursor is at the moment of entering the mathematical formula, or with the cursor navigation buttons), the input language again becomes the one indicated in the first keyboard. This is very convenient when you write something with mathematical formulas in a language other than English: do not switch the input language a hundred times to English (for entering formulas) and back to your own language. However, not every language has a corresponding .kmap file in the folder I named above. It does not exist, in particular, for the Russian language. Therefore, it needs to be made. This is done quite simply. Copy and paste the null.kmap file into the same folder, rename it to russian.kmap (I suspect that the null.kmap file is intended for this purpose, in order to directly produce the .kmap file the user .kmap from it, but just in case I touch it did not, but made his own). And insert the following lines into russian.kmap :

\kmap q й
\kmap w ц
\kmap e у
\kmap m ь
\kmap "," б
\kmap "." ю
\kmap "6" ‚
\kmap "7" .
\kmap "@" \"
\kmap "^" ;
\kmap "&" : 
\kmap "`" ё
\kmap "~" Ё
\kmap "$" $

\kmap Q Й
\kmap W Ц
\kmap E У
\kmap R К
\kmap L Д
\kmap : Ж
\kmap "”" Э
\kmap Z Я
\kmap X Ч
\kmap C С
\kmap V М
\kmap B И
\kmap N Т
\kmap M Ь
\kmap "<" Б
\kmap ">" Ю

that is, the line has the following structure: "\ kmap" "character of the English layout" "character of the Russian layout (or rather, the Kazakh layout: I prefer it more, because there the most common punctuation marks – period and comma – are located on different keys when almost all letters of the Russian language, only the letters "Ё" and "ё" are absent, because they are not in the Kazakh alphabet, which can be easily filled with Alt codes of characters), located on the same key with the previously entered English character "(probably, rather in total, the Russian symbol does not have to be set from one key with the encoded English letter, I have not tried it, I don’t need it). Dots represent missing letters. That's all, close the russian.kmap file with saving changes, which, which echoes the one I wrote above, and select it for the first layout (using the View button, which I mentioned above), you can choose nothing for the second layout. Restart LyX. Set the input language to English. At the same time, he begins to write in Russian letters so that which Russian letter you press, he will display this in the LyX window, when switching to the mathematical or off mode (without annoying switching the input language with the mouse) he displays the Latin character in the LyX window, which you and pressed. IMHO, very convenient. I will note that, despite all my attempts, I did not succeed in making the letter "E" work this way: the quotation mark flies out and that's it. Well, it doesn't matter: this letter is used relatively rarely, so when necessary, press and hold the Alt key, enter 1 , 5 , 7 sequentially from the numeric keypad, release the Alt key. In the LyX window, where the cursor is blinking, the letter "E" will appear. Just in case, I upload my russian.kmap file . So, well, that's all. I tried to write as clearly as possible.

Scroll to Top