答案1
从我对您帖子的理解来看,您可能希望将页面分成 3 个部分?这是使用minipages
、listings
和 的MWE。当然,您可以根据需要tikz
调整每个部分的宽度。minipage
\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}