Archive for the ‘LyX’ tag
Number Exercises Separately in LyX
Say you’ve got a document with a bunch of exercises and few lemmas. You may want the exercises numbered separately from the numbering of the lemmas and theorem, unlike LyX’s default behavior. This can be achieved by redefining xca, the environment LyX uses for exercises. Add the following to your LaTeX preamble:
\let\xca\@undefined \theoremstyle{plain} \newtheorem{xca}{\protect\exercisename}
LyX will still display the incorrect numbering, but the output will be correct nonetheless. The first line, undefines the LyX’s definition of xca, then we set the style to match the old one and we redefine xca, this time without a reference to the theorems’ counter.
Expectation Symbol in LaTeX
After looking for a builtin expectation symbol in LaTeX, and coming up with none, I’ve defined one. Just add:
% Expectation symbol \DeclareMathOperator*{\E}{\mathbb{E}}
to your LaTeX preamble and you’re done. You’ll also need to add \usepackage{amsmath} or in LyX to tick “Use AMS math package” under Document->Settings->Math Options.
Using the starred version of \DeclareMathOperator makes sure subscripts goes beneath the symbol in display mode.
\lyxframeend Undefined when Using Beamer with Lyx
I’m using LyX for the first time with Beamer. Making the title page was smooth. But when I’ve tried adding a new frame (using BeginFrame) I was confronted with the following error
\lyxframeend
{}\lyxframe{Outline}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.After comparing my document to example (working) beamer documents I’ve found out that you must have an EndFrame command after your last frame.Too bad it wasn’t documented anywhere I’ve found as this little thing drove me crazy.
Algorithm Float Label for Hebrew Document
For a while now I’ve refrained from using the very nice Algorithm environment for LaTeX papers I wrote in Hebrew due to the way it’s label was displayed. The English label was displayed in reverse.
Displaying Non-Builtin Math Macros in LyX
I believe LyX is a great tool for writing LaTeX document. It makes writing formulas very easy and it allows you to see the formula as you are writing, as opposed to seeing only LaTeX code. However LyX doesn’t support every LaTeX package and the macros it defines. Sure it doesn’t stop you from using these macros in your formulas, but it doesn’t display nicely, you see the name of the macro instead of a schematic preview.
While LyX doesn’t support many of the great packages out there like mathtools (which I really hope it will someday), you can add some support to your documents. At the beginning of the document insert a comment, via Insert->Note->Comment. Inside the newly created comment insert a math-macro via Insert->Math->Macro. In the name part, put the name of the command you want to add support for. In the second box (caption LyX), use existing LyX commands to mimic how the macro will look like. For example, this is what it looks like for the \coloneqq macro (from the great mathtools package):

After adding the math macro in the comment, when you will use the macro inside formulas it will display nicely:

A little explanation how things work. When you define a math macro in LyX, LyX does two things:
- Inserts LaTeX code to create the macro.
- Displays the macro nicely when editing the document.
While the latter is desirable, the former is problematic. If LyX inserts LaTeX code to define the existing macro, it will cause errors. So when you put the LyX macro in the comment environment, the code LyX generates gets ignored and only the second, desirable, outcome is achieved.
Fixing Numbering Direction for Hebrew Text in LyX
On Monday, I’ve submitted a patch to the LyX developers mailing list with a fix for the numbering direction in Hebrew text. In Hebrew text the dot appeared before the numbering symbol instead of after it as it should.

This behaviour has been this way for years (at least as long as I can remember).
Read the rest of this entry »
LaTeX Error: Command \textquotedbl unavailable in encoding HE8
I was testing today the SVN version of LyX 1.6.0 and 1.5.7. Due to a change in the way the double quotation mark (“) is handled, adding it to Hebrew text resulted in the following LaTeX error:
LaTeX Error: Command \textquotedbl unavailable in encoding HE8

