同时排列和逐项排列

同时排列和逐项排列

我需要逐项列出文本,但同时将文本放在列中而不使用空格。

我需要的示例:

\begin{itemize}   
\item   blabla  & blabla   
\item   blabla  & blabla  
\end{itemize}

答案1

解决方案是使用tabularx和定义新的列类型 ( I),模仿\item命令。如果要跨页拆分,请加载将ltablex功能带到.Demo 的包,并使用“真实”项目化环境进行比较:longtabletabularx

\documentclass[ a4paper, leqno]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{array, ltablex}
\usepackage{enumitem}%
\usepackage{makecell, etoolbox}
\setcellgapes{\itemsep}
\AtBeginEnvironment{tabularx}{\setcellgapes[b]{\itemsep}\makegapedcells}
\AtEndEnvironment{tabularx}{\vskip\dimexpr-\itemsep-\topsep\relax}
\newcolumntype{I}{@{\hskip\leftmargin} >{\llap{\textbullet\hskip\labelsep}}X}

\begin{document}

Some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text.

\begin{itemize}
  \item A first item,
  \item Another item,
  \item A last item.
\end{itemize}

Some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text%

\begin{tabularx}{\linewidth}{IX}%
  A first item in left column & A first item in right column. Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah \\
  A second item in left column Blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah & A second item in right column
\end{tabularx}
Some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text%

\end{document}

在此处输入图片描述

答案2

另一种方法是使用 parbox

\documentclass{article}
\begin{document}
\begin{itemize}
\item \parbox{2cm}{ blabla} \parbox{2cm}{ blabla sgdjgfdjfgjdjf} \parbox{2cm}{ blabla}
\item \parbox{2cm} {blabla} \parbox{2cm}{blabla} \parbox{2cm}{ blabla}
\end{itemize}
\end{document}

这里即使文本超过 2cm 也会流到下一行。使用 [t] 选项和 parbox 使文本顶部对齐。

答案3

您可以尝试使用表格(调整列宽):

\documentclass[12pt,a4paper]{scrartcl}
\begin{document}
\begin{itemize}
\item \begin{tabular}{p{4cm}p{4cm}} blabla & blabla \end{tabular}
\item \begin{tabular}{p{4cm}p{4cm}} blabla & blabla \end{tabular}
\end{itemize}
\end{document}

答案4

这是一个允许使用itemize分页符的选项:

在此处输入图片描述

\documentclass{article}
\usepackage{paracol,changepage,lipsum}
\newcommand{\insertbullet}{%
  \makebox[0pt][r]{\makebox[1em][l]{\textbullet}}}
\newenvironment{arrayitemize}
  {\par\vspace{\topsep}% Insert gap
   \newcommand{\litem}{% Left \item
     \noindent\insertbullet
     \renewcommand{\litem}{\switchcolumn*%
       \noindent\insertbullet}}
   \newcommand{\ritem}{\switchcolumn\noindent}% Right \item
   \begin{adjustwidth}{1em}{0pt}% Adjust margins
   \begin{paracol}{2}
   \ignorespaces}
  {\end{paracol}
   \end{adjustwidth}
   \vspace{\topsep}%
   \ignorespacesafterend}
\begin{document}

\lipsum[1]

\begin{arrayitemize}
  \raggedright% Just for this example
  \litem 
  A first item in left column 

  \ritem first item in right column. \lipsum[2]

  \litem
  A second item in left column \lipsum[2]

  \ritem
  A second item in right column

\end{arrayitemize}

\lipsum[1]
\end{document}

adjustwidth(从changepage)提供缩进,因此具有列表般的感觉,而paracol提供tabular类似柱状的突破。

相关内容