我曾使用 LyX 撰写论文,大部分情况下,它都运行良好。然而,当前的编译错误让我感到困惑。添加几个浮点数后,我现在收到以下错误:
! Package float Error: Unknown float style `' .
See the float package documentation for explanation.
Type H <return> for immediate help.
...
l.49 \floatstyle{}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
\@float@every@=\toks27
\c@=\count116
! Improper alphabetic constant.
<to be read again>
\spacefactor
l.56 \usepackage
{url}
A one-character control sequence belongs after a ` mark.
So I'm essentially inserting \0 here.
! Improper \spacefactor.
<recently read> \spacefactor
l.56 \usepackage
{url}
You can refer to \spacefactor only in horizontal mode;
you can refer to \prevdepth only in vertical mode; and
neither of these is meaningful inside \write. So
I'm forgetting what you said and using zero instead.
! Missing $ inserted.
<inserted text>
$
l.56 \usepackage
{url}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.56 \usepackage
{url}
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! Illegal unit of measure (pt inserted).
<to be read again>
=
l.56 \usepackage
{url}
我首先尝试删除新的浮点数,但这并没有什么不同。然后我尝试编译一个较旧的提交,结果很好。tex
然而,当我比较两个版本的导出时,我发现一个空的浮点构造已附加到用户定义的浮点定义中:
\floatstyle{}
\newfloat{}{}{}
\providecommand{\name}{}
\floatname{}{\protect\name}
如果我没有尝试定义新的浮点数,为什么会发生这种情况?我该如何阻止它发生?
编辑:如果我删除新的浮点定义,我可以进行tex
导出编译,但是布局在某些地方很混乱,并且我的所有引用都被破坏了。
更新: 根据评论,以下是文档的前言tex
。首先是旧文档(编译得很好):
% LyX 2.1.4dev created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[oneside,english,titlepage]{authesis}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{color}
\usepackage{babel}
\usepackage{array}
\usepackage{float}
\usepackage{graphicx}
\usepackage[numbers]{natbib}
\usepackage[unicode=true]
{hyperref}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand{\noun}[1]{\textsc{#1}}
%% Special footnote code from the package 'stblftnt.sty'
%% Author: Robin Fairbairns -- Last revised Dec 13 1996
\let\SF@@footnote\footnote
\def\footnote{\ifx\protect\@typeset@protect
\expandafter\SF@@footnote
\else
\expandafter\SF@gobble@opt
\fi
}
\expandafter\def\csname SF@gobble@opt \endcsname{\@ifnextchar[%]
\SF@gobble@twobracket
\@gobble
}
\edef\SF@gobble@opt{\noexpand\protect
\expandafter\noexpand\csname SF@gobble@opt \endcsname}
\def\SF@gobble@twobracket[#1]#2{}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\floatstyle{ruled}
\newfloat{algorithm}{tbp}{loa}[chapter]
\providecommand{\algorithmname}{Algorithm}
\floatname{algorithm}{\protect\algorithmname}
\floatstyle{ruled}
\newfloat{model}{tbp}{lol}
\providecommand{\modelname}{Model}
\floatname{model}{\protect\modelname}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{amsmath}
\usepackage{url}
\makeatother
\begin{document}
\title{DOES ONE SIZE FIT ALL?\\
\emph{AN ANALYSIS OF}\\
\emph{TAX AND EXPENDITURE LIMITATIONS}\\
\emph{IN COLORADO}}
现在,又有一份有问题的新文件:
%% LyX 2.1.4dev created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[oneside,english,titlepage]{authesis}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{color}
\usepackage{babel}
\usepackage{array}
\usepackage{float}
\usepackage{graphicx}
\usepackage[numbers]{natbib}
\usepackage[unicode=true]
{hyperref}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\newcommand{\noun}[1]{\textsc{#1}}
%% Special footnote code from the package 'stblftnt.sty'
%% Author: Robin Fairbairns -- Last revised Dec 13 1996
\let\SF@@footnote\footnote
\def\footnote{\ifx\protect\@typeset@protect
\expandafter\SF@@footnote
\else
\expandafter\SF@gobble@opt
\fi
}
\expandafter\def\csname SF@gobble@opt \endcsname{\@ifnextchar[%]
\SF@gobble@twobracket
\@gobble
}
\edef\SF@gobble@opt{\noexpand\protect
\expandafter\noexpand\csname SF@gobble@opt \endcsname}
\def\SF@gobble@twobracket[#1]#2{}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\floatstyle{ruled}
\newfloat{algorithm}{tbp}{loa}[chapter]
\providecommand{\algorithmname}{Algorithm}
\floatname{algorithm}{\protect\algorithmname}
\floatstyle{ruled}
\newfloat{model}{tbp}{lol}
\providecommand{\modelname}{Model}
\floatname{model}{\protect\modelname}
\floatstyle{}
\newfloat{}{}{}
\providecommand{\name}{}
\floatname{}{\protect\name}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{amsmath}
\usepackage{url}
\makeatother
\begin{document}
\title{DOES ONE SIZE FIT ALL?\\
\emph{AN ANALYSIS OF}\\
\emph{TAX AND EXPENDITURE LIMITATIONS}\\
\emph{IN COLORADO}}
答案1
我相信我找到了问题所在。虽然我不清楚为什么会发生这种情况,但似乎我的一些浮点数一下子就坏了。我将它们引用为“float: Model”(自定义模块),在某个时候,它们都被重新指定为空白的浮点选项。取而代之的是“float: model”,但如果您单击浮点标签(每个浮点左上角的选项卡)来更改浮点类型,它不会被选为任何可用选项。这一定是在前面的内容中创建了那个空的浮点定义。
答案2
我遇到了同样的问题。浮点数是s,我在表中Table
插入了一些代码s。突然,浮点数的类型显示为,但浮点数的实际类型(如设置中所示)变为空。然后我无法编译文档。Listing
listing
为了解决这个问题,我进入了浮动设置并将浮动类型设置为Table
。我插入代码清单的所有浮动都需要这样做。
我相信这是 LyX 的一个错误:当将 acode listing
插入表格单元格时,并且当表格是浮点数的一部分时,整个浮点数的类型将被清除并变为无效。