答案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}