答案1
您可以在宏中设置每一行,并使用类似\setline[<align>]{<portion>}{<stuff>}
下面定义的方式“手动”将它们展开:
\documentclass{article}
\usepackage{lipsum}
\newcommand{\setline}[3][c]{\hspace*{#2\linewidth}\makebox[0pt][#1]{#3}}
\newenvironment{spreadlines}
{\par
\setlength{\parindent}{0pt}%
\obeylines}
{\par}
\begin{document}
\lipsum[1]
\begin{spreadlines}
\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.}
\end{spreadlines}
\lipsum[2]
\end{document}
如果需要的话,可能可以{<portion>}
自动确定该值。
答案2
套餐mathtools
提供选项\shoveleft[<ofset>]{<part of equation>}
,您可以轻松获得以下楼梯multline
:
代码基于 mathtools 手册中的示例(第 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}