I want to make a shortcut for the \mathbb font (or other fonts) in LyX.
How can I do it?

  • 2
    A tip: You can use backticks ` to mark your inline code as I did in my edit. – jub0bs Dec 8 '13 at 17:36
  • @Jubobs - Thank you! Hope someone will answer! – heblyx Dec 8 '13 at 17:42
  • 1
    i'm not sure exactly what you want. many authors define commands for single letters in particular fonts, for example, a blackboard bold R might be defined as \newcommand{\bbR}{\mathbb{R}}, or for a fraktur M \newcommand{\frM}{\mathfrak{M}}. this, of course, is not specific to lyx. – barbara beeton Dec 8 '13 at 18:48
  • 2
    Are you talking about "keyboard shortcuts"? – karlkoeller Dec 8 '13 at 19:40
  • 3
    You add new shortcuts as described in tex.stackexchange.com/questions/39779/…. The function you need is math-insert \mathbb. – Torbjørn T. Dec 8 '13 at 20:39

New shortcuts are added under Tools --> Preferences --> Editing --> Shortcuts, for details see Shortcuts for Lemma, Claim, Theorem etc. The function you need for the blackboard font is

math-insert \mathbb

The other fonts in the list (under the font button on the math toolbar) has similar functions, just replace \mathbb with the appropriate macro, e.g. math-insert \mathcal.

| improve this answer | |

Alternatively, you could go to [User]/AppData/Roaming/LyX[version]/bind (on Mac or Linux the path would differ), open user.bind with a text editor and insert the following line:

\bind "M-k b" "command-sequence math-insert `\\mathbb`;"

Which would insert a \\mathbb environment on pressing alt+k b.

You could also use

\bind "M-k r" "command-sequence math-insert \\mathbb R; char-right"
\bind "M-k z" "command-sequence math-insert \\mathbb Z; char-right"

Which would insert \\mathbb{R} and \\mathbb{Z}, respectively, and move your pointer out of \\mathbb environment.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.