2

I'm trying to write a Hebrew beamer presentation. I found some very nice template that actually worked from the box (which you can find in this very link, source and author's compiled output) but there are two problems, where my compiled output disagrees with the above:

  1. The first is that the list is flushed to the left (even if it aligned to the right), and this doesn't change even if I enclose it in a flushright environment.

  2. The theorem (second frame) shows up with the title "Theorem" or its Hebrew counterpart defined there. Regardless to any modification and removal of words.

    However, if I disable the theme (Warsaw, and other similar to it) then it works out just peachy (It also works with Hannover-like themes). But there is no box to contain the theorem as usual.

Is there an easy way to overcome this (except not preparing Hebrew presentations with Beamer)?

If it's any relevance, I'm using Arch Linux and texlive; but the problem persists on my Windows 8.1 tablet with MiKTeX (latest).


I managed to correct the second issue by using the Rochester theme. But I'd like to understand how this can be solved for other themes like the Warsaw theme.

The first issue is somewhat more adamant.

0

2 Answers 2

3

LuaLaTeX+Babel+Beamer+Metropolis work quite well for Hebrew presenations: presentation, source. I haven’t tested it for math, though.

Good luck :-)

Here is a local copy of the source linked above:

%! TEX program = lualatex

%%%%%%%%%%
% BEAMER %
%%%%%%%%%%

\RequirePackage{luatex85}
\PassOptionsToPackage{luatex}{hyperref}

\documentclass[luatex]{beamer}

\usetheme{metropolis}

% Fix the title separator
\makeatletter
\setbeamertemplate{title separator}{
    \bgroup
    \bodydir TLT
    \begin{tikzpicture}
        \fill[fg] (0,0) rectangle (\textwidth, \metropolis@titleseparator@linewidth);
    \end{tikzpicture}%
    \egroup
    \par%
}
\makeatother

% Fix the progress bar and make it progress from right to left
\makeatletter
\setbeamertemplate{progress bar in section page}{
    \setlength{\metropolis@progressonsectionpage}{%
        \textwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
    }%
    \bgroup
    \bodydir TLT
    \begin{tikzpicture}
        \fill[bg] (0,0) rectangle (\textwidth, \metropolis@progressonsectionpage@linewidth);
        \fill[fg] (\textwidth,0) rectangle (\textwidth-\metropolis@progressonsectionpage, \metropolis@progressonsectionpage@linewidth);
    \end{tikzpicture}%
    \egroup
}
\makeatother

% A more logical title page, juxtaposing `institute` to `author`. This modification is not necessary for Hebrew support.
\makeatletter
\setbeamertemplate{title page}{
  \begin{minipage}[b][\paperheight]{\textwidth}
    \ifx\inserttitlegraphic\@empty\else\usebeamertemplate*{title graphic}\fi
    \vfill%
    \ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
    \ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
    \usebeamertemplate*{title separator}
    \ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
    \ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
    \ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
    \vfill
    \vspace*{1mm}
  \end{minipage}
}
\setbeamertemplate{author}{\vspace*{2em}\insertauthor\par\vspace*{0.25em}}
\setbeamertemplate{institute}{\insertinstitute\par}
\setbeamertemplate{date}{\vspace*{3mm}\insertdate\par}
\makeatother




%%%%%%%%%
% Babel %
%%%%%%%%%

\usepackage[nil,bidi=basic-r]{babel}
\babelprovide[import=he,main]{hebrew}
\babelprovide[import=en-GB]{english}
\babelprovide[import=cy]{welsh}

% For some reason Babel’s `\babelfont` doesn’t work
\setsansfont[Script=Hebrew]{Open Sans Hebrew}
\setmonofont{Fira Mono}
\renewcommand{\H}[1]{\foreignlanguage{hebrew}{\fontspec[Script=Hebrew]{Open Sans Hebrew}#1}}
\newcommand{\nikud}[1]{$\mbox{\H{#1}}$}
\newcommand{\E}[1]{\foreignlanguage{english}{\fontspec{Open Sans}#1}}
\newcommand{\C}[1]{\foreignlanguage{welsh}{\fontspec{Open Sans}#1}}
\newcommand{\LR}[1]{{‏\textdir TLT #1}}



%%%%%%%%
% MISC %
%%%%%%%%

\usepackage{metalogo, fancyvrb}

\newcommand{\smallurl}[1]{{\footnotesize\url{#1}}}



%%%%%%%%%%%%
% DOCUMENT %
%%%%%%%%%%%%

\begin{document}
\title{מצגות \E{Beamer} בעברית הן בגדר האפשר}
\subtitle{החלום שכולנו חיכינו לו מתגשם סוף כל סוף}
\author{יודה רונן\quad\foreignlanguage{english}{\smallurl{<https://me.digitalwords.net/>}}}
\institute{האגודה הבינלאומית ל\TeX נולוגיה עברית}
\date{אוגוסט 2018}
\frame{\titlepage}


\begin{frame}{שלום עולם!}
    מה יש לנו כאן?

    \begin{itemize}
        \item פתרון מודרני שלם (אך לא מושלם) ליצירת מצגות עבריות ב־\E{Beamer}.
        \item משתמש במחלקות וחבילות הרגילות, ולא דורש תחזוק של פוֹרְקִים עם התאמה לעברית. למעשה, פחות או יותר הכל עובד מהקופסה חוץ מכמה תיקונים קטנים שנדרשים.
        \item המנוע הוא \LuaLaTeX, על הכיווניות אחראית החבילה \E{Babel}, והעיצוב הוא של הערכה \E{Metropolis} האלגנטית, הברורה והנקיה.
    \end{itemize}
\end{frame}


\begin{frame}{על כתפי ענקים}
    ככל הידוע לי, היו לפחות שלושה פתרונות קודמים:
    \begin{itemize}
        \item של \href{https://web.archive.org/web/20111206041733/http://www.technion.ac.il/~ronen/latex/beamer_hebrew.html}{רונן אברבנאל}%
            \footnote{כתובת: \smallurl{https://web.archive.org/web/20111206041733/http://www.technion.ac.il/~ronen/latex/beamer_hebrew.html}}
        \item של \href{https://web.archive.org/web/20150327024158/http://technion.ac.il/~gai/beamer/index.html}{גיא שקד}%
            \footnote{כתובת: \smallurl{https://web.archive.org/web/20150327024158/http://technion.ac.il/~gai/beamer/index.html}}
        \item של \href{https://tug.org/pipermail/xetex/2009-July/013721.html}{ופא ח׳ליקי}%
            \footnote{כתובת: \smallurl{https://tug.org/pipermail/xetex/2009-July/013721.html}}
    \end{itemize}

    כמו שאפשר לראות, שני הראשונים כבר לא נמצאים יותר ברשת באופן עצמאי אלא רק בארכיון האינטרנט.
    הפתרון של רונן לא מתקמפל היטב בגרסאות חדשות;
    של גיא ושל ופא מבוססים על מחלקה לא סטנדרטית.
\end{frame}


\begin{frame}{האקים א׳: קווים מפרידים}
    בגדול הכל עובד ישר מהקופסה. עם זאת, יש כמה דברים קטנים שצריך לשנות, כמו שאפשר לראות בקוד המקור של הקובץ הזה.

    שניים מהם קשורים לקווים המפרידים בשקופיות מיוחדות:

    \begin{itemize}
        \item תיקון של הקו המפריד בכותרת.
        \item תיקון של הקו המפריד בסעיפים והחלפת הכיוון שלו כך שיהיה הגיוני (התקדמות מימין לשמאל).
    \end{itemize}
\end{frame}


\begin{frame}{האקים ב׳: ענייני פונטים}
    ושניים קשורים לפונטים:

    \begin{itemize}
        \item משום מה מנגנון בחירת הפונטים של \E{Babel} לא עובד טוב, אז צריך לעקוף אותו ולהשתמש ב־\E{fontspec} ישירות.
        \item ניקוד מוצג נכון רק אם אין מלל לועזי לפניו בפסקה%
            \footnote{אני משער שהפונט העברי חוזר ללא המאפיין \E{\texttt{Script=Hebrew}}, ההכרחי לניקוד.}.
            כדי לעקוף את הבעיה אפשר לשים את המילה המנוקדת בסביבה מבודדת%
            \footnote{לדוגמה, בתוך \E{\texttt{\textbackslash mbox}} בתוך מתמטיקה; לא אלגנטי אבל עובד. אפשר, כמובן, ליצור פקודה יפה שעושה את זה.}.

            \begin{itemize}
                \item ככה זה נראה נכון: \E{abc} \nikud{נִקּוּד}\\
                \item וככה לא נכון: \E{abc} נִקּוּד
            \end{itemize}
    \end{itemize}
\end{frame}


\begin{frame}{האקים ג׳: טבלאות}
    לא בדיוק האק, אלא משהו לשים לב אליו: סדר העמודות בטבלאות הוא משמאל לימין ולא מימין לשמאל.

    \vfill

    \begin{columns}[t]
        \column{0.50\textwidth}
        קלט:\\
        \begin{otherlanguage}{english}
            \bgroup\tt
            \textbackslash begin\{tabular\}\{r|r|r\}\\
            \quad\foreignlanguage{hebrew}{\fontspec{Pragmata Pro}{שמאל}} \&\\
            \quad\foreignlanguage{hebrew}{\fontspec{Pragmata Pro}{אמצע}} \&\\
            \quad\foreignlanguage{hebrew}{\fontspec{Pragmata Pro}{ימין}}\\
            \textbackslash end\{tabular\}
            \egroup
        \end{otherlanguage}

        \column{0.40\textwidth}
        פלט:\\
        \begin{tabular}{r|r|r}
            שמאל &
            אמצע &
            ימין
        \end{tabular}
    \end{columns}
\end{frame}


\begin{frame}{מה לא עובד?}
    הבעיה היחידה שנתקלתי בה ולא מצאתי פתרון עבורה היא בביבליוגרפיה עם \E{Bib\LaTeX}. רוב הרשומות ב־\E{\texttt{\textbackslash printbibliography}} מסתדרות מעולה, ושומרות על כיווניות בלי בעיה. לעומת זאת, רשומות של תרגומים שמשתמשות בשדה \E{\texttt{related}} ובשדה \E{\texttt{relatedtype}} עם הערך \E{\texttt{translationof}} מתחרבשות בחלק שמציג את הספר המקורי: כל האותיות מופיעות בסדר הפוך. אם מצאתם פתרון לבעיה, אשמח לשמוע מתחרבשים בחלק שמציג את המקור: כל האותיות מופיעות בסדר הפוך. אם מצאתם פתרון לבעיה, אשמח לשמוע :-) (פרטי יצירת קשר יש בעמוד השער).

    דוגמה לבעיה אפשר לראות בתרגום הוולשי של הארי פוטר במצגת הזאת:\\
    \smallurl{https://ac.digitalwords.net/\#nonacademic-2018-08-23}\\
    קובץ ה־\E{Bib\LaTeX} זמין כאן:
    \smallurl{https://gitlab.com/rwmpelstilzchen/bibliography.bib}
\end{frame}


\begin{frame}{מה צריך עוד לעשות?}
    כאמור, אני נתקלתי רק בבעיה אחת שלא הצלחתי לפתור. יכול להיות שאנשים עם צרכים אחרים משלי יתקלו בבעיות אחרות. אם נתקלת בבעיה כללית, אל תהסס/י לפנות אלי: אם מצאת פתרון, אשמח לשמוע אותו; אם לא מצאת פתרון, אשמח לנסות לעזור.
\end{frame}


\begin{frame}{דוגמה למצגת מורכבת}
    הצורך ביצירת מצגת עברית עלה אצלי עבור הרצאה שהכנתי לכנס מיתופיה 2018 („הארי פוטר וכינויי הגוף השני”), הרצאה שהיא גלגול של הרצאה שהצגתי בכנסים אקדמיים (בלשניים וקלטולוגיים) לקהל הפוטריסטי. לא יכולתי להסתמך על מצגת באנגלית בגלל שלא כולם בקהל קוראים באנגלית באופן שוטף, כך שהייתי צריך לתרגם את המצגת הקיימת שהיתה לי לעברית. \E{PowerPoint} של מיקרוסופט או \E{Impress} של ליברה־אופיס הן לא אופציות: אני מעדיף למות תריסר מיתות משונות לפני שאגע בדברים האלה. מתוך הצורך הגיעה נבירה ב־\url{tex.stackexchange.com} ויצירת הפתרון הזה.

    למה אני מספר את זה? כי אם אתם רוצים לראות מצגת די מורכבת שעובדת יפה עם עברית ושקוד המקור שלה זמין, גשו אל:\\
    \smallurl{https://ac.digitalwords.net/\#nonacademic-2018-08-23}
\end{frame}



\part{ככה נראית שקופית של חלק}
\frame{\partpage}

\section{וככה סעיף לקראת הסוף}

\begin{frame}{הערת־אגב: פונטים למצגות}
    במצגת הזאת משמש הפונט \href{https://en.wikipedia.org/wiki/Open_Sans}{\E{Open Sans}} של סטיב מטסון עם \href{https://yaronimus.wordpress.com/2014/01/19/\%D7\%90\%D7\%95\%D7\%A4\%D7\%9F-\%D7\%A1\%D7\%90\%D7\%A0\%D7\%A1-\%D7\%92\%D7\%95\%D7\%A4\%D7\%9F-\%D7\%A8\%D7\%A9\%D7\%AA-\%D7\%97\%D7\%99\%D7\%A0\%D7\%9E\%D7\%99-\%D7\%91\%D7\%A2\%D7\%99\%D7\%A6\%D7\%95\%D7\%91\%D7\%95-\%D7\%A9\%D7\%9C-\%D7\%99\%D7\%90/}{ההרחבה העברית} שעיצב ינק יונטף („הפונט של הארץ”).
    לדעתי זה פונט מעולה למצגות, בדומה ל־\E{Fira Sans} (הפונט הדיפולטיבי של \E{Metropolis}); $\mbox{אָלֶף}$ (\E{Alef}), עם כל חיבתי אליו, לא מתאים למצגות.
\end{frame}
\end{document}
1

This is just an explanation for the second problem.

It seems that beamer only includes translations for a few languages. For theorems, etc., this seems to be limited to Brazilian, Croatian, English, French, German, Greek, Norsk, Polish, Serbian and Spanish. A note in beamerbasemisc.sty says this about handling of months:

This is suboptimal; for full localization babel should be used.

I have actually used beamer in an unsupported language and I guess this is not uncommon. However, lots of cases won't demonstrate the issue as they won't require beamer-defined text as part of the content of the slides.

I suspect in this case, you'd need to contribute translations for Hebrew to get this working properly. You might be able to redefine the odd thing to get particular presentations working correctly for your own use, though, without doing a full translation. However, as ever with beamer, you probably have to trace what's happening through at least half a dozen files just to unpick the problem. beamerbasetranslator.sty, translator.sty etc.

The language mapping is present in translator-language-mappings.tex:

\DeclareOption{hebrew}         {\trans@use@and@alias{hebrew}    {Hebrew}}

translator.sty inputs this. However, what later happens is that beamer defaults to English when it cannot find a dictionary for Hebrew (because beamer doesn't have one). This is presumably a problem for the majority of languages defined since most of them lack beamer-specific translation dictionaries.

What you might try is to copy the relevant dictionary translator-theorem-dictionary-English.dict to translator-theorem-dictionary-Hebrew.dict and then edit it, changing the names you actually need to use. Make the copy in the relevant directory of TEXMFHOME so that it does not get overwritten on updates. This will avoid errors due to something not being there which beamer expects since you won't delete any translations. But it will allow you to just add translations for terms you actually use. If you do more than this, you should consider submitting your dictionary or dictionaries upstream so that Hebrew will work out-of-the-box.

12
  • Thank you. But babel doesn't work in XeLaTeX (where bidi exists anyway). And I couldn't get babel and beamer to work nicely in LaTeX as it were... Mar 23, 2014 at 0:11
  • @MathPhDStudent It isn't babel. beamer is using its own translation mechanism. (Actually I believe you can use babel in XeLaTeX but it is not really supported - one reason for me to stay with pdfLaTeX!) The point is that beamer will not use whatever multi-lingual support is available - be that babel, polyglossia, whatever - to translate strings. So you will have to provide at least a partial dictionary if you want it to translate those strings into Hebrew.
    – cfr
    Mar 23, 2014 at 0:18
  • And, no, you won't get it to play nicely with babel. That is the point of the comment in the code. It is a comment about beamer. It is saying beamer should use babel (though it does not).
    – cfr
    Mar 23, 2014 at 0:21
  • I guess there's only one solution left... I'll have to write a new LaTeX based document class with all the shindig to support reasonable presentations (even if no "animations" available). Mar 23, 2014 at 0:50
  • @MathPhDStudent Surely it would be easier to provide a dictionary for beamer?! Obviously this would not address the other issue you identified but the second one seems far from insurmountable. Am I missing something? I've done similar things for another language for biblatex though I never attempted complete translation. But beamer uses quite small dictionaries so even providing a complete translation for a language should be quite doable.
    – cfr
    Mar 23, 2014 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.