Customization of LyX
I have decided to switch to LyX from EXP because LyX is open source and native to Linux (getting EXP to run again when Wine was changed was really getting annoying). LyX is very similar in philosophy to the way that I used EXP, and so the switch has been pretty painless. However, there were a few things that bugged me, that I have customized.
- I like using the plain LaTeX class article with the amsthm package. I'm not really a fan of the class amsart. So I modified the article layout and amsmaths file. Put the files article_with_amsthms.layout and amsthms_for_article.inc in your ~/.lyx/layouts directory. You also might need to modify or generate a ~/.lyx/textclass.lst file.
- Some of the keystrokes in LyX don't quite do what I want. While the key bindings files allow a large amount of customization, they do not allow different behaviors in text mode and math mode. What I wanted was for the Enter key to exit the current math box (like the space bar), and for the Math-Mode key to exit math mode instead of creating a text box inside math mode. As far as I can tell, there is no way to do this just with the configuration files. So I modified the InsetFormulaBase::localDispatch procedure of mathed/formulabase.C. I changed LFUN_BREAKPARAGRAPH (and friends) to have the same behavior as LFUN_END. LFUN_BREAKPARAGRAPH is what Enter is mapped to, and it turns out that LFUN_END has better behavior than space, since the cursor moves to the end of the current math box if not already there, and exits if at the end. It also exits a text box in math mode.
Update: Well, there's a bit of a problem. When typing a macro (like \alpha), then Enter ends the macro and pops you out of math mode. The behavior I want is just ending the macro. So I test if we're in a macro (mathcursor->inMacroMode()), and if so, then fall through (ie, copy the code) to the LFUN_MATH_INSERT code with "\n" as the argument. This was the old behavior of Enter in this case.
I changed LFUN_MATH_MODE such that when we're not in text mode, I do the same thing that LFUN_BUFEND does. This action shoots us completely out of the current math mode and positions the text to the right. Perfect!
Or is it? How do we get a text box in math mode? Looking at what the LFUN_MATH_MODE code does in math mode, we can substitute the LFUN_FONT_FREE action instead. Binding Ctrl-T to "font-free" gives a text box!
- I also bound CapsLock to math mode, which is very convenient (after all, do you really use CapsLock?). Of course, CapsLock can't be bound directly, so I remap CapsLock to F3 using xkb trickery. I'm almost certainly doing this the wrong way, so I'd appreciate knowing what the right way of doing this is.
| Back |
This page last modified October 15, 2005. |