Duas fotos tikz e posição da legenda

Duas fotos tikz e posição da legenda

Com os seguintes códigos

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{intersections,shapes,arrows,positioning}

\begin{document}
\tikzstyle{block} = [rectangle, draw, 
text width=7em, text centered, rounded corners, minimum height=3em]

\tikzstyle{line} = [draw, -latex']

\tikzstyle{cloud} = [draw, ellipse, node distance=4.5cm,
minimum height=2.5em] 

\begin{figure} 

\begin{tikzpicture}[node distance = 3cm,auto]

\node [block] (firm) {Bob's favorite $i$};
\node [cloud, right of= firm] (C) {country $A$};
\node [cloud, below right of=firm] (C') {Alice $B$};

\path [line, thick] (firm) -- node {t}(C');
\path [line, thick] (C') -- node {t}(C);
\path [line,dashed, very thick] (firm) --  node {t+1}(C);
\end{tikzpicture}
\hspace{1cm}% NO SPACE!
\begin{tikzpicture}[node distance = 3cm,auto]

\node [block] (firm) {Bob's favorite $i$};
\node [cloud, right of= firm] (C) {country $A$};
\node [cloud, below right of=firm] (C') {Alice $B$};

\path [line, thick] (firm) -- node {t}(C');
\path [line, thick] (C') -- node {t}(C);
\path [line,dashed, very thick] (firm) --  node {t+1}(C);
\end{tikzpicture}

\caption{Bob and Alice}
\end{figure}

\end{document}

Eu tenho insira a descrição da imagem aqui

Como posso fazer a figura no centro?


Eu tenho os seguintes problemas:

  • Se eu usar \centeringno figureambiente, as duas fotos ficariam em duas fileiras; mas quero mantê-los lado a lado.
  • Eu tentei redimensionar a imagem comoesta respostafaz. Mas não sei onde colocar os parâmetros de escala no meu caso.

Responder1

Como as imagens são relativamente simples, sugiro redesenhá-las. Neste uso nova sintaxe para posicionamento e definição de estilo. Ao redesenhar, você realmente precisa alterar apenas alguns parâmetros, o que diminuirá a largura da imagem:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows, 
                calc, % added
                intersections, positioning, shapes}

\usepackage{showframe}

\begin{document}
\tikzset{ % changed from tikzstyle
block/.style = {rectangle, draw, rounded corners,
                text width=4em, % reduced, now text is in two lines
                minimum height=3em, align=center},
 line/.style = {draw, thick, -latex'},
cloud/.style = {draw, ellipse, minimum height=2.5em, inner xsep=0pt}
        }

\begin{figure}
\centering
    \begin{tikzpicture}[
node distance = 2cm and 1.5cm, % changed (reduced)
        auto]
\node [block] (firm) {Bob's favorite $i$};
\node [cloud, right=of firm] (C) {country $A$}; % new syntax according to positioning library
\node [cloud, below=of $(firm)!0.5!(C)$] (C') {Alice $B$}; % use of calc library

\path [line] (firm) -- node {t}(C');
\path [line] (C') -- node {t}(C);
\path [line,dashed, very thick] (firm) --  node {t+1} (C);
    \end{tikzpicture}
\hfil % for distance between images
    \begin{tikzpicture}[
node distance = 2cm and 1.5cm,
        auto]
\node [block] (firm) {Bob's favorite $i$};
\node [cloud, right=of firm] (C) {country $A$};
\node [cloud, below=of $(firm)!0.5!(C)$] (C') {Alice $B$};

\path [line] (firm) -- node {t}(C');
\path [line] (C') -- node {t}(C);
\path [line,dashed, very thick] (firm) --  node {t+1} (C);
    \end{tikzpicture}
    \caption{Bob and Alice}
\end{figure}

\end{document}

insira a descrição da imagem aqui

A largura padrão do texto articleé muito estreita. Periódicos ou conferências costumam ter margens bem mais estreitas, menores que 25 mm. Neste caso você pode usar wide block, por exemplo como tem no seu MWE (7em).

informação relacionada