LaTeX forum ⇒ Graphics, Figures & TablesBeamer graph comments Topic is solved

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

Beamer graph comments

Postby layuval » Thu Sep 29, 2016 9:33 am

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

  1. \documentclass [beamer]
  2. {beamer}
  3. \mode<presentation>{}
  4. \usepackage{tikz, pgfplots}
  5. \usetikzlibrary{shadows}
  6.  
  7. %% preamble
  8. \title{Topic}
  9. \subtitle{Name}
  10. \begin{document}
  11.  
  12. \begin{frame}
  13. \titlepage
  14. \end{frame}
  15.  
  16. \begin{frame}[t,fragile]
  17. \begin{center}
  18. \frametitle{Monopolist strategy}
  19.  
  20. \begin{tikzpicture}
  21. \tikzstyle{every node}=[font=\huge]
  22.  
  23. \end{tikzpicture}
  24. \begin{tikzpicture}
  25.  
  26. \draw[semithick,->] (0,0) -- (7,0) node[right] {$ \alpha $};
  27. \draw[semithick,->] (0,0) -- (0,5) node[above] {$ \pi_m $};
  28.  
  29. \path[thick,cyan,draw] (0,0) node[right]{} .. controls (4,4) .. (6.4,4);
  30. \path[thick,dotted,draw] (0,0) node[right]{} .. controls (2.4,4) .. (5.6,4);
  31. \path[thick,dashed,draw] (4.4,0) node[below]{\small$ \alpha{'}_{max}$} .. controls (4.4,0) .. (4.4,4);
  32. \path[thick,dashed,draw] (1.2,0) node[below]{\small$\hat{ \alpha}{'}$} .. controls (1.2,1.95) .. (1.2,1.95);
  33.  
  34. \path[thick,dashdotted,draw,purple] (0,1.65) node[left]{\small$ \pi^{ea}$} .. controls (1.262,2) .. (5.64,3);
  35. \path[thick,dashed,draw] (5.6,4) node[above]{} .. controls (5.6,0) .. (5.6,0);
  36. \path[thick,dashed,draw] (6,0) node[below]{\small$ \alpha_{max}$} .. controls (6,0) .. (6,0);
  37. \path[thick,dashed,draw] (2.262,0) node[below]{\small$\hat{\alpha}$} .. controls (2.262,2.2) .. (2.262,2.2);
  38.  
  39. %The proble starts when I try to add the followiing:
  40.  
  41. \begin{tikzlegend}[legend entries={\small monopolist's profit within entry allowance.,
  42. \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.},
  43. legend style={at={(0,-0.5)},anchor=north west,draw=none}, legend cell align=left]
  44. \addlegendimage{dashdotted,sharp plot}
  45. \addlegendimage{sharp plot}
  46. \addlegendimage{dotted, sharp plot}
  47. \addlegendimage{color=white}
  48. \end{tikzlegend}
  49.  
  50. \end{tikzpicture}
  51. \end{center}
  52. \end{frame}
  53.  
  54.  
  55. \end{document}
Last edited by Stefan Kottwitz on Thu Sep 29, 2016 9:45 am, edited 1 time in total.
Reason: code marked

Tags:

User avatar
Stefan Kottwitz
Site Admin
Posts: 8537
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Thu Sep 29, 2016 9:52 am

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:
  1. \makeatletter
  2. \newenvironment{tikzlegend}[1][]{%
  3. \begingroup
  4. \csname pgfplots@init@cleared@structures\endcsname
  5. \pgfplotsset{#1}}{\csname pgfplots@createlegend\endcsname
  6. \endgroup
  7. }
  8. \def\addlegendimage{\csname pgfplots@addlegendimage\endcsname}
  9. \makeatother


Stefan
Site admin

layuval
Posts: 19
Joined: Thu Aug 18, 2016 11:37 pm

Postby layuval » Thu Sep 29, 2016 10:00 am

Thanks a lot!


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 6 guests