我有一份 Tex 报告,其中我在 references.bib 文件中定义了一些参考书目条目,如下所示:
@manual{darpadataset,
title = {DARPA Intrusion Detection Data Sets},
author = {Massachusetts Institute of Technology, Linclon Laboratory},
url = {https://www.ll.mit.edu/ideval/data/},
year = {1998-2000}
}
@online{RansomwareTracker,
title = {Ransomware Tracker Website},
url = {\url{https://ransomwaretracker.abuse.ch/tracker/}},
year = {2018}
}
@online{UNBCIC2017IDSDATASET,
title = {{UNBCIC 2017 IDS Dataset}},
url = {\url{http://www.unb.ca/cic/datasets/ids-2017.html}},
year = {2017}
}
以下是我导入文件的方法:
\bibliographystyle{plain}
\bibliography{references}
当我尝试使用 PDFLatex 和 BibTex 生成 PDF 文件时,第一次执行没有显示任何错误,并且参考书目未出现在我的 PDF 文件中。但是,在第二次执行期间,我收到以下错误:
! Use of \/ doesn't match its definition.
\do ... ~}{\mathchar \number \mathcode `#1\sb {\/}
}\mathcode `#1=32768 \fi
l.112 ...-intrusion-detection-evaluation-data-set}
.
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
)
Runaway definition?
->\mathchar 96\sb {}\mathcode `\unhbox \voidb@x \bgroup \let \unhbox
\ETC.
! File ended while scanning definition of `.
<inserted text>
}
l.30 \bibliography{references.bib}
显然它也向我提出了一个解决方案,但我不太明白。有人能帮我解决这个问题吗?谢谢。
以下是我的主要文件的代码:
\documentclass[10pt,a4paper]{report}
\include{config}
\include{constants}
\begin{document}
\long\def\/*#1*/{}
\include{pages/abstract}
\include{pages/acknowledgements}
\include{chapters/chapter1/main}
\include{chapters/chapter2/main}
\include{chapters/chapter3/main}
\include{chapters/chapter4/main}
\include{chapters/chapter5/main}
\include{chapters/chapter6/main}
\bibliographystyle{plain}
\bibliography{references}
\end{document}
在配置文件中我定义了以下包:
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{titlesec}
\usepackage{algorithmicx}
%\usepackage{natbib}
\usepackage{tikz}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{array}
\usepackage{smartdiagram}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{longtable}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage{amsfonts}
\usepackage{algorithm,algpseudocode}
\usepackage{multirow}
\usepackage{makecell} % for more vertical space in cells
\usepackage[table,xcdraw]{xcolor}
\usepackage{rotating}
\usepackage{PTSansNarrow}
\usepackage[T1]{fontenc}
\usepackage{array,tabularx}
\usepackage[most]{tcolorbox}
\usepackage{hyperref}
\usepackage{adjustbox}
\newcounter{inlineenum}
\renewcommand{\theinlineenum}{\alph{inlineenum}}
\newenvironment{inlineenum}
{\unskip\ignorespaces\setcounter{inlineenum}{0}%
\renewcommand{\item}{\refstepcounter{inlineenum}
{\textit{\theinlineenum})~}}}
{\ignorespacesafterend}
\setcounter{secnumdepth}{3}
% subhead
\newcommand{\subhead}[1]{\vspace {0.03in}\noindent{\textbf{#1.}}}
\usepackage[inline]{enumitem}
\setlist[enumerate,1]{label=\textit{\alph*)}}
\def\bibfont{\footnotesize}
\usepackage{url}%
\def\UrlBreaks{\do\/\do-}%
\usepackage{subfig}
\usepackage[edges]{forest}
\usepackage{hyperref}
答案1
\/
是用于斜体校正的核心 latex 命令,它在内部使用,例如在诸如的命令中,\textit
但也在许多其他地方使用,并且很可能在某些 bibtex 样式中明确插入。
重新定义如下
\long\def\/*#1*/{}
将破坏所有这些用途。
一般来说,您应该使用\newcommand
而不是\def
,这样您就不会以这种方式意外地重新定义内部命令。