如何制作这种格式???
我在 overleaf 中使用多列功能,代码如下。
\begin{multicols}{2}
\footnotesize
\begin{itemize}
\setlength{\itemsep}{0pt}
\setlength{\parsep}{0pt}
\setlength{\parskip}{0pt}
\item zero operation
\item skip connection
\item 3x3 max pooling
\item 3x3 conv
\item 3x3 conv, repeat 2
\item 3x3 separable conv
\item 3x3 separable conv, repeat 2
\item 3x3 dilated separable conv, dilation=2
\item 3x3 dilated separable conv, dilation=4
\item 3x3 dilated separable conv, dilation=2, repeat 2
\end{itemize}
\end{multicols}
但只得到:
如何制作两列和一列格式?
答案1
这使用tabto
包装成宏的包\indentitem
,带有可设置的参数\myindent
。
正如 MadyYuvi 所说,右侧项目符号中的任何换行符都不会与右列对齐,而是重置到左侧。我这样做是因为我觉得在这种情况下,原贴作者会选择将项目设置为单行,本质上只对itemize
短项目使用拆分。
\documentclass{article}
\usepackage{tabto,enumitem}
\newcommand\myindent{1.5in}
\newcommand\indentitem{\tabto{\myindent}$\bullet$\hspace{\labelsep}}
\begin{document}
\footnotesize
\begin{itemize}[itemsep=0pt, parsep=0pt]
\item zero operation
\indentitem 3x3 separable conv, repeat 2
\item skip connection
\indentitem 3x3 max pooling
\item 3x3 conv
\indentitem 3x3 conv, repeat 2
\item 3x3 separable conv
\item 3x3 dilated separable conv, dilation=2
\item 3x3 dilated separable conv, dilation=4
\item 3x3 dilated separable conv, dilation=2, repeat 2
\end{itemize}
\end{document}
答案2
借助hlist
包,可以满足期望:
\documentclass{book}
\usepackage{hlist}
\begin{document}
\hlist[label={\textbullet}]2
\hitem zero operation
\hitem skip connection
\hitem 3x3 max pooling
\hitem 3x3 conv
\hitem 3x3 conv, repeat 2
\hitem 3x3 separable conv
\hitem 3x3 separable conv, repeat 2
\hitem(2) 3x3 dilated separable conv, dilation=2
\hitem(2) 3x3 dilated separable conv, dilation=4
\hitem(2) 3x3 dilated separable conv, dilation=2, repeat 2
\endhlist
\end{document}
输出:
答案3
另外两个解决方案:使用tasks
包,另一个使用shortlst
包。出于许可原因,后者不属于任何发行版。基于此,我定义了一个tabitemize
环境,使用两个键:nc
用于列数(默认为 3)和 il
用于内衬(默认为 1.5)。
对于较长的物品,必须通过柱子展开,您可以\task*
在第一个包裹中使用\task
。第二个包裹会自动展开。
\documentclass{article}
\usepackage{tasks}
\usepackage{shortlst, xkeyval, setspace}
\settasks{before-skip =\smallskipamount}
\makeatletter
\newcounter{ncol}
\define@key{lex}{nc}[3]{\setcounter{ncol}{#1}}%% 3 columns by default
\define@key{lex}{il}[1.5]{\def\@intln{#1}}% interlining![1]
\newenvironment{tabitemize}[1][]{%
\setkeys{lex}{nc,il,#1}
\settowidth{\labelwidth}{\mbox{\textbullet)}}
\setlength{\leftmargini}{2em}%\setlength{\itemsep}{0pt}
\setlength{\shortitemwidth}{\dimexpr\linewidth/\value{ncol}-\labelwidth-2\labelsep\relax}%
\setstretch{\@intln}
\begin{shortitemize}}%
{\end{shortitemize}
}%
\begin{document}
\begin{tasks}[style=itemize, after-item-skip=-1ex](2)
\task zero operation
\task skip connection
\task $3×3$ max pooling
\task $3×3$ conv
\task $3×3$ conv, repeat 2
\task $3×3$ separable conv
\task* $3×3$ separable conv, repeat 2
\task* $3×3$ dilated separable conv, dilation=2
\task* $3×3$ dilated separable conv, dilation=4
\task* $3×3$ dilated separable conv, dilation=2, repeat 2
\end{tasks}
\vspace{1cm}
\begin{tabitemize}[nc=2, il=1]
\item zero operation
\item skip connection
\item $3×3$ max pooling
\item $3×3$ conv
\item $3×3$ conv, repeat 2
\item $3×3$ separable conv
\item $3×3$ separable conv, repeat 2
\item $3×3$ dilated separable conv, dilation=2
\item $3×3$ dilated separable conv, dilation=4
\item $3×3$ dilated separable conv, dilation=2, repeat 2
\end{tabitemize}
\end{document}