我想將我的文字對齊在符號“:”或其他符號下,例如我想要類似的東西:
First thing : Blablablabla ...
Blablabla
Second : blablablabla
blabla
我不知道該怎麼做,我嘗試了很多環境,例如 {enumerate} 或 {itemize} 或 {description} 但沒有一個起作用。
我怎樣才能做我想做的事?
謝謝。
謝謝,但這對我沒有多大幫助:事實上,我想在對齊剩餘文本之前寫下我想要的內容,例如文章中的引用:
[Friedman1967] Here there is the reference
which is long.
[Zu2014] Here is an other, the alignment is different.
but it is stil coherent.
不知道我說清楚了沒有,抱歉。
答案1
獲得所需對齊方式的一種方法是定義自訂巨集:
筆記:
- 這
showframe
套餐 僅用於顯示頁邊距。在您的實際用例中不需要它。
代碼:
\documentclass{article}
\usepackage{showframe}
\newlength{\LabelWidth}
\newcommand*{\AlignedText}[2]{%
\par\noindent\textbf{#1:}
\settowidth{\LabelWidth}{\textbf{#1} }%
\parbox[t]{\dimexpr\linewidth-\LabelWidth-\parsep\relax}{#2\strut}%
}
\begin{document}
\AlignedText{Friedman1967}{Here is the reference
which is quite long and spills onto a second line.}
\AlignedText{Zu2014}{Here is an other, the alignment is different,
but it is still coherent, and also takes more than one line.}
\end{document}