\parshape
can handle arbitrary paragraph shapes. One extreme is contained within How to layout irregular paragraph shape, where it can handle setting paragraphs like this:
However, a simplified (and far more often-used) version of \parshape
typically switches between two lengths over a number of lines. For example,
\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\parshape 5
0pt 0.5\textwidth
0pt 0.5\textwidth
0pt 0.5\textwidth
0pt 0.5\textwidth
0.5\textwidth 0.5\textwidth
\noindent\lipsum[1]
\end{document}
However, the use of explicit line lengths that are duplicated makes for cumbersome input – the more lines, the more duplication. Would it be possible to create a macro \newparshape
(say) that would provide the same as the above, yet allow for input of the form
\newparshape{<num>}{<ind> <wd>}[<indL> <wdL>]
where it would set <num>
lines with indent <ind>
and width <wd>
, while subsequent line (<num>
+1 onward) set with indent <indL>
and width <wdL>
. The above example (default) usage would then be replaced with
\newparshape{4}{0pt 0.5\textwidth}[0.5\textwidth 0.5\textwidth]
\noindent\lipsum[1]
In a more general setting, expanding the restriction of setting only two lengths to more would be to generate \newparshape
to accept input of the form
\newparshape
{3}{0pt 0.5\textwidth}% 3 lines with 0pt indent and width 0.5\textwidth, followed by
{2}{0.25\textwidth 200pt}% 2 lines with 0.25\textwidth indent and width 200pt, followed by
{..}{...}% .. lines with ... and ..., followed by
[...]% subsequent lines with indent ... and width ...
Of course, a different interface altogether is also acceptable. For example, something more tabular
-like:
\newparshape{{4}{0pt 0.5\textwidth}{2}{0.25\textwidth 200pt}{..}{...}}[...]
where pairs of arguments are grouped within the first argument of \newparshape{<lines>}[<other>]
, followed by a possible specification of <other>
for the treatment of subsequent lines in an optional argument.
Best Answer