1

I have the following code beamer, but I can not understand why the number of my equations are not on the same line when using \ tag. The column are "plenty" of space.

\documentclass{beamer}

\usepackage{mathtools,cleveref}
\usepackage[american]{circuitikz}

\begin{document}

\begin{frame}{Ohm and Kirchhoff Laws}

\begin{block}{}
    \only<1>{The Ohm and Kirchhoff laws -- a simple test.}
    \only<2>{\par A simple electric circuit.}
    \only<3>{\par From Ohm's law we got \cref{eq:ohm-1}~to~\cref{eq:ohm-3}.}
    \only<4>{\par The \texttt{LKC} applied to each node implies \cref{eq:lkc-1}~to~\cref{eq:lkc-4}, but they are not a system of equations linearly independent.}
    \only<5>{\par And finaly \texttt{LKT} applied to the single mesh gives the equation \cref{eq:lkt}.}
\end{block}

\begin{columns}

    \column[b]{.5\textwidth}

        \only<2->{%
            \begin{block}{}
                \begin{circuitikz}[scale=.7, transform shape]
                    \draw
                        (0,0) to [V,l=$v_s$,i>=$i_s$,*-*] (0,3)
                        to [short] (6,3)
                        to [R,l=$R_l$,v=$v_l$,i>^=$i_l$,*-*] (6,0)
                        to [R,l=$R_c$,v>=$v_c$,i^<=$i_c$,*-*] (3,0)
                        to [R,l=$R_1$,v=$v_1$,i^>=$i_1$,*-*] (0,0)
                     ;
                \end{circuitikz}
            \end{block}%
        }

    \column[b]{.5\textwidth}

        \only<3>{%
            \begin{block}{}
                \begin{align}
                    v_1 &= i_1R_1\tag{2.1}\label<3>{eq:ohm-1}\\
                    v_c &= i_cR_c\tag{2.2}\label<3>{eq:ohm-2}\\
                    v_l &= i_lR_l\tag{2.3}\label<3>{eq:ohm-3}
                \end{align}
            \end{block}%
        }

        \only<4>{%
            \begin{block}{}
                \begin{align}
                    i_s-i_1 &= 0\tag{2.1.1}\label<4>{eq:lkc-1}\\
                    i_1+i_c &= 0\tag{2.1.2}\label<4>{eq:lkc-2}\\
                    -i_c-i_l &= 0\tag{2.1.3}\label<4>{eq:lkc-3}\\
                    i_l-i_s &= 0\tag{2.1.4}\label<4>{eq:lkc-4}
                \end{align}
            \end{block}%
        }

        \only<5>{%
            \begin{block}{}
                \begin{equation}
                    v_l-v_c+v_1-v_s=0\tag{2.4}\label<5>{eq:lkt}
                \end{equation}
            \end{block}%
        }

\end{columns}

\end{frame}

\end{document}
  • Remove <3> etc from labels. – user11232 Apr 9 '14 at 5:15
1

Some remarks

I have some critiques for your slides:

  • As Harish Kumar notes in the comments, your original problem of the equation numbers fitting on the lines are due to the fact that you put <transitions> for your \labels. But these are already in the arguments of \only macros, so these would be redundant even if they worked the way you wanted them to. So, you should change each \label<...> to just \label.

  • There's a problem with having your equations in \only environments: your cross-references don't work properly (you only get ??). Experimenting suggests that your equation numbers are only displayed properly if they occur on the very first transition of a slide (e.g. with \only<1> or \only<1-> or the like).

    1. Considering that almost all of the content of your slides are changing with each transition, have you considered putting them on multiple slides, so that all of the labels are written to the auxiliary file?

    2. Alternatively — as you are manually numbering your equations anyway — you may wish to consider hard-coding your equations. Not the best practice, but then usually neither is \tag. (What relationship does (2.1.1) have with (2.1) in your equations?)

  • Your circuit is jumping up and down, because

    1. The description text for each slide is of variable length; and
    2. The equations which follow are also of variable length.

    Having the circuit jump up and down is really distracting. What you ought to do is to put everything that occurs in an \only command, inside of an {overlayarea} environment to give it a fixed amount of space. This will allow your circuit to stay in place.

  • If you aren't using any headings for your {block} environments, why don't you omit them to simplify your code?

Sample code

Here is how I would clean up your slides. I haven't resolved the problems with equation references; you should fix that problem however you prefer.

\documentclass{beamer}
\usepackage{mathtools,cleveref}
\usepackage[american]{circuitikz}

\begin{document}
\begin{frame}{Ohm and Kirchhoff Laws}
\begin{overlayarea}{\textwidth}{0.25\paperheight}
    \only<1>{The Ohm and Kirchhoff laws -- a simple test.}
    \only<2>{\par A simple electric circuit.}
    \only<3>{\par From Ohm's law we got \cref{eq:ohm-1}~to~\cref{eq:ohm-3}.}
    \only<4>{\par The \texttt{LKC} applied to each node implies \cref{eq:lkc-1}~to~\cref{eq:lkc-4}, but they are not a system of equations linearly independent.}
    \only<5>{\par And finaly \texttt{LKT} applied to the single mesh gives the equation \cref{eq:lkt}.}
\end{overlayarea}

\begin{columns}
    \column[t]{.5\textwidth}
    \begin{overlayarea}{\columnwidth}{0.5\paperheight}
        \only<2->{%
                \begin{circuitikz}[scale=.7, transform shape]
                    \draw
                        (0,0) to [V,l=$v_s$,i>=$i_s$,*-*] (0,3)
                        to [short] (6,3)
                        to [R,l=$R_l$,v=$v_l$,i>^=$i_l$,*-*] (6,0)
                        to [R,l=$R_c$,v>=$v_c$,i^<=$i_c$,*-*] (3,0)
                        to [R,l=$R_1$,v=$v_1$,i^>=$i_1$,*-*] (0,0)
                     ;
                \end{circuitikz}
        }
    \end{overlayarea}

    \column[t]{.5\textwidth}
    \begin{overlayarea}{0.9\columnwidth}{0.5\paperheight}
        \vspace*{-4ex}
        \only<3>{%
                \begin{align}
                    v_1 &= i_1R_1\tag{2.1}\label{eq:ohm-1}\\
                    v_c &= i_cR_c\tag{2.2}\label{eq:ohm-2}\\
                    v_l &= i_lR_l\tag{2.3}\label{eq:ohm-3}
                \end{align}
        }

        \only<4>{%
                \begin{align}
                    i_s-i_1 &= 0\tag{2.1.1}\label{eq:lkc-1}\\
                    i_1+i_c &= 0\tag{2.1.2}\label{eq:lkc-2}\\
                    -i_c-i_l &= 0\tag{2.1.3}\label{eq:lkc-3}\\
                    i_l-i_s &= 0\tag{2.1.4}\label{eq:lkc-4}
                \end{align}
        }

        \only<5>{%
                \begin{equation}
                    v_l-v_c+v_1-v_s=0\tag{2.4}\label{eq:lkt}
                \end{equation}
        }
    \end{overlayarea}
\end{columns}
\end{frame}
\end{document}
  • @Neil de Beaudrap, the use of \tag is to be able to reference the equations like those used in the book I adopted. Indeed you are right about the overlay area. I'll follow your advise and example. I will consider the idea to put the development on multiple slides, mainly to get the equations referenced without pain. – jotagah Apr 9 '14 at 19:06

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.