Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have created the code below to highlight the parts where something need to be completed by the students. It works, but

  • instead of frames there should be a light colored background
  • this background would appear just before the part will be uncovered to know where is the next problem to solve
  • the beamerarticle form should not have the frames (background color is all right)

My code:

\documentclass{beamer}
\newcommand{\frameuncover}[2]{\framebox{\uncover<#1>{#2}}}

\begin{document}

\begin{frame}[fragile]
  {Hamming distance}

    The Hamming distance of the code below is \frameuncover{5-}{4}.

\begin{verbatim}
a 01010101
b 00001111
c 00110010
\end{verbatim}

d(ab) = \frameuncover{2-}{4}

d(bc) = \frameuncover{3-}{5}

d(ac) = \frameuncover{4-}{5}

\end{frame}

\end{document}
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Edit: fixed the wiggle by using even more phantom and colorbox with the background color.

If I understand you right, this would do the trick, the first option would be for the appearance of the color box, the second for the color of the box and the last one the actual text.

There is a problem with showing the last slide hence the \only<5>{} just to show the final slide.

\documentclass{beamer}

\definecolor{custom}{rgb}{1,0.8,0.8}

\newcommand{\coloruncover}[3]{\temporal<#1>{\colorbox{bg}{\phantom{#3}}}{\colorbox{#2}{\phantom{#3}}}{\colorbox{bg}{#3}}}

\begin{document}

 \begin{frame}[fragile]
  {Hamming distance}

  The Hamming distance of the code below is \coloruncover{4}{custom}{4}\only<5>{}.

  \begin{verbatim}
   a 01010101
   b 00001111
   c 00110010
  \end{verbatim}

  d(ab) = \coloruncover{1}{custom}{4}   d(bc) = \coloruncover{2}{custom}{5}  d(ac) = \coloruncover{3}{custom}{5}

\end{frame}

\end{document}

enter image description here

share|improve this answer
    
now that I see the gif, I noticed that the text wiggles when the last box is displayed. I guess that could be done nicer. –  jenson_bo Nov 20 '12 at 12:23
    
I should have written better example, where the wiggling can be seen more easily. Sometimes this wiggling can cause to have one more line in the frame. I want to avoid it. –  Arpad Horvath Nov 20 '12 at 21:05
    
I remember that one can measure the width and height of a text (or other object) in LaTeX. Perhaps it could be used. –  Arpad Horvath Nov 20 '12 at 21:25
    
I can not compile this code. I got: No file x.nav. ) Runaway argument? ! File ended while scanning use of \next. <inserted text> \par <*> x.tex ? –  Arpad Horvath Nov 21 '12 at 10:17
    
This is a problem of verbatim. Apparently the \end{frame} of a fragile frame needs to be at the beginning of a new line - no spaces! –  jenson_bo Nov 21 '12 at 13:11
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.