如何在段落内逐行列举项目而不是每项都单独列一行?

如何在段落内逐行列举项目而不是每项都单独列一行?

我想要以下内容:

A graph can be cut in several ways including 
\begin {enumerate*} [label=\itshape\alph*\upshape)]
\item minimum cut, \item normalised cut and \item average cut. 
\end {enumerate*} 
In our project we have surveyed the Normalised Cut (Ncut)  algorithm for image segmentation.

图形可以用多种方式切割,包括 1) 最小切割、2) 正则化切割和 3) 平均切割。在我们的项目中,我们调查了用于图像分割的正则化切割 (Ncut) 算法。

答案1

enumitem如果您(a)使用该选项加载包inline并且(b)使用enumerate*环境,您将获得一个内联枚举列表:

在此处输入图片描述

\documentclass{article}
\usepackage[inline]{enumitem}
\begin{document}
A graph can be cut in several ways including 
\begin {enumerate*} [label=\itshape\alph*\upshape)]
\item minimum cut, \item normalised cut and \item average cut. 
\end {enumerate*} 
In our project we have surveyed the Normalised Cut (Ncut)  algorithm for image segmentation.
\end{document}

答案2

使用enumitem包和inline选项,一切都变得简单。使用shortlabels选项可以更简单地格式化标签,就像 enumerate包一样。请注意,不需要标点符号:由环境来处理。

\documentclass[12pt, a4paper]{report}

\usepackage[utf8]{inputenc}
\usepackage[textheight = 24cm]{geometry}
\pagestyle{empty}
\usepackage{lipsum}
\usepackage[inline, shortlabels]{enumitem}
\setlist{itemjoin ={,\enspace},itemjoin* = { and\enspace}}

\begin{document}

A graph can be cut in several ways including
\begin {enumerate*} [1) ]%
\item minimum cut \item normalised cut \item average cut.
\end {enumerate*}
In our project we have surveyed the Normalised Cut (Ncut)  algorithm for image segmentation.

\end{document} 

在此处输入图片描述

答案3

inlineenum如果您愿意的话,请打造您自己的环境:

在此处输入图片描述

\documentclass{article}
\newcounter{inlineenum}
\renewcommand{\theinlineenum}{\alph{inlineenum}}
\newenvironment{inlineenum}
  {\unskip\ignorespaces\setcounter{inlineenum}{0}%
   \renewcommand{\item}{\refstepcounter{inlineenum}{\textit{\theinlineenum})~}}}
  {\ignorespacesafterend}
\begin{document}

A graph can be cut in several ways including
\begin{inlineenum}
  \item minimum cut,
  \item normalised cut and
  \item average cut. 
\end{inlineenum}
In our project we have surveyed the Normalised Cut (Ncut)  algorithm for image segmentation.

\end{document}

相关内容