Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wish to put two graph together, one is on the left side, the other is one the right side. I use "minipage". However, using the below code, the first graph is on the top of the second graph. May some one help me?

Here is my code:

 \documentclass[tikz]{standalone}
    \usepackage{tikz}
    \usepackage{scalefnt}
    \usetikzlibrary{shapes}
    \begin{document}
    \begin{figure}[htbp]
    \hspace{-4mm}
    \begin{minipage}{0.5\linewidth}]
    \centering
    %\includegraphics[width=2.3in]{image/CompositionalStucture}
    %\input{trans}
    \tikzset{
     block/.style = {circle, draw,align=center,inner sep=0pt},
     line/.style = {draw,->},
     }
    {\scalefont{1}
    \begin{tikzpicture}[node distance=10mm]
    \node[block,minimum size=3mm](s2) {1};
    \node[block,right of =s2,anchor=center,minimum size=2mm] (s3){2};
    \node[block, right of=s2,anchor=center,,minimum size=3mm] (s4) {};

    \path[line] (-0.8,0)-- (s2){};
    \path[line] (s2)-- node[above]{stop}(s4);
    \path[line] (s2) to [out=120,in=40,looseness=5] node[above] {$\Sigma$}(s2);
    \path[line] (s4) to [out=120,in=40,looseness=5]node[above] {$\Sigma$}(s4);
    \end{tikzpicture}
    }
    \caption{Travel Agency Service (\TAS{})}
    \label{fig:TAS}
    \red{2}
    \end{minipage}

    \begin{minipage}{0.5\linewidth}
    \centering
    %\includegraphics[width=2.3in]{image/CompositionalStucture}
    %\input{trans1}
    \tikzset{
     block/.style = {ellipse, draw,align=center,inner sep=0pt},
     line/.style = {draw,->},
     }
    {\scalefont{1}
    \begin{tikzpicture}[node distance=10mm]
    \node[block,minimum size=3.5mm](s1) {(6,1)};
    \node[block,minimum size=3.5mm,below of =s1](s2) {(7,1)};
    \node[block,minimum size=3.5mm,below of = s2](s3) {(22,2)};

    \path[line] (s1)-- node[right]{gc}(s2);
    \path[line] (s2)-- node[right]{TER}(s3);
    \end{tikzpicture}
    }
    \caption{Travel Agency Service (\TAS{})}
    \label{fig:TAS}
    \red{3}
    \end{minipage}
    \end{figure}
    \end{document}
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I was not able to compile your example because of undefined control sequences, but I believe the problem is probably caused by the space between the minipages. You have one empty line between the minipages, which means that they will be in separate paragraphs. Even if you delete this line, they will still end up on different lines, because the new-line character between them will insert a space between them, and the line-breaking algorithm will place them on separate lines.

What you want to do is something like this:

\begin{minipage}{0.5\linewidth}
    % some contents here
\end{minipage}% <--- the percent character will "comment out" the new line    
\begin{minipage}{.5\linewidth}
     % some content here
\end{minipage
share|improve this answer
    
Thanks, but if the two graphs are not with the same height, how to set the align, that is to say I wish the bottom of the two graphs in the same line. –  sweetyBaby Feb 23 '13 at 7:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.