[Tex/LaTex] How to insert code and graphic in textbox

formattinggraphicslistings

I want to put a graphic and a little linux bash code in a textbox, like the picture blow…
with the follow in problem:

  1. all in a textbox with yellow backgroud

  2. left part is a graphic (a finger)…

  3. right part is the text(annotation), title is “Note” …. bold face…

  4. annotation is in form of item (may be could use \begin{itemize} \item...)

  5. annotation may include bash code (may be could user package listings or minted)…

Could any one tell me how to implement this? some one tell me should use tikz/pgf …

I'm a new user, so could not post images, please refer to

http://www.linuxfromscratch.org/lfs/downloads/stable/LFS_BOOK-6.8.pdf

with the top of page 221 and the top page 13。

(included by moderator:)
Example

Best Answer

Here's an example that you could use as a starting point. Please refer to the documentation of the packages involved and, of course, feel free to adapt and improve my example according to your needs:

\documentclass{article}
\usepackage[margin=2cm]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage{changepage}
\usepackage{framed}
\usepackage{tikz}
\usepackage{listings}
\usepackage{bbding}

% the shaded outter frame
\newenvironment{outshaded}{%
  \def\FrameCommand{\colorbox{yellow!25}}%
  \MakeFramed {\FrameRestore}}%
 {\endMakeFramed}

% the hand pointing right, and the "Note" title 
\newcommand*\mysign{%
  \begin{tikzpicture}
    \node[circle,draw,inner sep=2pt] at (0,-0.2) {\HandRight} ;% the hand pointing
    \node at (1.53,-0.2) {\bfseries Note};
  \end{tikzpicture}}

% this environment will be used to typeset the notes
\newenvironment{note}
  {\begin{outshaded}\mysign%
    \begin{adjustwidth}{2cm}{0cm}}
  {\end{adjustwidth}\end{outshaded}}

% some adjustments for the lstlisting environment used to typeset code
\lstset{backgroundcolor=\color{LightSteelBlue!60},
  frame=trbl,
  rulecolor=\color{black!30},
  xrightmargin=7pt}

\begin{document}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\begin{note}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\begin{lstlisting}
debugfs -R feature /dev/<xxx>
\end{lstlisting}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\begin{lstlisting}
cd /tmp
tar -xzvf /path/to/sources/e2fsprogs-1.41.14.tar.gz
cd e2fsprogs-1.41.14
mkdir -v build
cd build
configure/..
make #note that we intentionally don't 'make install' here!
<misc/mke2fs -jv /dev/<xxx/.
cd /tmp
rm -rfv e2fsprogs-1.41.1
\end{lstlisting}
\end{note}
text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text

\end{document}

The framed package was used to create the shaded outter box; the changepage package was used to increase the left margin inside the shaded box; the TikZ package was used to draw the circle with the pointing hand from the bbding package (this can be improved), and the "Note" title; the listings package was used to typeset code inside a framed and colored box.

This is the result:

enter image description here