我有一个很大的文档,我想删除 itemize 的缩进。我发现可以使用包来做到这一点enumitem
,但是当我尝试加载它时,我收到以下错误:
document.tex:427: Undefined control sequence.
\enit@endenumerate ->\enit@after
\endlist \ifx \enit@series \relax \else \if...
l.427 \end{enumerate}
在第 427 行我定义了一个环境:
\begin{enumerate}[\it i)]
\item item1
\item item2
\item item3
\end{enumerate}
我也尝试在不同的位置加载包。有人知道发生了什么吗?
更新
我创建了一个 MWE,其中仅留下了序言:
\documentclass[oneside, a4paper, onecolumn, 11pt]{article}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor} % use color
\usepackage[left=2cm,top=2cm,bottom=1.5cm,right=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{eurosym}
\usepackage{titlesec}
\usepackage{amssymb}
\usepackage{nopageno}
\usepackage{fancyhdr}
\usepackage[shortlabels]{enumitem}
\usepackage{array}
\usepackage{footnote}
\usepackage{multirow}
\usepackage{tabularx,hhline}
\usepackage[export]{adjustbox} % labels beside the figure
\usepackage{quoting} % used for quote environment
\usepackage{floatrow} % for floatsetup
\usepackage{wrapfig} % for wrapping figures with text around
%\usepackage{subfig}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{paralist} % inline list
\usepackage{stmaryrd}
\usepackage{scalerel} % for hybrida logo
\usepackage[natbib, backend=biber, sorting=none, doi=false, eprint=false, maxnames=99, firstinits=true, style=numeric-comp, url=false, isbn=false, defernumbers=true]{biblatex}
\usepackage{setspace} % reduce space of bibliographic entries
% suppress In: in bibliographic entries
\renewbibmacro{in:}{}
\usepackage{tikz}
\usetikzlibrary{matrix, shapes, decorations.shapes, shapes.symbols,calc,shadings,patterns,tikzmark,decorations.pathmorphing,fit,backgrounds}
\DeclareCaptionLabelFormat{r-parens}{\slshape{(#2)}} %Define our custom label
% setup captions for figuress
\captionsetup{textfont=sl, justification=centering} % The general caption settings
\captionsetup[sub]{ % The subcaption settings
% font=footnotesize, % Make the font smaller for both label and text
textfont=sl, % Make only the caption text slanted
labelformat=r-parens} % Use our custom label format
% add bibliography
\addbibresource{bibliography.bib}
% path for figures
\graphicspath{{./figures/}}
% hyperref setup
\usepackage{hyperref}
\definecolor{linkcolour}{rgb}{0,0.2,0.6} % Link color
\hypersetup{colorlinks=true,
breaklinks=true,
urlcolor=linkcolour,linkcolor=linkcolour,
citecolor=NavyBlue} % Set link colors throughout the document
% hybrida logo
\def\hybrida{\scalerel*{\includegraphics{figures/hybrida}}{X\rule[-.6ex]{0pt}{1pt}}}
% remove space in the quoting environment
\quotingsetup{vskip=3pt}
% from texinfo.tex
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
% C++ text
\def\C++{%
\ifmonospace%
C++%
\else%
C\kern-.1667em\raise.50ex\hbox{\tiny{\textbf{+}\kern-.1em\textbf{+}}}%
\fi%
\spacefactor1000 }
% remove indentation
\setlength{\parindent}{0pt}
% change size of sections
\titleformat*{\section}{\large\bfseries}
\titleformat*{\subsection}{\normalsize\bfseries}
%\titleformat*{\subsubsection}{\normalsize\bfseries}
\titleformat*{\paragraph}{\normalsize\bfseries}
\titleformat*{\subparagraph}{\normalsize\bfseries}
% redefine section and subsection titles
%\titleformat{\section}
% {\normalfont\fontsize{12}{15}\bfseries}{\thesection}{1em}{}[{\titlerule[0.1pt]}]
%\titleformat{\subsection}
% {\normalfont\fontsize{10}{10}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\normalfont\fontsize{10}{10}\bfseries\slshape}{\thesubsubsection}{1em}{}[{\titlerule[0.1pt]}]
\begin{document}
\newcounter{saveenum}
\begin{enumerate}[\itshape i)]
\item item 1;
\item item 2
\item item 3
\setcounter{saveenum}{\value{enumi}}
\end{enumerate}
And
\begin{enumerate}[\itshape i)]
\setcounter{enumi}{\value{saveenum}}
\item item 4.
\end{enumerate}
\end{document}
答案1
编辑(在 OP 使用 MWE 更新之后)主要原因是改变了定义的环境paralist
设置。enumerate
enumitem
如果需要内联列表,请使用\usepackage[inline]{enumitem}
和enumerate*
环境。
使用\begin{enumerate}[\it i)]
包enumerate
语法(除了‘错误’\it...
用法)。
enumitem
如果shortlabels
使用包选项,这只能与一起工作。
或者用作[label={\textit{\roman*)}}]
环境的标签设置选项或定义一个新列表。
\documentclass{article}
\usepackage[shortlabels]{enumitem}
\begin{document}
\begin{enumerate}[\itshape i)] % enumerate package style
\item item1
\item item2
\item item3
\end{enumerate}
\begin{enumerate}[label={\textit{\roman*})}] % enumitem style
\item item1
\item item2
\item item3
\end{enumerate}
% Now resume it, i.e. continue it with iv, etc.
\begin{enumerate}[label={\textit{\roman*})},resume] % enumitem style
\item item1
\item item2
\item item3
\end{enumerate}
\end{document}