Hang rest of paragraph after specific point (or token)

by Andreas Storvik Strauman   Last Updated December 06, 2018 15:23 PM

Say I have some point in a sentence that I want the rest of the paragraph to hang after; result like this:

PART / Long title that won't fit on one line that
       we want hanged after the slash on the next line

I made this work ish by calculating the width of a box containing the PART / prefix, like so:

\documentclass{article}
% Prevent extra indent
\setlength\parindent{0pt}
% Box to contain the stuff that the text will hang after
\newbox\partprefixBox
% The stuff that the text will hang after
\def\partprefix{\Large PART /\nobreakspace}
% Set part-header-prefix into the box
\setbox\partprefixBox=\hbox{\partprefix}
\begin{document}
    \bgroup
     % Set the hangindent size (using the box width)
    \hangindent=\wd\partprefixBox%
    \hangafter=1%
    \partprefix Long title that won't fit on one line that we want hanged after the slash on the next line\par
    \egroup
\end{document}

I'm wondering if there is a more robust way of doing this, and whether there is a way to do it with centered text (i.e. if the text is not gonna break, then it should be centered).

Ideally something like a \hanghere command that would work like so:

PART / \hanghere Long title that won't fit on one line that we want hanged after the slash on the next line

or this syntax would also work

\hanghere{PART / }Long title that won't fit on one line that we want hanged after the slash on the next line

and produce the first mentioned result

Any ideas? Help is very much appreciated.



Related Questions


Updated November 02, 2018 15:23 PM

Updated December 05, 2018 21:23 PM

Updated August 28, 2018 15:23 PM

Updated July 13, 2017 09:23 AM

Updated August 13, 2017 08:23 AM