I would like to be able to use a macro to specify the number of lines in a given \parshape. So, instead of

\parshape 8 ...

for instance, I would like to be able to use

\parshape \NumberOfLines ...

However, this is problematic due to the space following \NumberOfLines being gobbled by the macro. I tried the usual trick I know of such as \relax and {} , \, but those don't work as those are taken as the size specification, which of course is invalid.

The MWE below works fine and produces

enter image description here

However, this has a hard coded number of lines:

    \parshape 8

where I would prefer this to be

    \parshape \NumberOfLines



Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. 
Curabitur dictum
gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. 
Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. 
Nulla et lectus vestibulum urna fringilla ultrices.%

    0.40\hsize 0.20\hsize
    0.35\hsize 0.30\hsize
    0.30\hsize 0.40\hsize
    0.25\hsize 0.50\hsize
    0.20\hsize 0.60\hsize
    0.15\hsize 0.70\hsize
    0.10\hsize 0.80\hsize
    0.05\hsize 0.90\hsize
    0.00\hsize 1.00\hsize

\newcommand*{\NumberOfLines}{8   }
    \parshape 8
    %% ^^^^ The above works, but need to use a macro that contains number of lines.
    %\parshape \NumberOfLines

\parshape 1
{\bfseries\centering My Title\par\smallskip}%
  • the version you show commented out with a space is the answer, so I'm not sure what other answers you want (although I added a \numexpr possibility below. – David Carlisle Nov 15 '18 at 8:06
\newcommand*{\NumberOfLines}{8 }







  • Not sure what changed from yesterday, but yeah those work now! Really, I swear it did NOT work yesterday!! Thanks David. – Peter Grill Nov 15 '18 at 17:46

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.