1

I am making some presentation material using beamer.

Because I am not used to using Latex, and this is the first time to use beamer, I am very not good at grammar of Latex and beamer. :(

Please let me know how to indent an example environment.

My code of one slide is like the following:

\begin{frame}[shrink=0, t]{Inventory Control}
    \begin{itemize}
    \item The \blue{Open-loop} minimization of the cost is to select all orders $u_0, \cdots, u_{N-1}$ at once at time $0$.
    \\[1.5em]
    \item The \blue{Closed-loop} minimization of the cost is to postpone placing the order $u_k$ until the last possible moment (time $k$) when the current stock $x_k$ will be know.
    \\[1.5em]
    \item[] Mathematically, in closed-loop inventory optimization, we want to find a sequence of functions $\mu_k, k=0, \cdots, k=N-1$, mapping stock $x_k$ into order $u_k$ so as to minimize the expected cost, where
    $$\mu_k(x_k) = \text{amount that should be ordered at time } k \text{ if the stock is } x_k.$$
    \\[0.5em]
    \item The \blue{Policy} (or \blue{control law})
    $$\pi=\left\{\mu_0, \mu_1, \cdots, \mu_{N-1}\right\}$$

    \begin{example}
        For each $\pi$, the corresponding cost for a fixed initial stock $x_0$ is
        $$J_{\pi}(x_0)=E\left\{R(x_N)+\sum_{k=0}^{N-1}\left(r(x_k)+c\mu_k(x_k)\right)\right\}$$
    \end{example}
    \end{itemize}
\end{frame}

The result of the above code is like the following: 111

However, I want to make like the following, please help me. 112

5
  • I guess it's caused by too low shrink factor. Please try your example with shrink = 25, for instance. Is it then what you need? Jun 23 '16 at 14:21
  • I hope the example to be like the below. How can I adapted shrink in the environment?? I tried \begin[shrink=25]{example} ~ but not worked.
    – Danny_Kim
    Jun 23 '16 at 14:24
  • I meant the shrink option of the frame Jun 23 '16 at 14:32
  • 1
    but if you need only to center example environment and have it narrower then the whole \textwidth, you can try to wrap it in minipage of a desired width and then in center environment. Thus something like\begin{center} \begin{minipage}{.7\textwidth} \begin{example}... \end{example} \end{minipage} \end{center} Jun 23 '16 at 14:53
  • @OlegSoloviev Wow wow wow wow!!! You are very AWESOME! Thank you!
    – Danny_Kim
    Jun 23 '16 at 15:09
2

If you set the example block in a minipage of width \linewidth - the line width within a list (like itemize), it'll stay put:

enter image description here

\documentclass{beamer}

\usetheme{Warsaw}
\usepackage{amsmath}

\begin{document}

\begin{frame}[shrink=0, t]{Inventory Control}
  \begin{itemize}
    \item The \textcolor{blue}{Open-loop} minimization of the cost is to 
      select all orders $u_0, \cdots, u_{N-1}$ at once at time~$0$.

    \item The \textcolor{blue}{Closed-loop} minimization of the cost is to 
      postpone placing the order~$u_k$ until the last possible moment 
      (time~$k$) when the current stock~$x_k$ will be know.

      Mathematically, in closed-loop inventory optimization, we want to 
      find a sequence of functions $\mu_k, k = 0, \cdots, k = N - 1$, 
      mapping stock~$x_k$ into order~$u_k$ so as to minimize the expected 
      cost, where

      \[
        \mu_k(x_k) = \text{amount that should be ordered at time } k 
          \text{ if the stock is } x_k.
      \]

    \item The \textcolor{blue}{Policy} (or \textcolor{blue}{control law})
      \[
        \pi = \bigl\{ \mu_0, \mu_1, \cdots, \mu_{N-1} \bigr\}
      \]

    \begin{minipage}{\linewidth}
    \begin{example}
      For each~$\pi$, the corresponding cost for a fixed initial stock~$x_0$ is
      \[
        J_{\pi}(x_0) = E \left\{ R(x_N) + \sum_{k=0}^{N-1}
          \bigl( r(x_k) + c\mu_k(x_k) \bigr) \right\}
      \]
    \end{example}
    \end{minipage}
  \end{itemize}
\end{frame}

\end{document}
3
  • I've formatted your code as well as use \[...\] for display math rather than $$...$$. See Why is \[\] preferable to $$?
    – Werner
    Jun 23 '16 at 15:16
  • May I ask you one more? Is there any way to change word Example to other word? For example, Result.
    – Danny_Kim
    Jun 23 '16 at 15:18
  • 1
    @Danny_Kim: To your preamble add either (1) \theoremstyle{example} \newtheorem{result}[theorem]{\translate{Result}} and use \begin{result}...\end{result} or (2) \usepackage{etoolbox} \patchcmd{\example}{Example}{Result}{}{} and keep using \begin{example}...\end{example}. Option (1) is preferred for it provides a syntax that matches the output and is more flexible.
    – Werner
    Jun 23 '16 at 15:26

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.