目标是有一个列表,其成员水平显示,并且只有当分隔符不是字符串末尾时才显示该分隔符。
下面的代码产生了与我想要的结果类似的结果,但结果非常糟糕。特别是,最后一个解决方案(即最接近我想要的结果)在句子列表而不是单词列表的情况下会弄乱空格。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[a5paper]{geometry}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}
\begin{document}
% 1. List of items with a bullet separator
Lorem
\textperiodcentered{} ipsum
\textperiodcentered{} dolor
\textperiodcentered{} sit
\textperiodcentered{} amet
\textperiodcentered{} consectetur
\textperiodcentered{} adipiscing
\textperiodcentered{} elit
\textperiodcentered{} sed
\textperiodcentered{} do
\textperiodcentered{} eiusmod
\textperiodcentered{} tempor
\textperiodcentered{} incididunt
\textperiodcentered{} ut
\textperiodcentered{} labore
\textperiodcentered{} et
\textperiodcentered{} dolore
\textperiodcentered{} magna
\textperiodcentered{} aliqua.
% 2. The same as before but with forced line-breaks without separator
Lorem
\textperiodcentered{} ipsum
\textperiodcentered{} dolor
\textperiodcentered{} sit
\textperiodcentered{} amet
\textperiodcentered{} consectetur
\textperiodcentered{} adipiscing
\textperiodcentered{} elit\\
sed
\textperiodcentered{} do
\textperiodcentered{} eiusmod
\textperiodcentered{} tempor
\textperiodcentered{} incididunt
\textperiodcentered{} ut
\textperiodcentered{} labore
\textperiodcentered{} et
\textperiodcentered{} dolore \\
magna
\textperiodcentered{} aliqua.
% 3. Introducing \hfill to justify the list.
Lorem
\hfill \textperiodcentered{} \hfill ipsum
\hfill \textperiodcentered{} \hfill dolor
\hfill \textperiodcentered{} \hfill sit
\hfill \textperiodcentered{} \hfill amet
\hfill \textperiodcentered{} \hfill consectetur
\hfill \textperiodcentered{} \hfill adipiscing
\hfill \textperiodcentered{} \hfill elit\\
sed
\hfill \textperiodcentered{} \hfill do
\hfill \textperiodcentered{} \hfill eiusmod
\hfill \textperiodcentered{} \hfill tempor
\hfill \textperiodcentered{} \hfill incididunt
\hfill \textperiodcentered{} \hfill ut
\hfill \textperiodcentered{} \hfill labore
\hfill \textperiodcentered{} \hfill et
\hfill \textperiodcentered{} \hfill dolore \\
magna
\textperiodcentered{} aliqua.
\end{document}
答案1
您可以使用自由选择(与行尾连字符使用的机制相同)
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[a5paper]{geometry}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}
\newcommand\zzz{%
\ifhmode\unskip\fi
\leavevmode
\nobreak\hspace{.3em plus 5em}%
\discretionary{}{}{\textperiodcentered}\nobreak
\hspace{.3em plus 5em}%
}
\begin{document}
% 1. List of items with a bullet separator
Lorem
\zzz ipsum
\zzz dolor
\zzz sit
\zzz amet
\zzz consectetur
\zzz adipiscing
\zzz elit
\zzz sed
\zzz do
\zzz eiusmod
\zzz tempor
\zzz incididunt
\zzz ut
\zzz labore
\zzz et
\zzz dolore
\zzz magna
\zzz aliqua.
\end{document}