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.
Continue reading Emulating Kav-Mafrid (em-dash) for the David Font
Tag: LaTeX
Getting Hyperref to Work with Hebrew (in XeTeX)
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.
Continue reading Getting Hyperref to Work with Hebrew (in XeTeX)
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.
Drawing Finite Automata and State Machines
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 forrank
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).
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
Continue reading LaTeX Error: Command \textquotedbl unavailable in encoding HE8
Equality-at and Relation-at LaTeX Macros.
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.
Continue reading Equality-at and Relation-at LaTeX Macros.
Notes About Using amsmath split Environment In Hebrew Documents
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.
Continue reading Notes About Using amsmath split Environment In Hebrew Documents
Add Explanation to LaTeX Formulas (Equations)
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
.
Continue reading Add Explanation to LaTeX Formulas (Equations)
Installing IvriTex-1.2.1 on teTex-3.0
Few days ago I finally decided to install Ivritex-1.2.1 on my system. I’m running a tetex-3.0. The new version of Ivritex includes some very important improvements and, at least for me, the most important thing is support for the Culmus fonts. tetex-3.0 introduced a major directory change which cause many problem with installing packages which are unaware of the changes. In this post I will try to walk through the installation process.
TEXMF will be the directory of you local TeX tree (usually /usr/share/texmf). Before Begining the installation process make sure you have the Culmus fonts installed. Apparently Culmus is not optional it’s a requirement. I’ll assume that your Culmus fonts are installed in /usr/share/fonts/culmus.
- Download the ivritex-1.2.1 source-code from here .
- Extract the archive into a temporary directory.
- Save the diff file below a file named “Makefile_patch” and save it inside ivritex-1.2.1/fonts/culmus .
- Apply the patch by going to the ivritex-1.2.1/fonts/culmus directory (under the directory where you extracted the source archive) and executing “patch Makefile_patch. The patch will alter the places where some file will be installed.
- As root execute “updmap –enable Map culmus.map”.
- Still as root execute “mktexlsr”.
- Ivritex 1.2.1 should be installed now.
--- Makefile 2007-02-14 19:59:52.000000000 +0200 +++ Makefilenew 2007-02-16 10:11:07.000000000 +0200 @@ -20,8 +20,8 @@ vf_target = $(TEX_ROOT)/fonts/vf/culmus # this is where ivritex will eventually be: tex_target = $(TEX_ROOT)/tex/generic/babel -encode_dir = $(TEX_ROOT)/dvips/base -dvips_cfg_dir = $(TEX_ROOT)/dvips/config +encode_dir = $(TEX_ROOT)/fonts/enc/dvips/base +map_dir = $(TEX_ROOT)/fonts/map/ sysconf = $(DESTDIR)/etc updmap_dir = $(sysconf)/texmf/updmap #culmus_target = $(PREFIX)/fonts/culmus @@ -137,11 +137,11 @@ mkdir -p $(sysconf)/texmf/updmap.d echo "Map culmus.map" >$(sysconf)/texmf/updmap.d/10culmus.cfg else - mkdir -p $(dvips_cfg_dir) - cp culmus.map $(dvips_cfg_dir)/ + mkdir -p $(map_dir) + cp culmus.map $(map_dir)/ ifeq ($(tetex_ver),2) # this should run mktexlsr as well - $(updmap) --enable Map $(dvips_cfg_dir)/culmus.map + $(updmap) --enable Map $(map_dir)/culmus.map else # for tetex-1 ifeq ($(tetex_ver),1) # TODO: fill in sed line here
Prevent Line Breaking Inline Formula in Tex/Latex
If you ever wrote a document in latex (or tex) that used inline formulas you know how frustrating it is when latex insists on breaking you inline formula across two lines. The easiest solution to this problem, in my opinion is to prevent line breaking inline formulas at all except under extreme cases. To prevent line breaking inline formulas just add the following two lines into your preamble:
\relpenalty=9999
\binoppenalty=9999
Now I will explain what we did. \relpenalty=[number parameter]
the parameter specifies the penalty for breaking a math formula after a relation when the formula appears in a paragraph. Plain TEX sets \relpenalty
to 500. \binoppenalty=[number parameter]
the parameter specifies the penalty for breaking a math formula after a binary operator when the formula appears in a paragraph. Plain TEX sets \binoppenalty
to 700. Both parameters can be set anywhere from 0 to 10000. If set to 10000 the inline formulas will never break even in extreme cases. Setting it a bit lower would prevent line breaking except where tex would encounter extreme cases which must have a line break because of the situation.