Especially for creating slides, I want to influence how LaTeX puts the text I write. In order to keep the layout and the content sort of separate, I would like some sort of environment, where i can predefine individual linewidths for each line LaTeX will put later on.

The simplest use case is that I want my itemize to "wrap" around an image, which is a triangle. I want the first two lines to have a line width of 100 pt, the following line may only have a line width of 90 pt, the next two lines 85 pt, the next 80 pt and all lines following should be 75 pt wide. I would like the essential part of the corresponting tex document look along the lines of:

        \item foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo 
        \item bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar bar
        \item baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz baz

The key part is, that it is still LaTeX that decides which words go on which line and I am still free to write my itemize environment as I like. I also don't want/need the lines filled. I also don't care about spacing between lines (, yet). I just want to provide an individual (maximum) linewidth for each line.

How can this be done? I sometimes see Documents which contain fancy layouts which makes me think there is already some solution available, but I have no idea what to search for.

  • The shapepar package might help. – Bernard Jan 8 '18 at 15:17
  • shapepar should work for me! – Bananguin Jan 8 '18 at 15:26
  • I never really used it (it's based on the plain TeX commands \hangindent=, \hangafter=) and I have no idea whether a list environment within it will nicely work or not. – Bernard Jan 8 '18 at 15:31
  • To be precise, those are TeX primitives as is \parshape. The package is written by Donald Arseneau who is a certified TeX Grand Wizard. It works like a charm. You'll have to study the documentation to get the best out of the package. – sgmoye Jan 8 '18 at 19:04

You can define a \parshape. It affects the current paragraph. But as lists set \parshape too it can need a lot of fiddling to get the wanted output:

\parshape 4 4cm 5cm 5cm 4cm 6cm 3cm 0cm \textwidth

\item \parshape 4 4cm 5cm 5cm 4cm 6cm 3cm \@totalleftmargin \linewidth \lipsum*[1]abc

\parshape \@ne \@totalleftmargin \linewidth
\item abc
\item abc

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.