1

I want to \raggedleft only the content of each frame in Beamer. I tried this

\documentclass{beamer}
\usepackage{etoolbox}
\AtBeginEnvironment{frame}{\raggedleft}
\begin{document}
  \begin{frame}
    Some text
  \end{frame}
\end{document}

but it doesn't work as expected.

By content I mean the part shown in this image: content of frame

2
  • 1
    How are contents of a \raggedleft (aka "right-aligned") itemize list supposed to look like? Should each item's "bullet" be \raggedleft as well, or should the bullets be left-aligned whereas the contents should be right-aligned? Please advise.
    – Mico
    Sep 1, 2019 at 6:04
  • @Mico I just need the contents to be right-aligned and not to change the location of bullets.
    – 01000110
    Sep 1, 2019 at 6:26

2 Answers 2

3

Try some definitions:

\makeatletter
\let\LTX@item\@item
\def\my@item[#1]{\LTX@item[#1]\hfill}
\def\rebinditem{\let\@item\my@item}
\def\revertitem{\let\@item\LTX@item}
\makeatother

Then use them as follows:

\begin{frame}
 \frametitle<presentation>{Euclid's algorithm}
 \begin{minipage}{.65\textwidth}
  \begin{enumerate} \rebinditem % <<<-----    
  \item Pseudo-code: 
  \item {\tt function GCD($a$, $b$) \{}
   \begin{itemize}%\revertitem  %<<-- uncomment if desired    
    \item {\tt if ($b =0$) return $a$;}% 
    \item \raggedleft {\tt Let $r$ be the remainder\\ when you divide $a$ by $b$}% <<--- multiline item needs \raggedleft    
    \item {\tt return GCD($b$, $r$);}% 
   \end{itemize}
  \item  \}
  \end{enumerate}
 \end{minipage}
\end{frame}

This approach should work with any document class, not just beamer.

Here's how this looks, with extra colours, using a local Beamer template

2

An simple solution (for fun):

\documentclass{beamer}

\begin{document}
\begin{frame}
\frametitle{My desired ugly enumerated list ...}
   \begin{enumerate}
\item\hfill Some shorter text
\item\hfill Some long, long, long, long, long, long, long, long text which occupay at least two
\item\hfill And short text again
   lines
   \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 .