我正在处理的 LyX 文档的序言中存在以下内容。一切都很好,但是当我使用titlesec
包时,如果我有一个编号的方程式,它不会编译。给出一个错误I can't use \eqno in math mode
。当我删除时,文档会被编译titlesec
。如果我将方程式模式更改为内联,也不会出现问题。我使用带有 Times New Roman 字体的 Report 类。
这是包含编号方程的 ex 文件的输出。
% Preview source code
%% LyX 2.1.4 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,twoside,english]{report}
\usepackage[latin9]{inputenc}
\usepackage[paperwidth=210mm,paperheight=297mm]{geometry}
\geometry{verbose,tmargin=30mm,bmargin=22mm,lmargin=20mm,rmargin=30mm,headheight=3mm,headsep=12mm,footskip=10mm}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{setspace}
\setstretch{1.5}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\AtBeginDocument{\newgeometry{hmargin=4cm}}
\raggedbottom
\pagenumbering{roman}
\geometry{textheight=245mm, textwidth=160mm, footskip=10mm}
\usepackage{tocloft}
\renewcommand\cftchapfont{\fontsize{16}{18}\selectfont}
\setlength{\cftbeforechapskip}{-8pt}
\setlength{\cftbeforesecskip}{-12pt}
\renewcommand\cftsecfont{\fontsize{14}{16}\selectfont}
\setlength{\cftbeforesecskip}{-12pt}
\renewcommand\cftsubsecfont{\fontsize{8}{12}\selectfont}
\setlength{\cftbeforesubsecskip}{-12pt}
\renewcommand\cftsubsubsecfont{\fontsize{8}{12}\selectfont}
\setlength{\cftbeforesubsubsecskip}{-12pt}
\renewcommand{\cftsecfont}{\fontseries{md}\fontsize{14}{16}\selectfont}
\renewcommand{\cftsubsecfont}{\fontseries{md}\fontsize{12}{14}\selectfont}
\renewcommand{\cftsubsubsecfont}{\fontseries{md}\fontsize{10}{12}\selectfont}
\renewcommand{\cftsecpagefont}{\fontseries{md}\fontsize{14}{16}\selectfont}
\renewcommand{\cftsubsecpagefont}{\fontseries{md}\fontsize{12}{14}\selectfont}
\renewcommand{\cftsubsubsecpagefont}{\fontseries{md}\fontsize{10}{12}\selectfont}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\LARGE\bfseries}{\chaptertitlename\ \thechapter}{15mm}{\LARGE}
\titlespacing*{\chapter}{0mm}{50mm}{15mm}
\titlespacing*{\section}{0pt}{15mm}{15mm}
\titlespacing*{\subsection}{0pt}{15mm}{15mm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[RE]{Chapter\space{\thechapter,\space\space}Section\space{\thesection}}
\fancyhead[RO]{\thepage}
\fancyhead[LO]{\nouppercase\rightmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\makeatother
\usepackage{babel}
\begin{document}
\chapter{\noindent \fontsize{18}{22}\selectfont Introduction}
\pagenumbering{arabic}
\setcounter{page}{1}
\section{Background}
\noindent leading to the rich variety of vivid and beautiful colors.
It took
\paragraph*{\noindent \textmd{
\begin{equation}
m_{i}\frac{d^{2}x_{i}}{dt^{2}}=-\bigtriangledown_{i}V\left(x_{1},x_{2},x_{3},.....,x_{N}\right),\,\left(i\:=1...N\right)
\end{equation}
Here }$m_{i}$ \textmd{is the mass of the $ith$ atom} \textmd{whose
position at time $t$ is} $x_{i}$. }
\end{document}
这是具有内联方程的 ex2 文件的文档。
%% LyX 2.1.4 created this file. For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,twoside,english]{report}
\usepackage[latin9]{inputenc}
\usepackage[paperwidth=210mm,paperheight=297mm]{geometry}
\geometry{verbose,tmargin=30mm,bmargin=22mm,lmargin=20mm,rmargin=30mm,headheight=3mm,headsep=12mm,footskip=10mm}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{setspace}
\setstretch{1.5}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\AtBeginDocument{\newgeometry{hmargin=4cm}}
\raggedbottom
\pagenumbering{roman}
\geometry{textheight=245mm, textwidth=160mm, footskip=10mm}
\usepackage{tocloft}
\renewcommand\cftchapfont{\fontsize{16}{18}\selectfont}
\setlength{\cftbeforechapskip}{-8pt}
\setlength{\cftbeforesecskip}{-12pt}
\renewcommand\cftsecfont{\fontsize{14}{16}\selectfont}
\setlength{\cftbeforesecskip}{-12pt}
\renewcommand\cftsubsecfont{\fontsize{8}{12}\selectfont}
\setlength{\cftbeforesubsecskip}{-12pt}
\renewcommand\cftsubsubsecfont{\fontsize{8}{12}\selectfont}
\setlength{\cftbeforesubsubsecskip}{-12pt}
\renewcommand{\cftsecfont}{\fontseries{md}\fontsize{14}{16}\selectfont}
\renewcommand{\cftsubsecfont}{\fontseries{md}\fontsize{12}{14}\selectfont}
\renewcommand{\cftsubsubsecfont}{\fontseries{md}\fontsize{10}{12}\selectfont}
\renewcommand{\cftsecpagefont}{\fontseries{md}\fontsize{14}{16}\selectfont}
\renewcommand{\cftsubsecpagefont}{\fontseries{md}\fontsize{12}{14}\selectfont}
\renewcommand{\cftsubsubsecpagefont}{\fontseries{md}\fontsize{10}{12}\selectfont}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\LARGE\bfseries}{\chaptertitlename\ \thechapter}{15mm}{\LARGE}
\titlespacing*{\chapter}{0mm}{50mm}{15mm}
\titlespacing*{\section}{0pt}{15mm}{15mm}
\titlespacing*{\subsection}{0pt}{15mm}{15mm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\thepage}
\fancyhead[RE]{Chapter\space{\thechapter,\space\space}Section\space{\thesection}}
\fancyhead[RO]{\thepage}
\fancyhead[LO]{\nouppercase\rightmark}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\makeatother
\usepackage{babel}
\begin{document}
\chapter{\noindent \fontsize{18}{22}\selectfont Introduction}
\pagenumbering{arabic}
\setcounter{page}{1}
\section{Background}
\paragraph*{\noindent \textmd{the type of interatomic potential $V$ used to
simulate the material properties.$m_{i}\frac{d^{2}x_{i}}{dt^{2}}=-\bigtriangledown_{i}V\left(x_{1},x_{2},x_{3},.....,x_{N}\right),\,\left(i\:=1...N\right)$Here
}$m_{i}$ \textmd{is the mass of the $ith$ atom} \textmd{whose position
at time $t$ is} $x_{i}$.}
\end{document}