Usando \hfill no ambiente de tabulação

Usando \hfill no ambiente de tabulação

Eu gostaria de usar \hfillem um ambiente de tabulação, mas parece não surtir efeito. Como eu posso fazer isso?

MWE:

\documentclass{article}

\setlength{\parindent}{0pt}

\begin{document}

\begin{tabbing}
Foo bar baz: \= Lib  \hfill Bizim\\
Foo: \> Kip\\
\end{tabbing}

Foo bar baz: Lib  \hfill Bizim

Foo: Kip

\end{document}

(Por algum motivo, não consigo fazer upload de uma captura de tela, pois recebo uma mensagem de erro "Falha ao fazer upload da imagem; ocorreu um erro no servidor")

Responder1

Sugiro usar algum tipo de ambiente tabular. Aqui um exemplo com o tabularraypacote:

\documentclass{article}

\setlength{\parindent}{0pt}

\usepackage[showframe]{geometry} % just to show that the text is aligned with the margin
\usepackage{tabularray}

\begin{document}

\begin{tblr}{@{}lX@{}}
Foo bar baz: & Lib  \hfill Bizim\\
Foo: & Kip\\
\end{tblr}

\end{document}

insira a descrição da imagem aqui

Responder2

Você pode medir o texto por \tabsetmacro e usar o texto para medir a largura em \tabuse. Você não precisa tabular o ambiente.

\newdimen\tabw
\def\tabset#1{\par \setbox0=\hbox{#1}\tabw=\wd0 \leavevmode\box0 }
\def\tabuse#1{\par \leavevmode\hbox to\tabw{#1\hss}}

\tabset {Foo bar baz:} \ Lib  \hfill Bizim
\tabuse {Foo:}         \ Kip

Responder3

Talvez o alinhamento correto \`tenha o efeito que você pretende

\begin{tabbing}
\hspace{0.2\textwidth} \= \hspace{0.2\textwidth} \= \hspace{0.2\textwidth}  \kill   % \kill lets the definition line disappear
Foo bar baz: \> Lib \` right aligned Bizim\\
Foo: \> Kip \> Bizim \\
\end{tabbing}

insira a descrição da imagem aqui

informação relacionada