% !TeX program = lualatex
\documentclass[aspectratio=169,9pt,t]{beamer}
\usetheme{LZU}
\usetikzlibrary{arrows.meta,automata,positioning}

\title{Beamer-LZU}
\subtitle{A Lanzhou University presentation theme for LaTeX Beamer}
\author{Sample presenter}
\institute{School of Information Science and Engineering, Lanzhou University}
\date{\today}

\begin{document}
\maketitle
\lzuoutline[Outline]

\section{LaTeX and Beamer}
\subsection{LaTeX}
\begin{frame}{LaTeX}
  Text, equations, and citations can live in one source file. Recompile after
  changing the section order to update the outline and navigation.

  \medskip
  An inline equation such as \(e^{i\pi}+1=0\) flows with the text. A displayed
  equation is centered on its own line:
  \[
    \int_0^1 x^2\,\mathrm{d}x=\frac{1}{3}.
  \]
\end{frame}

\subsection{Beamer}
\begin{frame}{Beamer}
  A logical slide is written in one \texttt{frame} environment. It may have
  several overlay pages that share the same frame number.

  \medskip
  Select a section title in the header to jump to its overview page, or
  select a dot to jump to a content frame. Beamer's overlay syntax is
  described in its user guide\cite{beamer}.
\end{frame}

\section{Animated slides}
\subsection{Incremental list}
\begin{frame}{How can we compare the running times of two algorithms?}
  Test algorithms A and B on the same inputs.
  \begin{enumerate}
    \setlength{\itemsep}{.85em}
    \item<1-> \textbf{Measure a baseline.} Run A on each input and record its time.
    \item<2-> \textbf{Change the algorithm.} Keep the inputs, machine, and timing method fixed while running B.
    \item<3-> \textbf{Compare pairs.} Compute \(t_A-t_B\) for each input; a positive value means B is faster.
  \end{enumerate}
  \note{Before revealing step two, ask the audience what must be held constant.}
\end{frame}

\subsection{Reveal an answer}
\begin{frame}{Which measurement best represents the typical running time?}
  The same program was run three times. Which reading is the median?
  \[
    2.1\,\mathrm{s} \qquad 9.8\,\mathrm{s} \qquad 2.0\,\mathrm{s}
  \]
  \visible<2->{%
    \textbf{Sort the times}\quad
    \(2.0 < \alert{2.1} < 9.8\)\par\smallskip
    The middle reading is \(2.1\,\mathrm{s}\), from the first run.}
\end{frame}

\subsection{Replace content}
\begin{frame}{How does the mean change as samples arrive?}
  Three samples arrive in order. Recompute the mean from the samples seen so far.
  \begin{center}
    \renewcommand{\arraystretch}{1.35}
    \begin{tabular}{@{}lccc@{}}
      Arrival & First & Second & Third \\
      Value & \(2\) & \visible<2->{\(4\)} & \visible<3->{\(6\)}
    \end{tabular}
  \end{center}
  % overprint measures the largest alternative; all three share one origin.
  \begin{overprint}
    \onslide<1|handout:0>
      Current mean\quad \(\displaystyle \vphantom{\frac{2+4}{2}}\bar x_1 = 2\)
    \onslide<2|handout:0>
      Current mean\quad \(\displaystyle \bar x_2 = \frac{2+4}{2} = 3\)
    \onslide<3|handout:1>
      Current mean\quad \(\displaystyle \bar x_3 = \frac{2+4+6}{3} = 4\)
  \end{overprint}
\end{frame}

\subsection{Equation derivation}
\begin{frame}{Deriving the square of a sum}
  Multiply two identical factors.
  \[
    \begin{aligned}
      (x+1)^2 & = (x+1)(x+1) \\[.5em]
              & \visible<2->{= x^2+x+x+1} && \visible<2->{\text{expand the product}} \\[.5em]
              & \visible<3->{= x^2+2x+1}  && \visible<3->{\text{collect like terms}}
    \end{aligned}
  \]
\end{frame}

\section{Diagrams and layout}
\subsection{Geometric diagram}
\begin{frame}{Explaining the identity by area}
  How can a square of side \(x+1\) be divided? Assume \(x>0\).
  \medskip
  \begin{columns}[c,onlytextwidth]
    \begin{column}{.42\textwidth}
      \centering
      \begin{tikzpicture}[x=.83cm,y=.83cm,draw=LZUBlue]
        \path[use as bounding box] (-.6,-.2) rectangle (4.2,4.45);
        \fill[LZUBlue!15] (0,0) rectangle (3,3);
        \node at (1.5,1.5) {\(x^2\)};
        \only<2->{%
          \fill[LZUBlue!35] (0,3) rectangle (3,4);
          \fill[LZUBlue!35] (3,0) rectangle (4,3);
          \node at (1.5,3.5) {\(x\)};
          \node at (3.5,1.5) {\(x\)};}
        \only<3->{%
          \fill[LZUBlue!70] (3,3) rectangle (4,4);
          \node[text=white] at (3.5,3.5) {\(1\)};}
        \draw (0,0) rectangle (4,4) (0,3) -- (4,3) (3,0) -- (3,4);
        \node[above] at (1.5,4) {\(x\)};
        \node[above] at (3.5,4) {\(1\)};
        \node[left] at (0,1.5) {\(x\)};
        \node[left] at (0,3.5) {\(1\)};
      \end{tikzpicture}
    \end{column}
    \begin{column}{.54\textwidth}
      The lower-left square has area \(x^2\).\par\medskip
      \visible<2->{The two rectangles each have area \(x\), for a total of \(2x\).}\par\medskip
      \visible<3->{The small square adds \(1\).\par\medskip
        \(\displaystyle (x+1)^2=x^2+2x+1\)}
    \end{column}
  \end{columns}
\end{frame}

\subsection{State diagram}
\begin{frame}{How does an open file reach the closed state?}
  \begin{center}
    \begin{tikzpicture}[>=Stealth,font=\small,
        state/.style={circle,draw=LZUBlue,fill=LZUBlue!9,minimum size=1.35cm},
        every edge/.style={draw=LZUBlue,->}]
      % The canvas and node positions stay fixed as transitions are added.
      \path[use as bounding box] (-2,-1.5) rectangle (6.3,1.65);
      \node[state] (reading) at (0,0) {reading};
      \draw[->,LZUBlue] (-1.9,0) -- node[above]{open} (reading);
      \path (reading) edge[loop above] node{read} (reading);
      \only<2->{%
        \node[state] (eof) at (2.7,0) {eof};
        \path (reading) edge node[above]{EOF} (eof);}
      \only<3->{%
        \node[state] (closed) at (5.4,0) {closed};
        \path (eof) edge node[above]{close} (closed)
              (reading) edge[bend right=28] node[below]{close} (closed);}
    \end{tikzpicture}
  \end{center}
  \begin{overprint}
    \onslide<1|handout:0>The file remains readable after a successful read.
    \onslide<2|handout:0>An EOF result indicates that the end has been reached.
    \onslide<3|handout:1>Both closing paths are valid: a file may be closed during reading or after EOF.
  \end{overprint}
\end{frame}

\subsection{Theorem and proof}
\begin{frame}{Theorem and proof}
  \begin{theorem}
    The square of every odd integer is odd.
  \end{theorem}
  \begin{proof}
    Write \(n=2k+1\) for some \(k\in\mathbb Z\). Then
    \[
      n^2=4k^2+4k+1=2(2k^2+2k)+1.
    \]
    Thus \(n^2\) is an even integer plus one.
  \end{proof}
\end{frame}

\section{More features}
\subsection{Two columns}
\begin{frame}{Two-column layout}
  \begin{columns}[T,onlytextwidth]
    \begin{column}{.46\textwidth}
      \textbf{Experiment setup}\par\medskip
      Fix the input size and time the same program three times. Restore the
      same initial state before each run.
    \end{column}
    \begin{column}{.46\textwidth}
      \textbf{Measurements}\par\medskip
      \begin{tabular}{@{}lrrr@{}}
        Run & 1 & 2 & 3 \\ \hline
        Time (s) & 2.1 & 1.9 & 2.0
      \end{tabular}
      \par\medskip The mean time is \(2.0\) seconds.
    \end{column}
  \end{columns}
\end{frame}

\subsection{Automatic frame breaks}
\begin{frame}[allowframebreaks]{A reproducible timing experiment}
  \linespread{1.5}\selectfont
  \setlength{\parskip}{.5em}
  \textbf{Question and measurement.} Suppose two implementations solve the
  same problem. A faster result on one input is useful evidence, but it is not
  enough to establish a general performance claim. We need a set of inputs
  that covers the small, typical, and difficult cases we expect in practice.
  For each input, record the elapsed time of both implementations and retain
  the input itself so the comparison can be repeated later.

  \textbf{Controlled conditions.} Run both programs on the same machine with
  the same compiler settings and software environment. Background processes,
  power management, file caches, and the order in which programs run can
  affect a timing result. Record these conditions, and keep them as stable as
  possible. If a program reads data from disk, decide whether the experiment
  measures a cold cache, a warm cache, or both. State the choice clearly.

  \textbf{Repeated runs.} Repeat each measurement several times. A single
  run can be unusually slow because another process used the CPU or because
  the operating system delayed an operation. Report a summary such as the
  median together with the spread of the observations. Keep the individual
  readings so that outliers can be investigated rather than silently removed.
  If the program has a warm-up phase, describe it and apply it consistently.

  \textbf{Paired comparison.} For every input, compare the two timings as a
  pair. This keeps the effect of input difficulty visible. A table of paired
  differences can show whether one implementation wins consistently or only
  on a subset of cases. An overall average can conceal an important slow case,
  so include enough detail for readers to see the range of outcomes. Graphs
  should label their units and explain whether the values are raw times,
  differences, or ratios.

  \textbf{Interpretation.} Performance measurements answer a question about
  the tested workload and environment. They do not automatically predict what
  will happen on every machine or every future input. Identify the limits of
  the experiment, including the input selection and any sources of timing
  noise. When reporting a conclusion, tie it to the evidence: say which
  implementation was faster on which inputs and by how much. A clear methods
  description makes the claim easier to check and more useful to others.

  \textbf{Reproduction.} Share the source code, input generator, build
  settings, and measurement script when possible. A reader should be able to
  recreate the table from the supplied materials. If the numbers change on a
  different machine, the documented procedure still allows the reader to
  understand the difference. This long example also demonstrates Beamer's
  automatic frame breaks: the text continues on the next PDF page without
  writing a separate frame environment.
\end{frame}

\appendix
\begin{frame}{Presentation notes}
  Present the generated PDF directly. For a printed handout, add
  \texttt{handout} to the document class options. Use \texttt{handout:} in
  mutually exclusive overlays to select which alternative remains visible.
\end{frame}

\begin{frame}{References}
  \begin{thebibliography}{9}
    \bibitem{beamer} Till Tantau et al., \emph{The Beamer Class User Guide}.
      \href{https://ctan.org/pkg/beamer}{CTAN package page}.
    \bibitem{touying} Oscar Tuo, \emph{Touying-LZU}, v0.1.1.
      \href{https://mirrors.lzu.edu.cn/github-release/touying-lzu/v0.1.1/}{Release mirror}.
  \end{thebibliography}
\end{frame}
\lzuend{Thank you for listening!}
\end{document}
