# Stairs-like multline

The multline environment alignes the first line to the left, the last one to the right, while all the lines in between are simply centered. The result sometimes looks not satisfying, for example, when all the lines are just slightly wider that the half ot the text width.

What I am looking for is a tool to make it apper more "stairs-like", as in the picture below, but without adding manually chosen \hspace{...} into each line.

I know there are all kinds of exceptions such as lines too wide and so on, and I do not expect the solution to always make a perfect output, but there should be something that works in a "generic" case. Any ideas?

You can set each line in a macro that spreads them out "manually" using something like \setline[<align>]{<portion>}{<stuff>} as defined below:

\documentclass{article}

\usepackage{lipsum}

\newcommand{\setline}[3][c]{\hspace*{#2\linewidth}\makebox[0pt][#1]{#3}}
{\par
\setlength{\parindent}{0pt}%
\obeylines}
{\par}

\begin{document}

\lipsum[1]

\setline[l]{0}  {The first line is aligned to the left.}
\setline   {.25}{The second line is (not) centred.}
\setline   {.5} {And so is the third one.}
\setline   {.75}{As well as the fourth --- not centred!}
\setline[r]{1}  {The last line is aligned to the right.}

\lipsum[2]

\end{document}


It would probably be possible to determine the value {<portion>} automatically, if needed.

Package mathtools provide option \shoveleft[<ofset>]{<part of equation>} by which you can easy obtain stairs like multline:

Code based on example in mathtools manual (pp 17):

\documentclass[11pt, border=1mm,
preview]{standalone}
\usepackage{mathtools}

\begin{document}
$\begin{multlined} \framebox[.65\columnwidth]{First line} \\ \shoveleft[1cm]{\framebox[.5\columnwidth]{Second line} } \\ \shoveleft[2cm]{\framebox[.5\columnwidth]{Second line} } \\ \shoveleft[3cm]{\framebox[.5\columnwidth]{Second line} } \\ \framebox[.65\columnwidth]{Last line} \end{multlined}$
\end{document}