使用 TeXstudio 时出现以下错误
孤独的 \item——也许缺少列表环境。\item{
每当\item{$\bullet$} text
使用
参见下面的示例
我从数百个没有开始语句的单行项目中获取了此文档。
问题 如果需要 begin{itemize},是否可以为整个文档声明一次?
\documentclass{book}
\usepackage{listings}
\usepackage{enumitem}
% This begins the document:
\begin{document}
% This line effectively turns off "Underfull \vbox" and "Underfull \hbox" error messages.
\hbadness=20000
\vbadness=20000
\tolerance = 1000
\pretolerance = 10000
% Define "pseudocode" as a language recognized by the "listings" package:
\lstdefinelanguage{pseudocode}
{morekeywords={DECLARE,BEGIN,END,LOOP,ENDLOOP,SET,IF,THEN,CALL,RETURN,ELSEIF,ELSE,ENDIF,PRINT,OUTPUT,AND,OR},
morecomment=[l]{//}
}
\lstloadlanguages{pseudocode,[ANSI]C}
% This item list works fine
\begin{itemize}
\item Version 1.1 -- released April 16, 2017 for public use
\end{itemize}
%This is the type of list structure that I need using TeXstudio
\item{$\bullet$} Insert bullet text here
%% The end! %%
\end{document}
\end{book}
答案1
真正改变 latex 语法最终会给你带来麻烦,但你可能不想编辑别人写的几百兆字节的 tex……
\item
事实上,忽略默认值比产生错误要简单得多。
\documentclass{book}
\usepackage{listings}
\usepackage{enumitem}
\renewcommand\makelabel[1]{}% silence lonely item error
% This begins the document:
\begin{document}
% This line effectively turns off "Underfull \vbox" and "Underfull \hbox" error messages.
% please don't !
%\hbadness=20000
%\vbadness=20000
%\tolerance = 1000
%\pretolerance = 10000
% Define "pseudocode" as a language recognized by the "listings" package:
\lstdefinelanguage{pseudocode}
{morekeywords={DECLARE,BEGIN,END,LOOP,ENDLOOP,SET,IF,THEN,CALL,RETURN,ELSEIF,ELSE,ENDIF,PRINT,OUTPUT,AND,OR},
morecomment=[l]{//}
}
\lstloadlanguages{pseudocode,[ANSI]C}
% This item list works fine
\begin{itemize}
\item Version 1.1 -- released April 16, 2017 for public use
\end{itemize}
%This is the type of list structure that I need using TeXstudio
\item{$\bullet$} Insert bullet text here
%% The end! %%
\end{document}
\end{book}