我使用以下代码
\begin{subequations}
\begin{equation}
\mid H(j\omega) \mid = \frac{\omega CR}{\sqrt{1+(\omega CR)^2}}
\label{subeqn:amplitude}
\end{equation}
\begin{equation}
\angle H = 90^o - arctan(\omega CR)
\label{subeqn:phase}
\end{equation}
\end{subequations}
但是我得到了 5 个错误
- 额外的
\else
- 缺失
\endcsname
插入 - 不完整
\iffalse
;第 329 行之后的所有文本均被忽略(这是行“\begin{equation}
”) - 紧急停止
- 发生致命错误;未生成输出 PDF 文件。
我已amsmath
在序言中使用了。
我的最小例子是
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\begin{document}
\begin{subequations}
\begin{gather}
\lvert H(j\omega) \rvert = \frac{\omega CR}{\sqrt{1+(\omega CR)^2}}
\label{subeqn:amplitude}
\\
\angle H = 90^\circ - \arctan(\omega CR)
\label{subeqn:phase}
\end{gather}
\end{subequations}
\end{document}
输入上述代码不会产生任何错误。所以我相信序言中一定有错误,即
\documentclass[12pt,a4paper]{article}
\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{kerkis}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{units}
\usepackage{array}
\usepackage{framed} % ãéá ãêñé background ðßóù áðü êÜðïéá paragraphs
\usepackage{extarrows}
\usepackage{cancel}
\usepackage[pdftex]{graphicx}
%\usepackage[twoside,pdftex,total={16.4cm,24cm}, left=2.9cm, top=3.2cm, headsep=1.4cm] {geometry}
%\usepackage[top=3.2cm, bottom=3.4cm, left=2.9cm, right=2.9cm,headsep=0.8cm]{geometry}
\usepackage[margin=2.8cm]{geometry}
\usepackage[Bjornstrup]{fncychap}
\usepackage{fancybox}
\usepackage{fancyhdr}
\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{footmisc}
\usepackage{subfiles}
\usepackage{float}
\usepackage{slashbox}
%\usepackage{float}
%\restylefloat{figure}
%_________________________________________________________________________________________
\usepackage{hyperref}
\usepackage{subfigure}
\renewcommand{\labelitemi}{$\circ$}
\usepackage{wrapfig}
\usepackage{color}
%\usepackage[usenames,dvipsnames]{color}
\definecolor{Darkgreen}{rgb}{0,0.4,0}
\definecolor{Darkblue}{rgb}{0,0,0.4}
\newcommand{\HRule}{\rule{\linewidth}{0.8mm}}
\usepackage{rotating}
%\usepackage[landscape]{geometry}
\usepackage{lscape}
\usepackage{cancel}
\usepackage{fancyvrb}
%\usepackage{yannisgr}
\usepackage{listings}
%\lstset{ %
%language=matlab, % choose the language of the code
%basicstyle=\footnotesize, % the size of the fonts that are used for the code
%numbers=left, % where to put the line-numbers
%numberstyle=\footnotesize, % the size of the fonts that are used for the line- numbers
%stepnumber=1, % the step between two line-numbers. If it is 1 each line will be numbered
%numbersep=5pt, % how far the line-numbers are from the code
%backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color}
%showspaces=false, % show spaces adding particular underscores
%showstringspaces=false, % underline spaces within strings
%showtabs=false, % show tabs within strings adding particular underscores
%frame=single, % adds a frame around the code
%tabsize=2, % sets default tabsize to 2 spaces
%captionpos=b, % sets the caption-position to bottom
%breaklines=true, % sets automatic line breaking
%breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
%escapeinside={\%*}{*)} % if you want to add a comment within your code
%}
\usepackage{textcomp}
\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\lstset{
backgroundcolor=\color{lbcolor},
tabsize=4,
rulecolor=,
language=matlab,
basicstyle=\scriptsize,
upquote=true,
aboveskip={1.5\baselineskip},
columns=fixed,
showstringspaces=false,
extendedchars=true,
breaklines=true,
prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
frame=single,
showtabs=false,
showspaces=false,
showstringspaces=false,
identifierstyle=\ttfamily,
keywordstyle=\color[rgb]{0,0,1},
commentstyle=\color[rgb]{0.133,0.545,0.133},
stringstyle=\color[rgb]{0.627,0.126,0.941},
}
%\usepackage{subeqn}
%_________________________________________________________________________________________
\definecolor{mygray}{gray}{.75}%{.9, .9, .9}
\definecolor{lightgray}{gray}{.8}%{.9, .9, .9}
\definecolor{shadecolor}{gray}{.90} %gia framed package
%\definecolor{mygray}{rgb}{.9, .9, .9} %enallaktika !! anti gia panw
\newcommand*\mygraybox[1]{\colorbox{mygray}{\hspace{1em}#1\hspace{1em}}}
%\renewcommand{\topfraction}{0.85}%gia na min uparxoun 2 figures se mia selida kai tipota allo
\renewcommand{\textfraction}{0.1}
\renewcommand{\floatpagefraction}{0.75}
\newcommand{\kai}{\quad \text{êáé} \quad}
\newcommand{\kkai}{\qquad \text{êáé} \qquad}
\linespread{1.1}
\newcommand{\sw}{\selectlanguage{english}}
\newcommand{\sq}{\selectlanguage{greek}}
\newcommand{\eng}[1]{\latintext#1\greektext}
\newcommand{\gre}[1]{\greektext\latintext#1}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{comment}
\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
\clearpage
{\pagestyle{empty}\origdoublepage}%
}
\let\cleardoublepage\clearemptydoublepage
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{} % delete current setting for header and footer
\fancyhead[LE,RO]{\bfseries\thepage}
\fancyhead[LO]{\rightmark}
\fancyhead[RE]{\leftmark}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0.5pt} % make space for the rule %Ôï ÷ù ïñßóåé 0.8 áð ôï package
\fancypagestyle{plain}{%
\fancyhead{} % get rid of headers on plain pages
\renewcommand{\headrulewidth}{0pt} % and the line}
\newtheorem{thm}{Èåþñçìá}[chapter]
\newtheorem{cor}[thm]{Ðüñéóìá}
\newtheorem{lem}[thm]{ËÞììá}
\newtheorem{parad}{ÐáñÜäåéãìá}[chapter]
\newtheorem{defgr}{Ïñéóìüò}[chapter]
\end{comment}
\parskip 3mm
\footskip = 15mm
答案1
这段代码没有报错,所以问题出在这之前。代码可以改进:
\begin{subequations}
\begin{gather}
\lvert H(j\omega) \rvert = \frac{\omega CR}{\sqrt{1+(\omega CR)^2}}
\label{subeqn:amplitude}
\\
\angle H = 90^\circ - \arctan(\omega CR)
\label{subeqn:phase}
\end{gather}
\end{subequations}
请注意,\mid
不能将其用于绝对值;“度”符号最好用^\circ
“arctan”等数学运算符来排版。
不要使用两个连续的数学环境:amsmath
为此目的提供许多环境,在这种情况下gather
是合适的。