我开始使用 LyX,直到现在我都印象深刻。我在引用恢复枚举的枚举项时遇到问题。输出中的引用没有给出正确的枚举编号。我的输入如下所示:
我的 Lyx-File 的代码:
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\use_default_options true
\begin_modules
enumitem
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding utf8-cjk
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #718c00
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Enumerate
Test
\end_layout
\begin_deeper
\begin_layout Enumerate
Test2
\begin_inset CommandInset label
LatexCommand label
name "enu:Test2"
\end_inset
\end_layout
\begin_layout Enumerate
Test3
\end_layout
\end_deeper
\begin_layout Standard
Referencing Test2
\begin_inset CommandInset ref
LatexCommand ref
reference "enu:Test2"
plural "false"
caps "false"
noprefix "false"
\end_inset
\end_layout
\begin_layout Enumerate-Resume
Test4
\end_layout
\begin_deeper
\begin_layout Enumerate-Resume
Test5
\begin_inset CommandInset label
LatexCommand label
name "enu:Test5"
\end_inset
\end_layout
\begin_layout Enumerate-Resume
Test6
\end_layout
\end_deeper
\begin_layout Standard
Referencing Test5
\begin_inset CommandInset ref
LatexCommand ref
reference "enu:Test5"
plural "false"
caps "false"
noprefix "false"
\end_inset
\end_layout
\begin_layout Enumerate-Resume
Test7
\end_layout
\begin_deeper
\begin_layout Enumerate-Resume
Test8
\begin_inset CommandInset label
LatexCommand label
name "enu:Test8"
\end_inset
\end_layout
\begin_layout Enumerate-Resume
Test9
\end_layout
\end_deeper
\begin_layout Standard
Referencing Test8
\begin_inset CommandInset ref
LatexCommand ref
reference "enu:Test8"
plural "false"
caps "false"
noprefix "false"
\end_inset
\end_layout
\end_body
\end_document
这是 LaTeX 预览源代码:
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage{CJKutf8}
\usepackage{enumitem}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\newlength{\lyxlabelwidth} % auxiliary length
\makeatother
\usepackage{babel}
\begin{document}
\begin{enumerate}
\item Test
\begin{enumerate}
\item Test2\label{enu:Test2}
\item Test3
\end{enumerate}
\end{enumerate}
Referencing Test2 \ref{enu:Test2}
\begin{enumerate}[resume]
\item Test4
\begin{enumerate}[resume]
\item Test5\label{enu:Test5}
\item Test6
\end{enumerate}
\end{enumerate}
Referencing Test5 \ref{enu:Test5}
\begin{enumerate}[resume]
\item Test7
\begin{enumerate}[resume]
\item Test8\label{enu:Test8}
\item Test9
\end{enumerate}
\end{enumerate}
Referencing Test8 \ref{enu:Test8}
\end{document}
如您所见,对 Test5 的引用应输出 2a。但结果却是 1a。3a 导致引用 2a。启用 hyperref 支持后,pdf 中的链接跳转到正确的位置,但数字仍然错误。
我已经尝试了标签等的不同位置,但似乎没有任何帮助。我做错了什么?有人能给点建议吗?
答案1
沃纳的帖子就是答案!
删除[resume]
所有嵌套项解决了这个问题。要在 LyX 中执行此操作,必须对嵌套项使用枚举样式而不是枚举-恢复样式,以获得正确的引用。