Alineación derecha de dos líneas irregulares izquierdas

Alineación derecha de dos líneas irregulares izquierdas

Tengo dos pequeñas líneas de texto con diferente ancho. Quiero enjuagarlos a la derecha manteniendo su justificación izquierda y la altura de línea del texto anterior.

\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}

ingrese la descripción de la imagen aquí

Respuesta1

Puede utilizar una alineación tabularcon [t]operación.

\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}

ingrese la descripción de la imagen aquí

Respuesta2

La solución más sencilla es poner un \strutambos al final del texto anterior y dentro de \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}

Pero no se recomienda utilizar comandos de boxeo primitivos en LaTeX.

información relacionada