\documentclass[12pt]{article} \usepackage[margin=1in]{geometry} \usepackage{mathptmx,amsmath} \parskip=12pt %--- Define a new language for tex \weaveOpts{newlang = TeX:tex} %--- Formatting for TeX \TeXweaveOpts{prompt="", results=tex, beforeout="\fbox{\begin{minipage}{\linewidth}", afterout="\end{minipage}}"} %--- Formatting for tex \texweaveOpts{prompt="", results=tex, codefmt="fontsize=\footnotesize", beforecode="\par\noindent\begin{minipage}[t]{.48\linewidth}", aftercode="\end{minipage}\hfill", beforeout="\begin{minipage}[t]{.48\linewidth}", afterout="\end{minipage}"} \begin{document} \section*{\LaTeX{} test} If you want to make a handout showing how to do stuff in \LaTeX{}, it's pretty easy to do. This is one instance where it is convenient to define a new language'' so that we have a choice of two formats. \subsection*{Stacked format} If we use the \texttt{TeX} language, we get a stacked format \begin{TeXcode} To solve the equation $ax^2 + bx + c=0$, use $$\label{qe} x = \frac{-b \pm \sqrt{b^2 - 4ac}} {2a}$$ Equation~(\ref{qe}) is called the \emph{quadratic formula}. \end{TeXcode} \subsection*{Side-by-side format} If we use the \texttt{tex} language, we get a side-by-side display: \begin{texcode} To solve the equation $ax^2 + bx + c=0$, use $$\label{qe} x = \frac{-b \pm \sqrt{b^2 - 4ac}} {2a}$$ Equation~(\ref{qe}) is called the \emph{quadratic formula}. \end{texcode} \end{document}