In listings and showexpl package, my problem is the code is go over the page and one another problem is that how can the image and the code be seperate that the image in previous page and the code in new page when ended the page?
Here is my code
\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{vietnam}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[width=0.00cm, height=0.00cm, left=2.00cm, right=2.00cm, top=2.00cm, bottom=2.00cm]{geometry}
\usepackage{tkz-euclide}
\usepackage{tikz-3dplot}
\usepackage{tikz,tkz-tab,tkz-linknodes}
\usetkzobj{all}
\usetikzlibrary{decorations.text,calc,intersections,patterns}
%sao chép y nguyên code
\usepackage{caption}
\usepackage{listings}
\usepackage{showexpl}
\usepackage{color,xcolor}
\lstset{ % General setup for the package
language=TeX,
breaklines=true,
basicstyle=\small\sffamily,
numbers=left,
numberstyle=\tiny,
frame=tb,
tabsize=4,
columns=fixed,
showstringspaces=false,
showtabs=false,
commentstyle=\color{red},
keywordstyle=\color{blue}
}
\begin{document}
\begin{LTXexample}[pos=t]
%Tree source: http://www.texample.net/tikz/examples/tree-pic/
%Man source: https://tex.stackexchange.com/questions/249588/node-below-icon-in-tikz
\usetikzlibrary{decorations.pathmorphing,shapes}
\tikzset{
treetop/.style = {
decoration={random steps, segment length=0.4mm},
decorate
},
trunk/.style = {
decoration={random steps, segment length=2mm, amplitude=0.2mm},
decorate
}
}
\tikzset{
man/.pic={%
\fill [rounded corners=1.5] (0,0.4) -- (0,0.8) -- (0.4,0.8) -- (0.4,0.4) --
(0.325,0.4) -- (0.325,0.7) -- (0.3,0.7) -- (0.3,0) -- (0.225,0) --
(0.225,0.4) -- (0.175,0.4) -- (0.175,0) -- (0.1,0) -- (0.1,0.7) --
(0.075,0.7) -- (0.075,0.4) -- cycle;
\fill (0.2,0.9) circle (0.1);
\coordinate (-head) at (0.2,1);
\coordinate (-foot) at (0.2,0);
}
}
\begin{center}
\begin{tikzpicture}
\tkzInit[xmin=-11,ymin=-5,xmax=3,ymax=3]
\tkzClip\tkzGrid
\tkzDefPoints{-11/-3/A,-9.8/-2.09/A',0/1.47/B', 2/-3/B,0/-2.09/C,-10.1/-3/M,0/-3/T}
\pic[red] at (-10.1,-3) (myman) {man};
\foreach \w/\f in {0.3/30,0.2/50,0.1/70} {
\fill [brown!\f!black, trunk] (0,0) ++(-\w/2,0) rectangle +(\w,-3);
}
\foreach \n/\f in {1.4/40,1.2/50,1/60,0.8/70,0.6/80,0.4/90} {
\fill [green!\f!black, treetop] ellipse (\n/1.5 and \n);
}
\tkzDrawSegments[dashed](A',B' A',C)
\tkzDrawSegments(A,B T,B')
\tkzMarkAngles[size=0.7cm,arc=ll,mark=|](C,A',B')
\tkzLabelAngles[pos=1.5](C,A',B'){$30^{\circ}$}
\tkzLabelSegment[below](M,T){$20$ cm}
\tkzLabelPoints(A,B,C,A',B',C,M,T)
\end{tikzpicture}
\end{center}
\end{LTXexample}
\end{document}


