3

I'm having a problem when I use a tikz block chain in more than a frame. My codes are below:

   \documentclass[pdf]{beamer}    
        \mode<presentation>{}
    \usepackage[brazilian,hyperpageref]{backref}     % Paginas com as citações na bibl






    \usepackage{stmaryrd}
    \usepackage{graphicx}


    \usetheme{Antibes}

    \usecolortheme{beaver}

    \justifying


    \usepackage{parskip}
    \setlength{\parskip}{\smallskipamount}


    \usepackage[utf8]{inputenc}
    \usepackage[brazil]{babel}
    \usepackage[T1]{fontenc}
    \usefonttheme{serif}
    \usepackage{lipsum}
    \usepackage{caption}
    \setbeamercolor{block title}{bg=red!30,fg=black}
    \usepackage{times}
    \usepackage{tikz}
    \usepackage{amsmath}
    \usepackage{verbatim}
    \usetikzlibrary{arrows,shapes}

    \usepackage{float}
    \usepackage{caption}


    \author{Gabriel Petrini da Silveira \and RA 155468
    \\ \textbf{Orientador:} Antônio Carlos Macedo e Silva \\ \
    {\footnotesize\ttfamily gpetrinidasilveira@gmail.com}}
    \title[Política Fiscal: HPE, Grande Recessão e SFC]{Política Fiscal e(m) Grande Recessão: uma análise com Consistência entre Fluxos e Estoques}
    \institute{Instituto de Economia - UNICAMP}
    \date{05 de Dezembro - 2017}



    \usepackage{multirow}




    \usepackage{framed} 
    \makeindex



    \tikzset{
        basic/.style  = {draw, text width=2cm, font=\sffamily, rectangle},
        root/.style   = {basic, rounded corners=2pt, thin, align=center,
            fill=green!30},
        level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=green!60,
            text width=8em},
        level 3/.style = {basic, thin, align=left, fill=white, text width=6.5em}
    }

    \usetikzlibrary{arrows,shapes,positioning,shadows,trees}
    \usetikzlibrary{trees}
    \usepackage[bottom]{footmisc}
    \usepackage{tikz}
    \usetikzlibrary{positioning}

    \usepackage{arydshln}


    \usetikzlibrary{arrows,shapes,positioning,shadows,trees}

 \begin{document}
     \begin{frame}  
    \frametitle{Características do NCM}     

        Neste arcabouço:    
            \begin{description}         
            \item[Principal instrumento] Taxa de
         juros de curto prazo       
             \item[Aparato institucional] Regime de Metas
         para a Inflação        
            \item[Objetivo] Estabilização da inflação
            \end{description}



     \begin{figure}[H]
        \usetikzlibrary{arrows.meta,chains}
        \begin{tikzpicture}[
        > = {Latex[]},
        start chain = going right,
        node distance=7mm,
        block/.style={shape=rectangle, draw,
            inner sep=1mm, align=center,
            minimum height=7mm, on chain}]     %Para que servem esses comandos?
        %placing the blocks
        \node[block] (n1) {Política monetária \\ eficiente};
        \node[block] (n2) {$Y^G$ estável};
        \node[block] (n3) {Inflação estável};
        \node[block] {Nível de \\ atividade};

        \draw[->] (n1.east) --  + (0,0mm) -> (n2.west);
        \draw[->] (n2.east) --  + (0,0mm) -> (n3.west);
        \draw[<->] (n1.south) --  + (0,-7mm) -| (n3.south);
        \draw[<->] (n2.north) --  + (0,+7mm) -| (n3.north);
        \end{tikzpicture}
     \end{figure}

     \begin{framed}
        Portanto, há uma hierarquia entre os objetivos de política econômica, subordinando os demais ao controle da inflação.
     \end{framed}
     \end{frame}

     \begin{frame}
     \frametitle{SFC e política fiscal}
     \framesubtitle{Estrutura Modelo G\&L}
     \begin{center}
        \usetikzlibrary{arrows.meta,chains}
        \begin{tikzpicture}[
        > = {Latex[]},
        start chain = going right,
        node distance=7mm,
        block/.style={shape=rectangle, draw,
            inner sep=1mm, align=center,
            minimum height=7mm, 
            join=by ->, on chain}]     %Para que servem esses comandos?
        %placing the blocks
        \node[block] (n10) {Modelo SFC-PK};
        \node[block] (n11) {Endogenização \\ dos gastos \\ públicos};
        \node[block] (n12) {Função de reação};
     %  \node[block] (n4) {Endogenização \\ dos gastos \\ públicos};
     %  \node[block] (n5) {Função de reação};

        \end{tikzpicture}
        %Fim Fluxograma

        \begin{equation}
        \label{FiscalReac}
        gr_G = gr - \beta_1\cdot \Delta \pi_{-1} - \beta_2\cdot (\pi_{-1} - \pi^T)
        \end{equation}

        \begin{tikzpicture}[
     > = {Latex[]},
     start chain = going right,
     node distance=7mm,
     block/.style={shape=rectangle, draw,
        inner sep=1mm, align=center,
        minimum height=7mm,  on chain}]     %Para que servem esses comandos?
     %placing the blocks
     \node[block] (n13) {NCM};
     \node[block] (n14) {Função de reação};
     \node[block] (n15) {$\Delta \pi, y$};
     %  \node[block] (n4) {Endogenização \\ dos gastos \\ públicos};
     %  \node[block] (n5) {Função de reação};
     \draw[->] (n13.south) --  + (0,-7mm) -| (n14.south);
     \draw[->] (n14.north) --  + (0,+7mm) -| (n13.north);
     \draw[->] (n14.east) --  + (0,0mm) -> (n15.west);
     \end{tikzpicture}


     \end{center}
     \end{frame} 
    \end{document}

Frame with right tikz block chain

But, when I use this same structure in another frame, it look like this: Frame with worng tikz block chain

Sorry for the mess. Its my first question :)

  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user36296 Nov 28 '17 at 10:50
  • 1
    Welcome to TeX.SX. I cannot reproduce the problem with your frames into a basic beamer document. So if you could arrange your code into a complete example that we could esaily test (with frames inside \begin{document} ... \end{document}, with a litle bit simplified preamble, ...) we could help you to find the problem. – Ignasi Nov 28 '17 at 10:51
4

There are several problems preventing your code from compiling. If you get any error messages in the .log file, you should not look at the broken .pdf file but fix these errors instead of worrying how an image looks like.

  • \documentclass{beamer} -> the option [pdf] is not really necessary

  • you don't need \usepackage{graphicx} - beamer already provides this functionality

  • For using \justifying you need the package ragged2e - this is one of the errors that prevents you file from compiling. However even with including the package, this command makes not much sense in the preamble

  • \usepackage{caption}: unnecessary in my opinion, as beamer has its own mechanism for captions

  • same for \usepackage[bottom]{footmisc}

  • don't load the same package multiple times, e.g. tikz,caption

  • don't load tikz libraries multiple times, e.g. arrows,shapes,trees,positioning,shadows and only load them in the preamble, not inside of frames. A superposition of these two problems is the cause of another error preventing your code from compiling.

  • \usepackage{float} does not make any sense in a documentclass that does not have floats. This also means it should be \begin{figure} and not \begin{figure}[H]

  • Your hack to include additional information on the title page will cause problems with the properties of the pdf, you'll see a warning about this in the .log file


\documentclass{beamer} 

\usepackage[brazilian,hyperpageref]{backref}     % Paginas com as citações na bibl

\usepackage{stmaryrd}
%\usepackage{graphicx}

\usetheme{Antibes}
\usecolortheme{beaver}

%    \justifying

\usepackage{parskip}
\setlength{\parskip}{\smallskipamount}

\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage[T1]{fontenc}
\usefonttheme{serif}
\usepackage{lipsum}
%\usepackage{caption}
\setbeamercolor{block title}{bg=red!30,fg=black}
\usepackage{times}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{multirow}
\usepackage{framed} 
\usepackage[bottom]{footmisc}
\usepackage{arydshln}

%\usetikzlibrary{arrows,shapes}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
%\usetikzlibrary{trees}
%\usepackage{tikz}
%\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta,chains}
%\usetikzlibrary{arrows,shapes,positioning,shadows,trees}

%\usepackage{float}
%\usepackage{caption}


\author{\texorpdfstring{Gabriel Petrini da Silveira \and RA 155468
\\ \textbf{Orientador:} Antônio Carlos Macedo e Silva \\ 
{\footnotesize\ttfamily gpetrinidasilveira@gmail.com}}{Gabriel Petrini da Silveira}}
\title[Política Fiscal: HPE, Grande Recessão e SFC]{Política Fiscal e(m) Grande Recessão: uma análise com Consistência entre Fluxos e Estoques}
\institute{Instituto de Economia - UNICAMP}
\date{05 de Dezembro - 2017}

%\makeindex

\tikzset{
    basic/.style  = {draw, text width=2cm, font=\sffamily, rectangle},
    root/.style   = {basic, rounded corners=2pt, thin, align=center,
        fill=green!30},
    level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=green!60,
        text width=8em},
    level 3/.style = {basic, thin, align=left, fill=white, text width=6.5em}
}



\begin{document}

\begin{frame}  
\frametitle{Características do NCM}     

Neste arcabouço:
\begin{description}         
    \item[Principal instrumento] Taxa de juros de curto prazo       
    \item[Aparato institucional] Regime de Metas para a Inflação        
    \item[Objetivo] Estabilização da inflação
\end{description}

\begin{figure}%[H]
    \begin{tikzpicture}[
    > = {Latex[]},
    start chain = going right,
    node distance=7mm,
    block/.style={shape=rectangle, draw,
        inner sep=1mm, align=center,
        minimum height=7mm, on chain}]     %Para que servem esses comandos?
    %placing the blocks
    \node[block] (n1) {Política monetária \\ eficiente};
    \node[block] (n2) {$Y^G$ estável};
    \node[block] (n3) {Inflação estável};
    \node[block] {Nível de \\ atividade};

    \draw[->] (n1.east) --  + (0,0mm) -> (n2.west);
    \draw[->] (n2.east) --  + (0,0mm) -> (n3.west);
    \draw[<->] (n1.south) --  + (0,-7mm) -| (n3.south);
    \draw[<->] (n2.north) --  + (0,+7mm) -| (n3.north);
    \end{tikzpicture}
 \end{figure}

 \begin{framed}
    Portanto, há uma hierarquia entre os objetivos de política econômica, subordinando os demais ao controle da inflação.
 \end{framed}

\end{frame}

\begin{frame}
\frametitle{SFC e política fiscal}
\framesubtitle{Estrutura Modelo G\&L}
 \begin{center}
    \begin{tikzpicture}[
    > = {Latex[]},
    start chain = going right,
    node distance=7mm,
    block/.style={shape=rectangle, draw,
        inner sep=1mm, align=center,
        minimum height=7mm, 
        join=by ->, on chain}]     %Para que servem esses comandos?
    %placing the blocks
    \node[block] (n10) {Modelo SFC-PK};
    \node[block] (n11) {Endogenização \\ dos gastos \\ públicos};
    \node[block] (n12) {Função de reação};
 %  \node[block] (n4) {Endogenização \\ dos gastos \\ públicos};
 %  \node[block] (n5) {Função de reação};
    \end{tikzpicture}
    %Fim Fluxograma

    \begin{equation}
    \label{FiscalReac}
    gr_G = gr - \beta_1\cdot \Delta \pi_{-1} - \beta_2\cdot (\pi_{-1} - \pi^T)
    \end{equation}

    \begin{tikzpicture}[
 > = {Latex[]},
 start chain = going right,
 node distance=7mm,
 block/.style={shape=rectangle, draw,
    inner sep=1mm, align=center,
    minimum height=7mm,  on chain}]     %Para que servem esses comandos?
 %placing the blocks
 \node[block] (n13) {NCM};
 \node[block] (n14) {Função de reação};
 \node[block] (n15) {$\Delta \pi, y$};
 %  \node[block] (n4) {Endogenização \\ dos gastos \\ públicos};
 %  \node[block] (n5) {Função de reação};
 \draw[->] (n13.south) --  + (0,-7mm) -| (n14.south);
 \draw[->] (n14.north) --  + (0,+7mm) -| (n13.north);
 \draw[->] (n14.east) --  + (0,0mm) -> (n15.west);
 \end{tikzpicture}
 \end{center}
 \end{frame} 
\end{document}
  • 1
    @GabrielPetrinidaSilveira, if answer solve your problem, than consider accept it (click check mark at upper left corner of answer) :-) – Zarko Nov 28 '17 at 22:19

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.