Text FormattingAutomatic paragraph coloring pattern

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Automatic paragraph coloring pattern

Post by gmedina »

Some time ago a challenge was posed in another forum[1] in this thread and I haven't been able to design an acceptable solution to the proposed problem. The idea is to define a command \selstudy with two mandatory arguments; the code

Code: Select all

\selfstudy{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.}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
should produce the outcome shown in tha attached image.

The difficult part (for me) is to achieve the color pattern for the text. Any ideas would be most welcome!

[1] http://foro.migui.com/
Attachments
desafio.jpg
desafio.jpg (74.77 KiB) Viewed 2056 times
1,1,2,3,5,8,13,21,34,55,89,144,233,...

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Automatic paragraph coloring pattern

Post by gmedina »

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

Code, edit and compile here:
\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
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply