10

In LyX, if I go to the insert delimiters menu, I can insert a norm. Is there way to attach a shortcut to this?

By norm, I am referring to the double bar on each side.

Mico
  • 506,678
countunique
  • 253
  • 3
  • 8

2 Answers2

10
  1. Go to Preferences > Editing > Shortcuts.
  2. Click on "New".
  3. Under "Function", enter "math-delim Vert Vert" (note the capital V's).
  4. Click on the blank rectangle and then use the key combination that you want for a shortcut.
  5. Click OK.
  6. Click Apply.

In general, to find the function that you need to enter, use LyX with debug mode. If you are using Ubuntu, one way to do this is to run "lyx -dbg action" instead of "lyx". Now, all of the functions will be printed to the terminal. So when you go to the insert delimiters menu and click on the norm delimiters, the terminal will give you the function that is being run.

scottkosty
  • 13,164
  • The expression "math-delim | |" also works. Actually it has already been assigned the shortcut Alt-M | in my LyX version. – e-birk Jan 31 '13 at 16:58
  • @e-birk That is useful as well. I think both notations are common for the norm. I was under the impression that the user wanted double bars on each side. – scottkosty Jan 31 '13 at 19:57
  • True, the number of bars was not specified and I was only thinking of one bar. "math-delim Vert Vert" gives double bars while "math-delim | |" gives single bars. – e-birk Feb 02 '13 at 10:51
0

Another way to do this is with math macros (see 1, 2, 3).

  1. Go to insert > math > macro

  2. A box should popup in your document that looks like this:enter image description here

  3. Change newmacroname to whatever you want. I'll call it "norm".

  4. In the two empty boxes, we need to provide the TeX and LyX code. In this case, that is \Vert\{\#1}\Vert. Type this manually into LyX, as copying and pasting seems to cause issues with the escape characters. The {#1} is a parameter, telling LyX to put your cursor in that spot after inserting the symbol. When you're done it should look as follows:pic2

  5. At any point AFTER the definition of the macro, you can simply type \norm in math mode, to use the macro. Since macros only work after the definition, I suggest you keep all macro definitions together at the beginning of your document. At any rate, it should look something like this. Note that the cursor helpfully snaps to the the proper place to add the vector of which we are taking the norm. cursor The final result is: result