2

I am trying to align two subfloats so that their captions are on the same horizontal line. The figures themselves should be centered. The code I have is the following, but what I am getting is in the attached figure. What am I doing wrong?

\documentclass{scrartcl}        % KOMA script (my preference)

\usepackage{graphicx}
\usepackage{subfig}
\usepackage{tikz-rdf}
\usepackage{tikz}
\usepackage{tkz-graph}
\usepackage{tkz-berge}
\usetikzlibrary{shapes,shapes.callouts,,decorations.text,shapes.misc,decorations.pathmorphing,shapes.geometric,backgrounds,fit,positioning,arrows}

\begin{document}

\begin{figure*}[ht!]%
    \subfloat[\scriptsize Transaction Database $D$]{
      \begin{minipage}[c]{0.3\textwidth}
    \centering
    \scalebox{.7}{
    \begin{tabular}{| p{1cm} | p{1.5cm} | p{4cm} |}\hline
        Vertex ID & Entity \mbox{vertex} &  Adjacent Attribute Properties \\ \hline \hline
        001 & Person1 & salary, gender, title \\ \hline
        002 & Person2 & salary, gender, title, nationality \\ \hline
        003 & Person3 & salary, gender, title \\ \hline
        004 & Person4 & salary, gender, title, nationality \\ \hline
        005 & Person5 & salary, gender, nationality \\ \hline
        006 & Person6 & salary, title, nationality \\ \hline
        007 & Paper1 & year, inProceedings, paperTitle \\ \hline
        008 & Paper2 & year, inProceedings, paperTitle \\ \hline
        009 & Paper3 & year, inProceedings, paperTitle \\ \hline
        010 & School1 & locatedIn, name \\ \hline
        011 & School2 & locatedIn, name \\ \hline
        012 & School3 & locatedIn, name \\ \hline
    \end{tabular}
    }
      \end{minipage}
       \label{fig:db}%
       }%
%
\subfloat[\scriptsize T-Index]{
          \begin{minipage}[c]{0.7\textwidth}
    \centering
    \begin{tikzpicture}[node distance=1.5cm, every edge/.style={link}]
%
%Inserting nodes N1-N3
%    
        \node[circle,draw] (n0){$N_{0}$};
    \end{tikzpicture}
      \end{minipage}
       \label{fig:fp}%
       }%
%       \vspace{-0.2in}
 \caption{T-index}%
  \vspace{-0.2in}
 \label{fig:star}
\end{figure*}



\end{document}  

enter image description here

cmhughes
  • 100,947
ozsu
  • 2,385
  • 2
    Minimal Working Examples should really be a little more minimal. – qubyte Mar 07 '12 at 13:14
  • Unfortunately, this is as minimal as I can get with my example to demonstrate that the captions do not line up. If you can help, that would be appreciated. – ozsu Mar 07 '12 at 13:18
  • Try using the graphicx package with the demo option. You're asking about aligning sub-figures, and that doesn't need TikZ to demonstrate. http://meta.tex.stackexchange.com/q/228/9043 – qubyte Mar 07 '12 at 13:21
  • Alternatively two TikZ rectangles, one in each sub-figure would also work. – qubyte Mar 07 '12 at 13:23
  • OK, I have minimized the example to keep one table on the left and one tikz circle on the right. – ozsu Mar 07 '12 at 13:41
  • It's better, but I'm still not sure why the table needs to be there. Surely the problem is the vertical space that the table takes up, not the fact that it's a table. Wouldn't a box suffice? – qubyte Mar 07 '12 at 13:47
  • I don't think this is a detriment to assisting with the question. The entire example now fits on one screen. I am not sure if the problem is with the tabular construct itself or not since some of the solutions I have found on the net have simple boxes (sometimes one big one small) and they seem to align. I can't get that effect with what I am trying to do and, in the final analysis, I need to get my problem solved, not just two boxes. – ozsu Mar 07 '12 at 16:15
  • I'm trying to help you out here. Your problem is being ignored, probably because of the needlessly complex code that is hiding the actual issue. If you don't want to simplify it, I can do it for you. – qubyte Mar 07 '12 at 16:21
  • Mark: I appreciate your offer. My concern is that I suspect tabular has something to do with this as there are examples of alignment that I could find on the net (before asking here) that had simple includegraphics or boxes and I could not get those to work. The only differences in my case seem to be tabular structure and tikz. I wanted to make sure that I get those considered in the solution. However, if you think there is a better way of asking the question and can help, I would most certainly very much appreciate your assistance. – ozsu Mar 07 '12 at 17:42

1 Answers1

1

Well, I am not sure if it is the best way to achieve what I want, but I have solved my problem by using \raisebox command. Here is what I did and what I get:

\documentclass{scrartcl}        % KOMA script (my preference)

\usepackage{graphicx}
\usepackage{subfig}
\usepackage{tikz-rdf}
\usepackage{tikz}
\usepackage{tkz-graph}
\usepackage{tkz-berge}
\usetikzlibrary{shapes,shapes.callouts,,decorations.text,shapes.misc,decorations.pathmorphing,shapes.geometric,backgrounds,fit,positioning,arrows}

\begin{document}

\begin{figure*}\[ht!\]%
    \subfloat\[\scriptsize Transaction Database $D$\]{%
      \begin{minipage}\[c\]{0.3\textwidth}
    \centering
    \scalebox{.7}{
    \begin{tabular}{| p{1cm} | p{1.5cm} | p{4cm} |}\hline
        Vertex ID & Entity \mbox{vertex} &  Adjacent Attribute Properties \\ \hline \hline
        001 & Person1 & salary, gender, title \\ \hline
        002 & Person2 & salary, gender, title, nationality \\ \hline
        003 & Person3 & salary, gender, title \\ \hline
        004 & Person4 & salary, gender, title, nationality \\ \hline
        005 & Person5 & salary, gender, nationality \\ \hline
        006 & Person6 & salary, title, nationality \\ \hline
        007 & Paper1 & year, inProceedings, paperTitle \\ \hline
        008 & Paper2 & year, inProceedings, paperTitle \\ \hline
        009 & Paper3 & year, inProceedings, paperTitle \\ \hline
        010 & School1 & locatedIn, name \\ \hline
        011 & School2 & locatedIn, name \\ \hline
        012 & School3 & locatedIn, name \\ \hline
    \end{tabular}
    }
      \end{minipage}
       \label{fig:db}%
       }%
%
\subfloat\[\scriptsize T-Index\]{%
          \begin{minipage}\[c\]{0.7\textwidth}
    \centering
    \raisebox{10em}\[18em\]{
    \scalebox{.5}{
    \begin{tikzpicture}\[node distance=1.5cm, every edge/.style={link}\]
%
%Inserting nodes N1-N3
%    
        \node\[circle,draw\] (n0){$N_{0}$};
    \end{tikzpicture}
    }}
      \end{minipage}
       \label{fig:fp}%
       }%
%       \vspace{-0.2in}
 \caption{T-index}%
  \vspace{-0.2in}
 \label{fig:star}
\end{figure*}



\end{document}]

enter image description here

Torbjørn T.
  • 206,688
ozsu
  • 2,385