{"id":179,"date":"2026-09-10T07:12:40","date_gmt":"2026-09-10T11:12:40","guid":{"rendered":"https:\/\/computermoose.topshot.com\/?p=179"},"modified":"2026-09-10T07:12:41","modified_gmt":"2026-09-10T11:12:41","slug":"using-talmudifier-in-hebrew","status":"publish","type":"post","link":"https:\/\/computermoose.topshot.com\/index.php\/2026\/09\/10\/using-talmudifier-in-hebrew\/","title":{"rendered":"Using Talmudifier in Hebrew"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The son of friends and neighbors of ours wrote his own page of Talmud including Rashi and Tosfot commentaries. He wanted a way to print the page in the same way that an actual page of Talmud appears. I thought it would be easy to instruct the AI program Gemini to create such a page but it wasn&#8217;t. The three sections always appeared as 3 even columns without any wrap-around the actual text of the Talmud. So a different solution was needed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A solution had, indeed, been created and posted on Github, Talmudifier, which seemingly does everything we wanted. From the README file it was clear, however, that a little knowledge of programming was going to be required; my friends needed help and I volunteered.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The process seemed easy enough. Download the code, install it, run it. The download was easy:<br><code>git clone https:\/\/github.com\/subalterngames\/talmudifier.git<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I used my Windows 11 laptop and cygwin to do the git clone. After doing a &#8216;cd&#8217; to folder talmudifier I followed the install instructions and executed<br><code>pip3 setup.py -e .<\/code><br>per the README instructions. Here I saw my first problem. I got the error<br><code>ERROR: unknown command \"setup.py\" trying to install the Talmudifier Python module<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Talmudifier was last modified 6 years ago. Perhaps installing Python modules via the instructions worked then but they didn&#8217;t work now. With help from Gemini (I&#8217;m no Python expert), I found out that the correct command is really <br><code>pip3 install -e .<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Running the actual install also didn&#8217;t work as advertised. I got this error:<br><code>note: This error originates from a subprocess, and is likely not a problem with pip.  ERROR: Failed to build 'cryptography' when installing build dependencies for cryptography<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At that point I was advised to skip trying to install the application on Windows as I would need to install C and Rust compilers as well as development headers. So I switched to my Ubuntu Linux computer which I run inside of Windows as a virtual machine and started over:<br><code>git clone https:\/\/github.com\/subalterngames\/talmudifier.git<br>cd talmudifier<br>python3 -m venv venv<br>source venv\/bin\/activate<br>pip install -e .<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This install also failed but I knew what software was missing. Here are the packaged needed and the commands for installing them:<br><code>sudo apt update<br>sudo apt install python3-dev build-essential python3-pip<br>sudo apt install texlive-xetex texlive-fonts-recommended texlive-plain-generic<br>sudo apt install texlive-lang-other<br>sudo apt install fonts-culmus<br>sudo apt install libhyphen-dev libhyphen0<br>pip install \"setuptools&lt;80.0.0\"<br>pip install --force-reinstall pyhyphen<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With these additional packages installed, the talmudifier build\/install worked fine.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I ran the suggested command to confirm that everything was installed correctly as follows:<br><code>python test_input_reader.py<br><\/code>and indeed, I got the output shown at the github site which looked pretty neat.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The next step is to install the Hebrew fonts that you want to use:<\/p>\n\n\n\n<p><code>cp \/usr\/share\/fonts\/truetype\/culmus\/FrankRuelCLM-Bold.ttf <\/code><code>fonts\/hebrew\/bold.ttf<br>cp \/usr\/share\/fonts\/truetype\/culmus\/FrankRuelCLM-Medium.ttf fonts\/hebrew\/regular.ttf<br>#Additionally, it is important to ensure that you either create a symlink for #the italic\/bold-italic versions or duplicate the regular.ttf file if you do #not have dedicated variants readily available. This will maintain consistency #in your font styles across different text formats.<br>cp \/usr\/share\/fonts\/truetype\/culmus\/FrankRuelCLM-Medium.ttf fonts\/hebrew\/italic.ttf<br>cp \/usr\/share\/fonts\/truetype\/culmus\/FrankRuelCLM-Bold.ttf fonts\/hebrew\/bold_italic.ttf<\/code><\/p>\n\n\n\n\n\n<p class=\"wp-block-paragraph\">If you look in folder \/usr\/share\/fonts\/truetype\/culmus you will see a number of Hebrew fonts that can be used. Note that ttf and otf files can be used interchangeably. Create a recipe for this document:<\/p>\n\n\n\n<p><code>cd recipes<br>cp default.json hebrew.json<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Open file hebrew.json and update the font entries for each column (left, center, right) to point to the new Hebrew font directory so it looks like this:<\/p>\n\n\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p><code>\n{\n  \"fonts\":\n  {\n    \"left\":\n    {\n      \"path\": \"fonts\/hebrew\",\n      \"ligatures\": \"TeX\",\n      \"regular_font\": \"regular.otf\",\n      \"italic_font\": \"italic.otf\",\n      \"bold_font\": \"bold.otf\",\n      \"options\": \"Script=Hebrew\",\n      \"size\": 11,\n      \"skip\": 13,\n      \"substitutions\":\n      {\n        \"`=(.*)`\": \"\\\\\\\\marginnote{\\\\\\\\noindent\\\\\\\\justifying \\\\\\\\tiny \\\\1}\",\n        \"->\": \"\\\\\\\\flowerfont 1 \\\\\\\\leftfont\"\n      },\n      \"citation\":\n      {\n        \"path\": \"fonts\/frankruehl\",\n        \"font\": \"FrankRuehlCLM-Medium.ttf\",\n        \"command\": \"\\\\leftcitation\",\n        \"font_command\":  \"\\\\leftcitationfont\",\n        \"pattern\": \"`L(.*)`\"\n      }\n    },\n    \"center\":\n    {\n      \"path\": \"fonts\/hebrew\",\n      \"ligatures\": \"TeX\",\n      \"regular_font\": \"regular.otf\",\n      \"italic_font\": \"italic.otf\",\n      \"options\": \"Script=Hebrew\",\n      \"size\": 11,\n      \"skip\": 13,\n      \"substitutions\":\n      {\n        \"`L(.*)`\": \"\\\\\\\\leftcitationfont{\\\\\\\\leftcitation \\\\1} \\\\\\\\centerfont \",\n        \"`R(.*)`\": \"\\\\\\\\rightcitationfont{\\\\\\\\rightcitation \\\\1} \\\\\\\\centerfont \"\n      }\n    },\n    \"right\":\n    {\n      \"path\": \"fonts\/hebrew\",\n      \"ligatures\": \"TeX\",\n      \"regular_font\": \"regular.otf\",\n      \"italic_font\": \"italic.otf\",\n      \"bold_font\": \"bold.otf\",\n      \"bold_italic_font\": \"bold_italic.otf\",\n      \"options\": \"Script=Hebrew\",\n      \"size\": 11,\n      \"skip\": 13,\n      \"substitutions\":\n      {\n        \"\\\\|\": \"\u00a7\"\n      },\n      \"citation\":\n      {\n        \"path\": \"fonts\/rashi\/\",\n        \"font\": \"Mekorot-Rashi.ttf\",\n        \"command\": \"\\\\rightcitation\",\n        \"font_command\":  \"\\\\rightcitationfont\",\n        \"pattern\": \"`R(.*)`\"\n      }\n    }\n  },\n  \"character_counts\":\n  {\n    \"one_third\":\n    {\n      \"left\":\n      {\n        \"1\": 29\n      },\n      \"center\":\n      {\n        \"1\": 24\n      },\n      \"right\":\n      {\n        \"1\": 27\n      }\n    },\n    \"half\":\n    {\n      \"left\":\n      {\n        \"1\": 47,\n        \"4\": 183\n      },\n      \"right\":\n      {\n        \"1\": 44,\n        \"4\": 174\n      }\n    },\n    \"two_thirds\":\n    {\n      \"center\":\n      {\n        \"1\": 54\n      },\n      \"right\":\n      {\n        \"1\": 60\n      }\n    }\n  },\n  \"chapter\":\n  {\n    \"definition\": \"\\\\newcommand{\\\\chfont}[1]{\\\\centerfont{\\\\setRTL\\\\huge\\\\textcolor{hcolor}{#1}}}\",\n    \"command\": \"\\\\chfont\",\n    \"numbering\": false\n  },\n  \"colors\":\n  {\n    \"hcolor\": \"D3230C\",\n    \"rcolor\": \"D36F0C\"\n  },\n  \"misc_definitions\": [\n    \"\\\\newcommand{\\\\leftcitation}[1]{\\\\leftcitationfont{\\\\setRTL\\\\Large\\\\textcolor{hcolor}{#1}}}\",\n\t    \\\\newcommand{\\\\rightcitation}[1]{\\\\rightcitationfont{\\\\setRTL\\\\normalsize\\\\textcolor{rcolor}{#1}}}\",\n    \"\\\\newfontfamily\\\\flowerfont[Path=fonts\/fell_flowers\/]{IMFeFlow2.otf}\"\n  ]\n}\n\n<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I had three files that represented the Talmud text that I wanted to display. They were called left (for Rashi), center (actual Talmud text), and right (for Tosfot). In the original sample, all three portions of the display were in one file. So I slightly modified the source file, test_input_reader.py, as follows:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import io\nfrom talmudifier.talmudifier import Talmudifier\n\nif __name__ == \"__main__\":\n    # Read the test page.\n    with io.open(\"ganz\/rashi-1.txt\", \"rt\", encoding=\"utf-8\") as f:\n        left = f.read()\n    with io.open(\"ganz\/gamliel-1.txt\", \"rt\", encoding=\"utf-8\") as f:\n        center = f.read()\n    with io.open(\"ganz\/tosfos-1.txt\", \"rt\", encoding=\"utf-8\") as f:\n        right = f.read()\n\n    # Generate the PDF.\n    t = Talmudifier(left, center, right, recipe_filename=\"hebrew.json\")\n    \n    tex = t.get_chapter(\"Gemora Ganz\") + \"\\n\"\n    tex += t.get_tex()\n    doc = t.writer.write(tex, \"ganz_page\")\n\n    # Output the LaTeX string used to generated the PDF as a .tex file.\n    with io.open(\"Output\/ganz_page.tex\", \"wt\", encoding=\"utf-8\") as f:\n        f.write(doc)\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I called the updated file ganz.py. To run the program, execute:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>python -W ignore ganz.py<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Look in folder Output and you will see the pdf file ganz_page.pdf which, when displayed, shows a nicely formatted Talmud page with one little bug: all the text will be displayed left to right instead of right to left as Hebrew requires. It appears that Talmudifier was never written to handle non-Latin characters (or so it seems to me as I describe now how I fixed the problem).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Unfortunately, fixing the problem requires a manual step, physically modifying file Output\/ganz_page.tex. Copy that file to the talmudifier folder and open it inside a text editor.<br>After line &#8220;\\usepackage{fontspec}&#8221; insert the following lines:<\/p>\n\n\n<p><code><br \/>\n\\usepackage{polyglossia}<br \/>\n\\setdefaultlanguage{hebrew}<br \/>\n\\setotherlanguage{english}<br \/>\n\\usepackage{bidi}<br \/>\n\\setRTL<br \/>\n<\/code><\/p>\n\n\n\n\n<p class=\"wp-block-paragraph\">Then search for &#8220;\\newfontfamily\\&#8221; and add the following lines:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>\\newfontfamily\\hebrewfont[Path=fonts\/hebrew\/]{regular.otf}<br>\\newfontfamily\\hebrewfontsf[Path=fonts\/hebrew\/]{regular.otf}<br>\\newfontfamily\\hebrewfonttt[Path=fonts\/hebrew\/]{regular.otf}<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Save the modified ganz_page.tex file and execute the following command:<\/p>\n\n\n\n<p><code>xelatex ganz_page.tex<\/code><\/p>\n\n\n\n\n\n<p class=\"wp-block-paragraph\">Open the created file ganz_page.pdf in the talmudifier folder and you will then see all the Hebrew text displayed right to left. There is one more fix that is worth doing. Typically, the first word in the Talmudic text is larger than the remaining text. In this case that word was \u05de\u05d3\u05d5\u05e2. So open file ganz_page.pdf again and search for that word. Replace it with the following:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">{\\huge \u05de\u05d3\u05d5\u05e2}<br>Rerun everything and now the text should look just like a real page from the Talmud.<\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>The son of friends and neighbors of ours wrote his own page of Talmud including Rashi and Tosfot commentaries. He wanted a way to print the page in the same way that an actual page of Talmud appears. I thought it would be easy to instruct the AI program Gemini to create such a page &hellip; <a href=\"https:\/\/computermoose.topshot.com\/index.php\/2026\/09\/10\/using-talmudifier-in-hebrew\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using Talmudifier in Hebrew&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[1],"tags":[35,34],"class_list":["post-179","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-talmud","tag-tex"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7qelO-2T","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/posts\/179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/comments?post=179"}],"version-history":[{"count":8,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/posts\/179\/revisions"}],"predecessor-version":[{"id":192,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/posts\/179\/revisions\/192"}],"wp:attachment":[{"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/media?parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/categories?post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computermoose.topshot.com\/index.php\/wp-json\/wp\/v2\/tags?post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}