0

So I'm trying to use LyX with beamer in order to create a presentation. When I try to use itemize in LyX, I want it to look something like that:

\begin{itemize}\raggedleft
\item ניסיון
\end{itemize}

Can I do it without manually typing the LaTeX code? Thanks.

EDIT: Here is an example:

%% LyX 2.3.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english,hebrew]{beamer}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Frank Ruehl CLM}
\setsansfont[Mapping=tex-text]{Simple CLM}
\setmonofont{Miriam Mono CLM}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
% this default might be overridden by plain title style
\newcommand\makebeamertitle{\frame{\maketitle}}%
% (ERT) argument for the TOC
\AtBeginDocument{%
  \let\origtableofcontents=\tableofcontents
  \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
  \def\gobbletableofcontents#1{\origtableofcontents}
}

\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{polyglossia}
\usetheme{Berlin}

% RTL frame title
\setbeamertemplate{frametitle}
{\vspace*{-1mm}
\nointerlineskip
\begin{beamercolorbox}[sep=0.3cm,ht=2.2em,wd=\paperwidth]{frametitle}
   \vbox{}\vskip-2ex%
   \strut\hskip1ex\insertframetitle\strut
   \vskip-0.8ex%
\end{beamercolorbox}
 }
% RTL triangle for itemize
\setbeamertemplate{itemize item}  
{\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleleft$}}

\makeatother

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
\begin{frame}{שקף ראשון}
\begin{itemize}
\item בלה
\item בלה
\end{itemize}
\end{frame}

\end{document}

And this is the result, using XeTeX: This is the result (using XeTeX)

3
  • Welcome to TeX.SX! Could you elaborate a bit on what part of that code you want to automate?
    – siracusa
    Sep 10, 2018 at 9:47
  • yes, I specifically want to automatically insert the raggedleft command in each itemize section. Sep 10, 2018 at 9:55
  • Okay, I've attached an example. Sep 10, 2018 at 11:24

1 Answer 1

2

You could replace the hard coded \raggedright in the definition of itemize and enumeration with \raggedleft:

% !TeX TS-program = xelatex

\documentclass[english,hebrew]{beamer}
\usepackage{fontspec}
\setsansfont[Mapping=tex-text]{Arial}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
% this default might be overridden by plain title style
\newcommand\makebeamertitle{\frame{\maketitle}}%
% (ERT) argument for the TOC
\AtBeginDocument{%
  \let\origtableofcontents=\tableofcontents
  \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
  \def\gobbletableofcontents#1{\origtableofcontents}
}

\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{polyglossia}
\usetheme{Berlin}

% RTL frame title
\setbeamertemplate{frametitle}
{\vspace*{-1mm}
\nointerlineskip
\begin{beamercolorbox}[sep=0.3cm,ht=2.2em,wd=\paperwidth]{frametitle}
   \vbox{}\vskip-2ex%
   \strut\hskip1ex\insertframetitle\strut
   \vskip-0.8ex%
\end{beamercolorbox}
 }
% RTL triangle for itemize
\setbeamertemplate{itemize item}  
{\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\blacktriangleleft$}}


\renewcommand{\itemize}[1][]{%
  \ifblank{#1}{}{\def\beamer@defaultospec{#1}}%
  \ifnum \@itemdepth >2\relax\@toodeep\else
    \advance\@itemdepth\@ne
    \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
    \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
    \list
      {\usebeamertemplate{itemize \beameritemnestingprefix item}}
      {\def\makelabel##1{%
          {%
            \hss\llap{{%
                \usebeamerfont*{itemize \beameritemnestingprefix item}%
                \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
          }%
        }%
      }
  \fi%
  \beamer@cramped%
%  \raggedright%
    \raggedleft%
  \beamer@firstlineitemizeunskip%
}


\def\beamer@enum@{%
  \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
  \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
  \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
  \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
  \expandafter
    \list
      {\usebeamertemplate{\beamer@enumtempl}}
      {\usecounter\@enumctr%
        \def\makelabel##1{{\hss\llap{{%
                \usebeamerfont*{enumerate \beameritemnestingprefix item}%
                \usebeamercolor[fg]{enumerate \beameritemnestingprefix item}##1}}}}}%
  \beamer@cramped%
%  \raggedright%
    \raggedleft%
  \beamer@firstlineitemizeunskip%
}

\makeatother

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
\begin{frame}{שקף ראשון}
\begin{itemize}
\item בלה
\item בלה
\end{itemize}

\begin{enumerate}
\item בלה
\item בלה
\end{enumerate}
\end{frame}

\end{document}

enter image description here

You must log in to answer this question.

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