add tag
ravi
I would like add a colophon at the of each chapter in my book such that it prints text in an inverted pyramid. I have some code that achieves this but it has a few problems such as breaking up words (of proper nouns etc.) that the publisher does not want to happen. Further, the number of words appearing per each row of the pyramid varies depending on the text that precedes it. I can, at best, show an MWE here because I cannot share the entire source of the book that runs into 100's of pages and probably will make the publisher unhappy. To compile this, you would need to install the Sanskrit 2003 font (from https://omkarananda-ashram.org/Sanskrit/sanskrit2003.zip)


```
\documentclass{article}
\usepackage{fontspec}

\newfontfamily\myfont[Script=Devanagari, Scale=1.1]{Sanskrit 2003}
\usepackage{microtype,shapepar}
\def\triangledownshape{%
{0}%
{0}b{0}\\%
{0}t{-10}{20}\\%
{4}t{-5}{10}\\%
{8}e{0}%
}
\def\starttaper{\shapepar{\triangledownshape}}


\begin{document}


\starttaper
 śrīmatkompellopanāmakakāmeśvarāvadhānināṃ tṛtīyaputreṇa anantalakṣmīgarbhasaṃbhūtena kāśyapasagotreṇa rāmasūryanārāyaṇaśarmaṇā evaṃ
śrīmatparimyupanāmakasatyanārāyaṇaśarmaṇāṃ putreṇa śyāmalāgarbhasaṃbhūtena haritasagotreṇa raviśarmaṇā ca
kulapatīnām ācāryāṇāṃ śrīmuralīdharaśarmaṇāṃ vacanaṃ śirasā dhṛtvā praṇītāyāṃ bālyasakhīsamākhyāyāṃ naiṣadhīyacaritamahākāvyasya saralavyākhyāyāṃ dvādaśaḥ sargaḥ samāptaḥ
\par

\starttaper
\myfont
श्रीमत्कोम्पेल्लोपनामककामेश्वरावधानिनां तृतीयपुत्रेण अनन्तलक्ष्मीगर्भसंभूतेन काश्यपसगोत्रेण रामसूर्यनारायणशर्मणा % no breaks for these words
एवं
श्रीमत्परिम्युपनामकसत्यनारायणशर्मणां पुत्रेण श्यामलागर्भसंभूतेन हरितसगोत्रेण रविशर्मणा % no breaks for these words
च राष्ट्रियसंस्कृतविश्वविद्यालयस्य कुलाधिपतीनां पद्मभूषणबिरुदभाजां
श्रीनीडामङ्गलं गोपालस्वामिमहोदयानाम् % no breaks for these words
एवं कुलपतीनाम् आचार्याणां
श्रीमुरलीधरशर्मणां % no breaks for this word
वचनं शिरसा धृत्वा प्रणीतायां बाल्यसखीसमाख्यायां नैषधीयचरितमहाकाव्यस्य सरलव्याख्यायां अष्टमः सर्गः समाप्तः
\end{document}
```


Also attached are the output of processing the above code (pyramid-sanskrit) and one page from the book where the pyramid appears, where some of words are hyphenated (marked in red).

Are there any other ways of creating text in the inverse pyramid while following the constraints of not breaking up certain words?

![pyramid-sanskrit.png](/image?hash=35319d27e9ee9da7a3ae80886392070223f7802ab30dae2f0a6a53955eca419f)
![pyramid-in-last-page-of-chapter.png](/image?hash=74f250fee7cf095b5fb97c2c8edfcfe5d439dfebb903f6ed6e2340f74163c4e4)
Top Answer
samcarter
The `shapepar` package will automatically set `\hyphenpenalty` and `\exhyphenpenalty` to 10, which makes hyphenated words very likely. 

I did not find a good place the patch the offending macro, but you can make a copy of `shapepar.sty`, rename it to something like `shapepar_mod.sty` and change line 167 from

```
\hyphenpenalty10 \exhyphenpenalty10 % optimise
```

to

```
\hyphenpenalty10000 \exhyphenpenalty10000 % optimise
```

and then load the modified package with `\usepackage{shapepar_mod}`

---

Caveat: Without hyphenation, short lines with only one word will likely disturb the geometric shape by being too short or too long.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.