3

I made ​​a presentation in the form of Questions and Answers.

\documentclass{beamer}
\setbeamercovered{transparent=0}

\usepackage{xcolor}
\usepackage{transparent}

\title{Questions and Answer}
\author{Edy Wihardjo}
\date{}

\newcounter{num}
\setcounter{num}{0}
\newcommand\Que[1]{%
    \leavevmode\par
    \stepcounter{num}
        \noindent
        \hbox{ 
            {\color{blue} \transparent{0.3} \Huge Q{\huge \thenum }} --- #1\par 
        }
    }
\newcommand\Ans[2][]{%
    \leavevmode\par
    \noindent
    \begin{flushright}
        \textbf{#1} #2  --- {\Huge \color{blue} \transparent{0.3} A} \par
    \end{flushright}\par}%}

\begin{document}
\maketitle

\texttransparent{Questions and Answer}}

\begin{frame}
    \Que{First Question?}
    \pause
    \Ans{First Answer!}
\end{frame}

\begin{frame}
    \Que{Second Question?}
    \pause
    \Ans{Second Answer!}
\end{frame}

\end{document}

the problem is:

FirstQue

after displaying the first answer, the first question number changed.

FirstQueAns

1 Answer 1

4

You need to use

\resetcounteronoverlays{<counter>}

to prevent overlays from incrementing counters.

\documentclass{beamer}
\setbeamercovered{transparent=0}

\usepackage{xcolor}
\usepackage{transparent}

\title{Questions and Answer}
\author{Edy Wihardjo}
\date{}

\newcounter{num}
\setcounter{num}{0}

\newcommand<>\Que[1]{%
    \leavevmode\par
    \stepcounter{num}%
        \noindent
        \hbox{% 
            {\color{blue}\transparent{0.3}\Huge Q{\huge\thenum }} --- #1\par 
        }
    }
\newcommand<>\Ans[2][]{%
    \leavevmode\par
    \noindent
    \begin{flushright}
        \textbf{#1} #2  --- {\Huge\color{blue}\transparent{0.3} A} \par
    \end{flushright}\par}%}

\resetcounteronoverlays{num}

\begin{document}
\maketitle

%\texttransparent{Questions and Answer}{}

\begin{frame}
    \Que{First Question?}
    \pause
    \Ans{First Answer!}
\end{frame}

\begin{frame}
    \Que{Second Question?}
    \pause
    \Ans{Second Answer!}
\end{frame}

\end{document}

enter image description here

I suppressed some blank spaces from your code using %; I also added the <> syntax to your commands so that they are overlay-aware.

1
  • @EdyJo You're welcome! Glad I could help. Commented Feb 3, 2014 at 2:53

You must log in to answer this question.

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