
我想\hfill
在選項卡環境中使用,但似乎沒有效果。我該怎麼做?
微量元素:
\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}
(由於某種原因,我無法上傳螢幕截圖,因為我收到錯誤訊息“無法上傳圖像;伺服器上發生錯誤”)
答案1
我建議使用某種表格環境。這是一個包含包的範例tabularray
:
\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}
答案2
您可以透過巨集測量文本\tabset
,並使用文字來測量寬度\tabuse
。您不需要選項卡環境。
\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