2

I try to have command working as \alt but with the behaviour of \onslide, I mean that doesn't move things around when appears.

I try the following solution, but at some point, there is a sliding from one line to the next. On my example, there is enough room for the word zeros but not for \dots.

Any idea to achieve that ?

\documentclass{beamer}

\newcommand{\Alt}[2][\dots]{\only<.-.>{#1}\onslide<+->{{#2}}}

\begin{document}
\begin{frame}[t]
\begin{enumerate}[<+->]

\item Ne pas oublier qu'un décimal peut s'écrire avec des
    \alt<+->{zéros inutiles si besoin.}{\dots}

\item Ne pas oublier qu'un décimal peut s'écrire avec des
    \Alt{zéros inutiles si besoin.}

\item Ne pas x x x oublier qu'un décimal peut s'écrire avec des
    \Alt{zéros inutiles si besoin.}

\end{enumerate}

Must not move.

\end{frame}
\end{document}

enter image description here

1

1 Answer 1

3

To avoid the problem with shrinking and stretching inter-word spaces, you could use \RaggedRight and to prevent the linebreak in front of the dots, try \nolinebreak

\documentclass{beamer}
\usepackage{ragged2e}

\begin{document}
\begin{frame}[t]
\begin{enumerate}[<+->]
\RaggedRight

\item Ne pas x xxx x oublier qu'un décimal peut s'écrire avec des
\only<.>{\nolinebreak\dots }\visible<+->{zéros inutiles si besoin.}

\end{enumerate}

Must not move.

\end{frame}
\end{document}

enter image description here

7
  • The first slide is not a problem, as I have found asolution at the second, but this solution as an issue as you can see on the third slide. In termes of room, onslide, uncover and visible work the same: visible doesn't solve the problem on third slide. thank you.
    – Tarass
    Commented Sep 30, 2017 at 15:59
  • @Tarass now I see what your problem is. Can you test my edited answer? Commented Sep 30, 2017 at 16:33
  • \RaggedRight is a problem because it cuts words, and I prefer not in a presentation. Even so, des moves now from one line the other. I excpect better ;-) Thank you for the lead \nolinebreak, I'll try in this direction.
    – Tarass
    Commented Sep 30, 2017 at 16:55
  • \nolinebreak\dots{} with a space at the end works fine. Add it in your answer. As you have found the clue of \nolinebreack.
    – Tarass
    Commented Sep 30, 2017 at 16:58
  • @Tarass I added the space to my answer (it does not make any difference for me) Commented Sep 30, 2017 at 17:38

You must log in to answer this question.

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