I want to put a listing next to a schematic in one figure. The template of the journal, I am writing my article for, suggests using subfloats.

Here is my latex sourcecode,

    numbers=left,% display line numbers on the left side 
    numberstyle=\scriptsize,% use small line numbers 
    numbersep=10pt,% space between line numbers and code 
    breaklines=true,% automatic line breaking     
    morekeywords={input, output, clb, pinlist, subblock, tcon, parameter}
\begin{lrbox}{\tconlist}% Store first listing
.parameter $sel_0$
.parameter $sel_1$

.input i0
pinlist: i0p
.input i1
pinlist: i1p
.input o0
pinlist: o0p

.output o1
pinlist: o1p

.tcon i0p o0p $\neg sel_0$
.tcon i0p o1p $\neg sel_1$
.tcon i1p o0p $sel_0$
.tcon i1p o1p $sel_1$

\subfloat{\includegraphics[width=0.25\textwidth, trim = 60mm 80mm 145mm 35mm, clip]{2x2crossbar_schema}} 
\caption{A schematic of a $2{\times}2$~crossbar switch functionality represented by 4 TCONs and the corresponding TCON netlist}

This results in the following image, enter image description here

How can I align the two floats to the top of the page?


By default, minipages are vertically centered. That is, their anchor point is given halfway up/down the minipage. Since you're placing the lstlisting inside a minipage, it makes sense that it's anchored in the middle.

What you're looking for is either a [t]op or [b]ottom-aligned minipage:

\begin{lrbox}{\tconlist}% Store first listing
\small\begin{minipage}[b]{<len>}% Perhaps also try [t]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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