Graphics, Figures & TablesBeamer graph comments

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
layuval
Posts: 19
Joined: Thu Aug 18, 2016 11:37 pm

Beamer graph comments

Post by layuval »

Hello everyone,

I'm trying to add comments under my graph when using Beamer for presentation.
It works fine on article but not with the presentation environment.
I marked on the attached file where the problem starts.
Any ideas what I should do?

Since the page doesn't let me add the file I'm attaching my command here.
Thanks!!!

Code: Select all

\documentclass [beamer]
          {beamer}
\mode<presentation>{}
          \usepackage{tikz, pgfplots}
\usetikzlibrary{shadows}

%% preamble
\title{Topic}
\subtitle{Name}
\begin{document}

\begin{frame}
    \titlepage
\end{frame}

\begin{frame}[t,fragile]
\begin{center}
\frametitle{Monopolist strategy}

\begin{tikzpicture}
\tikzstyle{every node}=[font=\huge]

\end{tikzpicture}
\begin{tikzpicture}

    \draw[semithick,->] (0,0) -- (7,0) node[right] {$ \alpha $};
    \draw[semithick,->] (0,0) -- (0,5) node[above]  {$ \pi_m $};   

\path[thick,cyan,draw]   (0,0) node[right]{} .. controls (4,4) .. (6.4,4);
\path[thick,dotted,draw]   (0,0) node[right]{} .. controls (2.4,4) .. (5.6,4);
\path[thick,dashed,draw]   (4.4,0) node[below]{\small$ \alpha{'}_{max}$} .. controls (4.4,0) .. (4.4,4);
\path[thick,dashed,draw]   (1.2,0) node[below]{\small$\hat{ \alpha}{'}$} .. controls (1.2,1.95) .. (1.2,1.95);

\path[thick,dashdotted,draw,purple]   (0,1.65) node[left]{\small$ \pi^{ea}$} .. controls (1.262,2) .. (5.64,3);
\path[thick,dashed,draw]   (5.6,4) node[above]{} .. controls (5.6,0) .. (5.6,0);
\path[thick,dashed,draw]   (6,0) node[below]{\small$ \alpha_{max}$} .. controls (6,0) .. (6,0);
\path[thick,dashed,draw]   (2.262,0) node[below]{\small$\hat{\alpha}$} .. controls (2.262,2.2) .. (2.262,2.2);

%The proble starts when I try to add the followiing: 

\begin{tikzlegend}[legend entries={\small monopolist's profit within entry allowance.,
     \small monopolist's profit within entry deterrence.,\small monopolist's profit within entry deterrence when fine increases., \small $\hat\alpha'$ and $\hat\alpha_{max}'$ are the results of fine increasing.},
       legend style={at={(0,-0.5)},anchor=north west,draw=none}, legend cell align=left]
    \addlegendimage{dashdotted,sharp plot}
    \addlegendimage{sharp plot}
    \addlegendimage{dotted, sharp plot}
        \addlegendimage{color=white}
 \end{tikzlegend}

\end{tikzpicture}
\end{center}
\end{frame}


\end{document}
Last edited by Stefan Kottwitz on Thu Sep 29, 2016 9:45 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Stefan Kottwitz
Site Admin
Posts: 10316
Joined: Mon Mar 10, 2008 9:44 pm

Beamer graph comments

Post by Stefan Kottwitz »

You simply need to define the environment and command you used, that I posted in your other topic TikZ comments.

This needs to be in the preamble of your presentation document:

Code: Select all

\makeatletter
\newenvironment{tikzlegend}[1][]{%
  \begingroup
    \csname pgfplots@init@cleared@structures\endcsname
    \pgfplotsset{#1}}{\csname pgfplots@createlegend\endcsname
  \endgroup
}
\def\addlegendimage{\csname pgfplots@addlegendimage\endcsname}
\makeatother
Stefan
LaTeX.org admin
layuval
Posts: 19
Joined: Thu Aug 18, 2016 11:37 pm

Re: Beamer graph comments

Post by layuval »

Thanks a lot!
Post Reply