编译以下文档时出现警告“name{theorem 0.1} 已被引用但不存在,已被固定名称替换”。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
\usepackage{csquotes}
\usepackage{mathbbol}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\usepackage[english]{varioref}
\usepackage{url}
\usepackage[hidelinks]{hyperref}
\begin{document}
\begin{theorem}\label{thm}
\begin{itemize}
\item item
\end{itemize}
\end{theorem}
In Themrem \ref{thm}
\end{document}
但是,插入可以\hspace{2em}
解决问题,但会将项目移动到新行。
\begin{theorem}\label{thm}
\hspace{2em}
\begin{itemize}
\item item
\end{itemize}
\end{theorem}
我该如何应对警告?
答案1
解决方法是enumitem
。它使用resume*
允许中断列表的键,然后使用相同的参数(计数器、左边距等)继续此列表,但修改的参数除外。我举一个例子enumerate
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
\usepackage{csquotes}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.2pt}
\usepackage{mathbbol}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{enumitem}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\usepackage[english]{varioref}
\usepackage{url}
\usepackage[hidelinks]{hyperref}
\begin{document}
\begin{theorem}\label{thm}
\begin{itemize}
\item item
\end{itemize}Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
\end{theorem}
In Themrem \ref{thm2}\\
However, inserting a \texttt{\textbackslash hspace\{2em\}} solved the problem but moves the item in a new line.
\begin{theorem}\leavevmode\vspace{-\baselineskip}
\label{thm2}%\hspace{2em}
\begin{enumerate}[font=\upshape, leftmargin=9em, nosep, itemsep = 0pt]
\item item Lalala
\end{enumerate}
\begin{enumerate}[resume*, leftmargin=*]
\item Another item. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
\end{enumerate}
\end{theorem}
\end{document}
添加:这是相应的代码itemize
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman,english]{babel}
\usepackage{csquotes}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.2pt}
\usepackage{mathbbol}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{enumitem}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\usepackage[english]{varioref}
\usepackage{url}
\usepackage[hidelinks]{hyperref}
\begin{document}
\begin{theorem}\label{thm}
\begin{itemize}
\item item
\end{itemize}Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
\end{theorem}
In Themrem \ref{thm2}\\
However, inserting a \texttt{\textbackslash hspace\{2em\}} solved the problem but moves the item in a new line.
\begin{theorem}\leavevmode\vspace{-\baselineskip}
\label{thm2}%\hspace{2em}
\begin{itemize}[leftmargin=9em, nosep, itemsep = 0pt]
\item an item
\end{itemize}
\begin{itemize}[resume*, leftmargin=*]
\item Another item with some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.
\end{itemize}
\end{theorem}
\end{document}