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 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

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
Thanks, @Gonzalo Medina. It works! –  Edy Jo Feb 3 at 2:49
    
@EdyJo You're welcome! Glad I could help. –  Gonzalo Medina Feb 3 at 2:53
add 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.