Just an update. A few days ago (February the 14th) I posted a question about this problem in
this thread in
comp.text.tex;
Philipp Stephani gave me the hint that I needed to finally build the required command.
Here I post the final solution to the challenge and an example; the code contains some comments (in Spanish):
Code: Select all
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,shapes}
% caja auxiliar (para guardar cada línea en \ponerlineas)
\newsavebox\linebox
% contador para el número de líneas en el párrafo
% al que se aplica \ponerlineas
\newcounter{numlin}
% macro que disecta párrafos en sus líneas constituyentes
% para (en este caso) agregar una línea blanca entre renglones
\newcommand*\ponerlineas{%
\setcounter{numlin}{0}
\setlength\textwidth{14.8cm}%
\setbox\linebox\lastbox
\ifvoid\linebox\medskip\else
\unskip
\unpenalty
{\ponerlineas}%
\hspace*{3cm}\box\linebox\hspace*{-3cm}
\smallskip\stepcounter{numlin}
\color{white}{\hrule width\textwidth height1pt}
\smallskip
\fi
}
% el ícono para el casete
\newcommand*\casete{%
\begin{tikzpicture}
\node [matrix,fill=black,inner sep=2pt,ampersand replacement=\&]
{%
\draw [draw=none,fill=white] (-2pt,0) circle (1.5pt); \&
\draw [fill=black] (0,0) circle (1.5pt); \&
\draw [draw=none,fill=white] (0,0) circle (1.5pt);\\
};
\end{tikzpicture}
}
% el ícono para los audífonos
\newcommand*\audifonos{%
\begin{tikzpicture}[node distance=5pt]
\node (b) [fill=black,minimum size=4pt,circle,inner sep=0pt] {};
\node (c) [fill=black,minimum size=4pt,circle,inner sep=0pt,left of=b] {};
\draw [very thick] (b) .. controls +(60:9pt) and +(120:9pt) .. (c);
\end{tikzpicture}
}
% longitud a usar para adicionar espacio vertical luego del tikzpicture
\newlength\mylen
% el comando principal
\newcommand*\miejercicio[2]{%
\setlength\mylen{0pt}
\begin{tikzpicture}[remember picture,overlay]
\node[xshift=-1.24in,anchor=north west,inner sep=0pt] (a)
{\setlength\fboxsep{0pt}%
\colorbox{gray!50}{%
\hspace*{-3pt}%
\vbox{%
\mbox{\ }\\%
\llap{\makebox[23pt][c]{\audifonos}}\textbf{First listen to:}\\%
\parshape 1 2cm 10cm %
\makebox[12pt][l]{\textbullet}#1\\%
\llap{\makebox[23pt][c]{\casete}}\textbf{Now record them.}\\%
#2\\%
\phantom{A}
\par
\ponerlineas
}%
}%
};
\end{tikzpicture}
\begin{tikzpicture}[remember picture,overlay]
\draw [fill=white,draw=none]
($(a.north west)$) -- +(2cm,0cm) -- +(0cm,-1.95cm);
\draw [fill=black!75,draw=none]
($(a.north west)+(2cm,0cm)$) -- +(0,-1.95cm) -- +(-2cm,-1.95cm) --
node [below,rotate=44,xshift=2pt,yshift=1pt]
{%
\textcolor{white}{\fontsize{9}{10}\selectfont\bfseries\sffamily SELF-STUDY}
}
($(a.north west)+(2cm,0cm)$) ;
\end{tikzpicture}\par
\addtocounter{numlin}{3}
\addtolength\mylen{\thenumlin\baselineskip}
\addtolength\mylen{\thenumlin pt}
\vspace*{\mylen}
}
\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
\miejercicio{Exercises 1 and 4.}{Review the information from Exercise 5. Make a brief recording answering this question: Are the requirements for a college degree in your country similar to those in the United States? Explain the similarities and differences.}
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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...