Guy Rutenberg

Keeping track of what I do

Archive for the ‘LaTeX’ Category

\lyxframeend Undefined when Using Beamer with Lyx

with 8 comments

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.

Written by Guy

July 22nd, 2009 at 5:40 pm

Posted in LaTeX,Tips

Tagged with , , ,

Emulating Kav-Mafrid (em-dash) for the David Font

without comments

The David font that is used in Culmus-LaTeX lacks support of Kav-Mafrid, the ligature that is created by two consecutive dashes, --. Because the regular Hebrew dash, Maqaf, is position near the top of the line, one can’t use it instead of the Kav-Mafrid and expect a graphically pleasant result (while Kav-Mafrid can replace Maqaf and the text would still look ok). To make things even more problematic, this ligature is supported by Culmus-LaTeX’s default font, Frank Ruehl, which means one can’t easily switch fonts without hurting the layout.
Read the rest of this entry »

Written by Guy

July 11th, 2009 at 9:37 am

Posted in LaTeX,Tips

Tagged with , ,

Getting Hyperref to Work with Hebrew (in XeTeX)

without comments

The hyperref package is notoriously known to cause problem with RTL text, which unfortunately include Hebrew. In this post I present some preliminary workarounds that enable the user to use the hyperref package with Hebrew and possibly other RTL languages. The solution requires XeTeX which is available in TeXLive. I had no success, yet, to port the workaround to pdfTeX, which is more popular.
Read the rest of this entry »

Written by Guy

June 27th, 2009 at 1:18 pm

Posted in LaTeX

Tagged with , ,

Algorithm Float Label for Hebrew Document

with 2 comments

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.

algorithm-before
Read the rest of this entry »

Written by Guy

June 18th, 2009 at 7:00 pm

Posted in LaTeX,Tips

Tagged with , ,

Displaying Non-Builtin Math Macros in LyX

without comments

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):
math-macro

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

A little explanation how things work. When you define a math macro in LyX, LyX does two things:

  1. Inserts LaTeX code to create the macro.
  2. 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.

Written by Guy

May 13th, 2009 at 9:15 pm

Posted in LaTeX,Tips

Tagged with

Drawing Finite Automata and State Machines

with 5 comments

I had to draw couple of Finite Automata and Turing Machines for some university assignments. Usually I would have done it using Inkscape (as it is my favorite tool for creating figures for my LaTeX documents), but doing it manually is pretty tedious work. Inkscape diagram tool is currently sub par, so everything have to be done by hand. It’s OK if you need to draw one State Machine once in a while, but not suitable for larger quantities. I’ve also tried using Dia, but it also required lots of manual tweaking and tuning.

To my surprise, Graphviz (and especially the dot utility) turned out to be the (almost) perfect tool for the job. It lets you describe the graph in a simple text-based way, and it handles the graph layout by himself. This is somewhat like LaTeX but for graphs (you concentrate on content not layout).

My Finite Automata needed no manual tweaking and resulted in a very nice graphs. For more complicated State Machines it’s sometimes necessary to do some manual tuning. The commands I found most useful to tweak the graph were:

  • Grouping nodes to be in the same level – { rank="same"; "q1"; "q2"; "q3"}. The other options for rank can affect how the group is positioned relative to the other nodes in the graph (source, above all, sink bellow all).
  • Adding weight to edges – q1 -> q2 [weight="10"]. This affects the cost of strecting the edge. The higher the weight the straighter the edges will be.
  • Adding invisible edges – q1 -> q3 [style="invis"]. This allowed me to control the order of the nodes in the same rank (height).

Last but not least Graphivz can generate the graphs in variety for formats including eps, pdf and svg (which allows post-processing with inkscape).

Written by Guy

November 9th, 2008 at 7:05 pm

Posted in LaTeX,Tips

Tagged with ,

LaTeX Error: Command \textquotedbl unavailable in encoding HE8

with 6 comments

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

Read the rest of this entry »

Written by Guy

October 12th, 2008 at 8:08 pm

Posted in LaTeX

Tagged with , ,

Equality-at and Relation-at LaTeX Macros.

without comments

These are two useful LaTeX macros for creating equality-at and (the more general) relation-at signs. These macros depend on the mathtools package. As with all other macros you should add them to you preamble in order to use.

The general macro is the \relat. It takes two arguments, the relation and an expression where the relation takes place (the “at”). The equality-at macro, \eqat is a specific case of \relat. I’ve created it because it is commonly used and only requires passing the “at” argument.
Read the rest of this entry »

Written by Guy

April 19th, 2008 at 8:36 am

Posted in LaTeX

Tagged with

Notes About Using amsmath split Environment In Hebrew Documents

with 4 comments

Recently I’ve worked on a Hebrew document in LaTeX and wanted to use the split environment to typeset some multiline formula. The document which compiled just fine till that point, failed to compile with the following error:

Package amsmath Error: \begin{split} won't work here.

Read the rest of this entry »

Written by Guy

April 9th, 2008 at 7:25 am

Posted in LaTeX,Tips

Tagged with , , ,

Add Explanation to LaTeX Formulas (Equations)

with 4 comments

When writing a document that contains mathematics, many time the need to add an explanation (e.g. stating the theorem used) is raised. To answer this need I wrote two short LaTeX macros: \explain and \explainup.
Read the rest of this entry »

Written by Guy

January 4th, 2008 at 8:28 pm

Posted in LaTeX

Tagged with