15

I am preparing Farsi slides in beamer which is a right to left language just like Hebrew. I have problems in the presentation which I briefly discuss:

  • The TOC is left to right:
    alt text

  • The itemize can be forced to be right to left but it flushes to the left
    alt text

  • the frame title is shown in the left (this one is solved thanks to Mr.Vafa Khalighi the solution is \setbeamertemplate{frametitle}[default][right] command) alt text

I found this web site very helpful to solve some problems, but the mentioned problems are still unresolved. the code is shown below

% XeLaTeX can use any Mac OS X font. See the setromanfont command below.
% Input to XeLaTeX is full Unicode, so Unicode characters can be typed directly into the source.

% The next lines tell TeXShop to typeset with xelatex, and to open and save the source with Unicode encoding.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[11pt]{beamer}
\usetheme{Warsaw}
\usecolortheme{crane}
%\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
%\geometry{letterpaper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}
\usepackage{amssymb}


% Will Robertson's fontspec.sty can be used to simplify font choices.
% To experiment, open /Applications/Font Book to examine the fonts provided on Mac OS X,
% and change "Hoefler Text" to any of these choices.
\TeXXeTstate=1
\usepackage{fontspec,xltxtra,xunicode}
 \usepackage{bidi}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{X Zar}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{X Zar}
\setmonofont[Scale=MatchLowercase]{X Zar}
% \newfontfamily{\A}{X Zar}


\title{امنیت در اجرای همروند یک پروتکل احراز اصالت}
\author{یاسر صبحدل}
\date{\today}

\begin{document}
\frame{\titlepage}

\section[چارچوب]{}
\frame{\tableofcontents}

%\maketitle

% For many users, the previous commands will be enough.
% If you want to directly input Unicode, add an Input Menu or Keyboard to the menu bar 
% using the International Panel in System Preferences.
% Unicode must be typeset using a font containing the appropriate characters.
% Remove the comment signs below for examples.


% \newfontfamily{\H}[Scale=0.9]{Lucida Grande}
% \newfontfamily{\J}[Scale=0.85]{Osaka}
\section{مقدمه}
\subsection{مروری بر پروتکلهای احراز اصالت}

\frame
{
\frametitle{محاسبات چندجانبه امن}
\begin{flushright}
از ۳ منظر مورد بررسی قرار می‌گیرد:\\
\end{flushright}
\setRL
{
\begin{itemize}
\item مورد اول
\item مورد دوم
\end{itemize}
}
}

\end{document}

BTW, I just didn't use the \newfontfamily command because the whole document is persian and only some words are english, so I changed the main font with a persian one.

8
  • 5
    Unfortunately there isn't good bidi support for beamer, which is what you would need to solve some of these problems. At least at the moment, the author of bidi doesn't seem willing to provide such support: bit.ly/faDMh0
    – Alan Munn
    Jan 17, 2011 at 13:02
  • Side remark: You should additionally use the polyglossia package (though it won't help with your immediate problem, as it relies on bidi for rtl text).
    – Caramdir
    Jan 17, 2011 at 17:53
  • 1
    @user2716: nothing in therms of rtl (except that it includes bidi). But it does a variety of things that beamer does for standard latex (dates, numerals, etc.)
    – Caramdir
    Jan 19, 2011 at 6:22
  • 1
    @user2716 Vafa, perhaps my choice of words wasn't the best. I realise that the job is a big task, and since everything most of us do is done on a volunteer basis, fixing beamer isn't on your agenda at the moment. Everyone appreciates your work on bidi.
    – Alan Munn
    Jan 20, 2011 at 21:59
  • 1
    @user2716: Are you planning to fill in at least a bit of your profile at some point? (Suggestion: go to tex.stackexchange.com/users/edit/2716 and fill in something better than "user2716" for "Display Name".)
    – SamB
    Jan 21, 2011 at 19:01

2 Answers 2

2

Yasser, use bidipresentation class, at Parsilatex website, you can find useful template and help to achieve your aim.

2
2

This is a solution which uses LuaLaTeX+Babel+Beamer+Metropolis for Hebrew presenations: presentation, source. It is written in Hebrew and for Hebrew, but if you play with the source I’m sure it won’t be difficult to make it work for Persian as well.

Good luck :-)

Addition. Thanks to David Purton’s suggestions, 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}
2
  • 1
    It might be useful to provide a MWE showing this (and the other question you answered on this), rather than links to other sites which might stop working. Aug 25, 2018 at 12:49
  • Good point; thanks. The post has the code now. Aug 25, 2018 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .