2本の左ギザギザ線を右揃えにする

2本の左ギザギザ線を右揃えにする

幅が異なる 2 行の小さなテキストがあります。前のテキストの左揃えと行の高さを維持しながら、右揃えにしたいです。

\documentclass{article}
\usepackage{fontspec} 

\usepackage{lipsum}

\begin{document}

I was yet young in life, which I had begun early; but my intimacy with him was of a recent date: we had been educated at the same schools and university; but his progress through these had preceded mine, and he had been deeply initiated into what is called the world while I was in noviciate noviciate noviciate.

\hfill\vbox{\hbox{Foo}
\hbox{Foobar}}

\end{document}

ここに画像の説明を入力してください

答え1

tabularop アライメントで を使用できます[t]

\documentclass{article}
\usepackage{fontspec}

\usepackage{lipsum}

\begin{document}

I was yet young in life, which I had begun early; but my intimacy with him was of a recent date: we had been educated at the same schools and university; but his progress through these had preceded mine, and he had been deeply initiated into what is called the world while I was in noviciate noviciate noviciate.

\hspace*{\fill}
\begin{tabular}[t]{l@{}}
Foo\\
Foobar
\end{tabular}

\end{document}

ここに画像の説明を入力してください

答え2

\strut最も簡単な解決策は、前のテキストの末尾と の両方にを配置することです\hbox

\documentclass{article}
\usepackage[T1]{fontenc} 

\usepackage{lipsum}

\begin{document}

I was yet young in life, which I had begun early; but my intimacy with him
was of a recent date: we had been educated at the same schools and
university; but his progress through these had preceded mine, and he had
been deeply initiated into what is called the world while I was in
noviciate noviciate noviciate.\strut

\hfill\vbox{\hbox{\strut Foo}
\hbox{Foobar}}

\end{document}

ただし、LaTeX でプリミティブなボックス化コマンドを使用することはお勧めしません。

関連情報