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 am using the following code to have 2 boxes beside each other for code comparison:

\documentclass[12pt]{article}
\usepackage{listings}
\begin{document}

\begin{singlespace}
\begin{minipage}[t]{0.45\textwidth}
\begin{lstlisting}[language=HTML,frame=lrtb]
%one
  %two
    Hi there
\end{lstlisting}%
\end{minipage}%
\hfill
\begin{minipage}[t]{0.45\textwidth}
\begin{lstlisting}[language=HTML,frame=lrtb]
<one>
  <two>
    Hi there
  </two>
</one>
\end{lstlisting}%
\end{minipage}%
\end{singlespace}

\end{document}

This results in the following being rendered:

1

I would like to place custom text between the 2 boxes. Ideally, something that looks like:

2

share|improve this question
1  
Welcome to TeX.sx! Please extend your code to a complete and compilable minimal working example (MWE) (including \documentclass \begin{document} etc. that illustrates your problem. This makes it easier for others to use your code as a basis to help you! –  Daniel Apr 24 '12 at 7:03
    
Could you state your exact requirements? Simply changing \hfill with the text would do it. Do you want line breaking ability? Should the boxes never go beyond the official textwidth, etc.? You can just place a third minipage between the two. –  Martin Scharrer Apr 24 '12 at 7:38
add comment

1 Answer 1

As Martin said, you can use another minipage with with a fbox and parbox to enable line breaking.

\documentclass[12pt]{article}
\usepackage{listings,setspace,amsmath}
\usepackage[margin=2cm]{geometry}
\begin{document}

\begin{singlespace}
\begin{minipage}[r]{0.38\textwidth}
\begin{lstlisting}[language=HTML,frame=lrtb]
%one
  %two
    Hi there
\end{lstlisting}%
\end{minipage}%
\hfil
\begin{minipage}[c]{0.17\textwidth}
\centering
\fbox{
\parbox[m]{.8\textwidth}{\centering Renders $\implies$}}
\end{minipage}%
\hfil
\begin{minipage}[l]{0.38\textwidth}
\begin{lstlisting}[language=HTML,frame=lrtb]
<one>
  <two>
    Hi there
  </two>
</one>
\end{lstlisting}%
\end{minipage}%
\end{singlespace}

\end{document}

enter image description here

share|improve this answer
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.