I want to typeset a book with some \parshape command, for example:
\documentclass{article}
\usepackage{lipsum}
\begin{document}
\parshape=4
0.2\textwidth 0.8\textwidth
0.2\textwidth 0.8\textwidth
0.2\textwidth 0.8\textwidth
0pt \textwidth
\lipsum
\end{document}
But since the lines and width may changes frequently, so I want to define a command like this
\newcounter{foo}
\setcounter{foo}{0}
\newcommand{\MyParShape}[3]
{
\parshape=#1
\loop
#2\textwidth #3\textwidth
\addtocounter{foo}{1}
\if\thefoo<#1-1\repeat
0pt \textwidth
}
So I can call it like
\MyParShape{5}{0.5}{0.5}
or
\MyParShape{10}{0.8}{0.2}
But this does not work, I'm not an expert of TeX primitives, can somebody help?