1

I am trying to create a slide in Beamer, and in one line, I would like to switch from left to right alignment (after haven written some words with left alignment). Unfortunately, I cannot use \hfill, as the text I would like to have right aligned is too long (it doesn't fit in one line, so part of the text would be left aligned in the new line). I used raggedleft which works fine, however it seems that "About my topic" gets also right aligned or at least indented (what I don't want). Is there a way so that "About my topic" is written similar to "About me" and "Some other stuff", but the name of the topic is right aligned as seen in the picture below?enter image description here

Thank you very much!

This is my code (the problematic line is "About my topic"):

\documentclass[•]{beamer}

\newenvironment{itemlist}[1]{%
\begin{trivlist}
\item \textbf{\large #1}
\begin{itemize}
}{%
\end{itemize}
\end{trivlist}
}

\begin{document}

\begin{frame}{Titel}
\begin{itemlist}{About me}
  \item Studying XXX in YYY
  \item Some additional information
\end{itemlist}
\begin{itemlist}{About my topic \footnotesize \raggedleft ("This is the name of my very interesting topic which is too long for one line") \\}
  \item Topic information 1
  \item Topic Information 2
\end{itemlist}
\begin{itemlist}{Some other stuff}
  \item Stuff 1
  \item Stuff 2
\end{itemlist}
\end{frame}

\end{document}
  • Of course, one quick and dirty solution would be \begin{itemlist}{About my topic \footnotesize ("This is the name of my very interesting topic \linebreak \phantom{x} \hfill which is too long for one line") \\} However, this solution doesn't look nice to me (as code as well as the output in the pdf) – Unicorn May 2 '18 at 17:28
2

I'd use \hfill - It does not matter if your text is more than one line.

\documentclass{beamer}

\newenvironment{itemlist}[1]{%
\begin{trivlist}
\item \textbf{\large #1}
\begin{itemize}
}{%
\end{itemize}
\end{trivlist}
}

\begin{document}

\begin{frame}{Titel}
\begin{itemlist}{About me}
  \item Studying XXX in YYY
  \item Some additional information
\end{itemlist}
\begin{itemlist}{About my topic \footnotesize \hfill \raggedleft ("This is the name of my very interesting topic which is too long for one line") \\}
  \item Topic information 1
  \item Topic Information 2
\end{itemlist}
\begin{itemlist}{Some other stuff}
  \item Stuff 1
  \item Stuff 2
\end{itemlist}
\end{frame}

\end{document}

enter image description here

  • Thanks for the quick answer, that works fine. I'm still wondering, as I am almost certainly sure I tried hfill myself and it didn't work (see above). Don't know what my mistake was. – Unicorn May 2 '18 at 17:40

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.