# Without using minipage, can we resize both input and output boxes of LTXexample?

\documentclass[dvipsnames]{article}
\usepackage{xcolor}
\usepackage[margin=50mm]{geometry}
\usepackage{showexpl}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\SX@codeInput}{xleftmargin=0pt,xrightmargin=0pt}{}
{\typeout{***Successfully patched \protect\SX@codeInput***}}
{\typeout{***ERROR! Failed to patch \protect\SX@codeInput***}}
\makeatother
\lstset{%
literate={ï}{}0
{»}{}0
{¿}{}0,
breaklines=true,
breakindent=0pt,
basicstyle=\ttfamily\scriptsize,
keywordstyle=\color{blue}\sffamily\bfseries,
stringstyle=\rmfamily,
showstringspaces=false,
backgroundcolor=\color{Yellow!30},
frame=single,
framerule=0.4pt,
rulecolor=\color{red},
framesep=3pt,
xleftmargin=3.4pt,
xrightmargin=3.4pt,
tabsize=2,%
explpreset={pos=b,language={[LaTeX]TeX}}%
}
\begin{document}

\section{with minipage}
\noindent%
\begin{minipage}{0.5\linewidth}
\begin{LTXexample}[pos=b]
\begin{enumerate}
\item $\displaystyle \lim_{x\to 8}\frac{1}{(x-8)^2}=+\;\rotatebox{90}{$8$}$
\item $\displaystyle \lim_{x\to 7}\frac{1}{(x-7)^2}=+\;\rotatebox{90}{$7$}$
\item $\displaystyle \lim_{x\to 6}\frac{1}{(x-6)^2}=+\;\rotatebox{90}{$6$}$
\end{enumerate}
\end{LTXexample}
\end{minipage}

\section{without minipage}
\noindent%
\begin{LTXexample}[width=0.5\linewidth,pos=b]
\begin{enumerate}
\item $\displaystyle \lim_{x\to 8}\frac{1}{(x-8)^2}=+\;\rotatebox{90}{$8$}$
\item $\displaystyle \lim_{x\to 7}\frac{1}{(x-7)^2}=+\;\rotatebox{90}{$7$}$
\item $\displaystyle \lim_{x\to 6}\frac{1}{(x-6)^2}=+\;\rotatebox{90}{$6$}$
\end{enumerate}
\end{LTXexample}

\end{document}

-

The key width is only responsible for the formatted text, not the source code. To change the width of the typeset source code, modify your second LTXexample (without minipage) as follows:

\begin{LTXexample}[explpreset={linewidth=0.5\linewidth},width=0.5\linewidth,pos=b]

-
@lockstep, thank you very much. It works. Excellent! :) – xport Dec 8 '10 at 16:00
why do you enclose linewidth=0.5\linewidth by explpreset? without doing that, it still works. I don't know the purpose. – xport Dec 8 '10 at 16:07
It might be worth doing a \newcommand\mywidth{0.5\linewidth} or soemthing, so that you can change both widths at once... – Seamus Dec 8 '10 at 16:12
@xport: I followed p. 2 of the showexpl documentation and p. 33 of the listings documentation. Note: What follows explpreset= is a key-value-list of its own, possibly with several entries. – lockstep Dec 8 '10 at 16:17
So using explpreset is not a necessity, because I have tried without using it & still works. Thank you. – xport Dec 8 '10 at 16:29