showexpl package that loads listings package might be interesting for you as it provides more sophisticated features as follows.
\documentclass[preview,border=12pt,12pt]{standalone}
\usepackage{accsupp}
\newcommand*{\noaccsupp}[1]{\BeginAccSupp{ActualText={}}#1\EndAccSupp{}}
\usepackage{xcolor}
\usepackage{showexpl}
\lstdefinestyle{Common}
{
language={[LaTeX]TeX},
numbers=left,
numbersep=1em,
numberstyle=\tiny\noaccsupp,
frame=single,
framesep=\fboxsep,
framerule=\fboxrule,
rulecolor=\color{red},
xleftmargin=\dimexpr\fboxsep+\fboxrule,
xrightmargin=\dimexpr\fboxsep+\fboxrule,
breaklines=true,
breakindent=0pt,
tabsize=2,
columns=flexible,
includerangemarker=false,
rangeprefix=//\ ,
}
\lstdefinestyle{A}
{
style=Common,
backgroundcolor=\color{yellow!10},
basicstyle=\scriptsize\ttfamily,
keywordstyle=\color{blue}\bf,
identifierstyle=\color{black},
stringstyle=\color{red},
commentstyle=\color{green}
}
\usepackage{graphicx}
\begin{document}
\section*{lstinline}
\lstinline[style=A]|\LaTeX\ is fun.|
\section*{lstlisting}
\begin{lstlisting}[style=A]
\LaTeX\ is also fun in displayed mode.
\end{lstlisting}
\section*{LTXexample}
\LTXexample[style=A]
\LaTeX\ is fun.
\endLTXexample
\end{document}

verbatimenvironment if you have a lot of text or you can use\verb|\it|. – Sigur Jan 24 '14 at 13:21\verb+\it+and NO!!!!! you do NOT use\itto get italic!!! Please to not teach this to users. Use\textit{...}or if it is for emphasizing\emph{...}.\itisTeXand should not be used in LaTeX – daleif Jan 24 '14 at 13:23\itshapeis also acceptable as a switch. – Steven B. Segletes Jan 24 '14 at 13:27