Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Please tell me how to use shortcuts in LyX to implement the codes below

$\sum\limits_{\substack{0<k<p\\\gcd\left(  k,p\right)  =1}}$

Notice that do not use the function of inserting TeX code in LyX!

By the way, it is very easily implemented in Scientific Workplace.

Just like that

  1. Ctrl+sum

  2. Ctrl+F5

  3. TAB

  4. ENTER

  5. Ctrl+l

  6. 0<k<p

  7. ENTER

  8. gcd(k,p)=1

That's all!

The primary difficulty in LyX is that the Step 8 can not be easily implemented, so I ask the question here.

Wait for your elegant solution...

share|improve this question
add comment

1 Answer

I'm not that familiar with LyX, but I think you have to add three new shortcuts to be able to add all of that using keyboard shortcuts only. If you do not know how to do this, see my answer to Shortcuts for Lemma, Claim, Theorem etc.

I added keyboard shortcuts for \substack, \gcd and \left( \right). The LyX functions (and keyboard shortcuts) I used were as follows. You can of course choose whichever keyboard shortcut that suits you and doesn't conflict with existing ones.

  • math-insert \substack


  • math-insert \gcd


  • math-insert \left( \right)


The sequence for inputting your example will then be as follows, assuming you are in math mode:

  1. Alt+MU - enters summation sign
  2. Alt+MX - adds subscript
  3. Alt+ML - adds \limits
  4. Ctrl+Alt+Shift+0 - see above, begins a \substack.
  5. 0<k<p
  6. Ctrl+Enter - starts a new line in the substack ...
  7. - ... but doesn't move the cursor it seems.
  8. Ctrl+Alt+Shift+G - see above, enters \gcd
  9. Ctrl+Alt+Shift+P - see above, enters \left( \right)

    (these two can be done as one, hold down the modifiers and hit G followed by P)

  10. k,p
  11. = 1
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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