如何右对齐但左对齐?

如何右对齐但左对齐?

我正在写一篇介绍,我需要把我的名字放在页面右侧的末尾,但应该左对齐:

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
I psum has been the industry's standard dummy text ever since the 1500s, when an 
unknown printer took a galley of type and scrambled it to make a type specime n
book. It has survived not only five centuries, but also the leap into electronic
typesetting, remaining essentially unchanged. It was popularised in the 1960s w
ith the release of Letraset.

                                                                  Andriy D.
                                                                  Toronto, 2009

实现此目标的最佳方法是什么?任何建议都值得赞赏!

答案1

一个简单的方法是使用tabular环境:

\documentclass{article}
\usepackage{lipsum}
\pagestyle{empty}
\begin{document}

\lipsum[1]

\hfill
\begin{tabular}{@{}l@{}}
Andriy D.\\
Toronto, 2009
\end{tabular}

\end{document}

代码输出

答案2

使用 Plain TeX 实现此目的的一种方法:

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem
I psum has been the industry's standard dummy text ever since the 1500s, when an
unknown printer took a galley of type and scrambled it to make a type specimen
book. It has survived not only five centuries, but also the leap into electronic
typesetting, remaining essentially unchanged. It was popularised in the 1960s
with the release of Letraset.

{
  \parindent=0em
  \setbox0=\hbox{Toronto, 2009}
  \hfill\vbox{\hsize=\wd0
  Andriy D.\par
  \box0\par}
}

\bye

相关内容