1

This is a nice figure from a database-related paper:

enter image description here

How does one go about "plotting" this figure environment? Essentially, one the left I want to put some SQL query, and on the right I potentially want to put two "blocks" of stuff (in the figure, the right is only one block of stuff".

Thanks in advance for any help!

2
  • 1
    What do you have? This is not your first post - where's your MWE?
    – cfr
    Commented Jul 29, 2018 at 23:13
  • The usual approach is to use minipages, one for each image/thingy. Commented Jul 29, 2018 at 23:24

1 Answer 1

1

From my understanding of your post, it seems you may want 3 sections split across the page? Here is a MWE using minipages, listings and tikz. You can of course adjust the width of each minipage as necessary.

enter image description here

\documentclass{article}
\usepackage[a4paper,margin=25mm,showframe]{geometry}
\usepackage{graphicx} % <--- For including graphics
\usepackage{listings} % <--- For typesetting verbatim code 
\usepackage{tikz}     % <--- For drawing the diagram

\begin{document}

\begin{figure}[!htb]
    \centering
    \begin{minipage}{0.3\textwidth}
        \begin{lstlisting}[language=SQL,basicstyle=\footnotesize\sffamily,numbers=left,numberstyle=\tiny\sffamily]
select *
from R, (select S.D,
   sum(1-S.B) as E,
   sum(S.A*(1-S.B)),
   sum(S.A*(1-S.B)*(1+S.C))
  from S group by S.D) T
where R.Z=T.E and R.B=3
        \end{lstlisting}
    \end{minipage}%
    \begin{minipage}{0.3\textwidth}
        \centering
                \begin{tikzpicture}[ultra thick,inner sep=1pt]
                    \node (S) at (0,0) {$S$};
                    \node (G) at (0,1)  {$\Gamma_{D,aggs}$};
                    \node (B) at (2,1) {$\sigma_{B=3}$};
                    \node (R) at (2,0) {$R$};
                    \node (X) at (1,2) {$X$};
                    \draw (S)--(G) (R)--(B) (G)--(X) (B)--(X);
                \end{tikzpicture}                
    \end{minipage}%
    \begin{minipage}{0.3\textwidth}
        \centering
        \includegraphics[width=0.9\linewidth]{example-image}
    \end{minipage}
    \caption{caption goes here}
\end{figure}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .