使用子方程式时出错

使用子方程式时出错

我正在使用subequations。没有办法得到正确的输出……我正在使用

\documentclass{book}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}

\begin{document}

\begin{subequations}
\begin{equation}%<-----------------------<
h\nu'=\frac{h\nu}{1+\gamma(1-\cos\theta)}
\end{equation}
\begin{equation}
T=h\nu-h\nu'=h\nu \frac{\gamma(1-\cos\theta)}{1+\gamma(1-\cos\theta)}
\end{equation}
\begin{equation}
\cos\theta=1-\frac{2}{(1+\gamma)^2\tan^2\phi+1}
\end{equation}
\begin{equation}
\cot\phi=(1+\gamma)\tan\frac{\theta}{2}
\end{equation}
\end{subequations}

\end{document}

我也使用了$some equations$and\[some equations\]来代替equation enviroment,但我无法获得编号...有什么想法吗?

PS:错误发生在上述代码中用箭头标记的行上,该行指出:extra \else Missing \endcsname inserted Incomplete \iffalse; all text wasignored after line67


\documentclass[11pt,a4paper]{book}
\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}
%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
\renewcommand\chaptername{ÊåöÜëáéï}
%\usepackage{babelbib}
%\selectbiblanguage{english}
\renewcommand\bibname{Âéâëéïãñáößá}
\usepackage[Glenn]{fncychap}
\usepackage{fancybox}
\usepackage{fancyhdr}
\usepackage{colortbl}
\usepackage{xcolor}
\usepackage{footmisc}
\usepackage{subfiles}
\usepackage{float}
\usepackage{slashbox}
\usepackage{float}
%\restylefloat{figure}
%_________________________________________________________________________________________

%\usepackage[nottoc,numbib]{tocbibind}
\usepackage{fancyhdr}

%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\usepackage{tocloft}
\makeatletter
\newcommand*{\tocwithouttitle}{\@starttoc{toc}}
\makeatother
%--------------------------------------------------------------------------------
\makeatletter
\newcommand*{\lofwithouttitle}{\@starttoc{lof}}
\makeatother
%--------------------------------------------------------------------------------
\makeatletter
\newcommand*{\lotwithouttitle}{\@starttoc{lot}}
\makeatother
%--------------------------------------------------------------------------------
%!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\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{pifont}
\usepackage{subfiles}

%_________________________________________________________________________________________


\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}
\fancyhead{}
\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
%``````````````````````````````````````````````````````````````````
%--\texorpdfstring{$\textswab{BoSonS}$}{Bosons}--
%``````````````````````````````````````````````````````````````````

答案1

我没有发现您给出的代码有任何错误。

但你可以尝试这个:

\documentclass{book}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}

\begin{document}
\renewcommand{\theequation}{1\alph{equation}}
\setcounter{equation}{0}

%\begin{subequations}
\begin{equation}%<-----------------------<
h\nu'=\frac{h\nu}{1+\gamma(1-\cos\theta)}
\end{equation}
\begin{equation}
T=h\nu-h\nu'=h\nu \frac{\gamma(1-\cos\theta)}{1+\gamma(1-\cos\theta)}
\end{equation}
\begin{equation}
\cos\theta=1-\frac{2}{(1+\gamma)^2\tan^2\phi+1}
\end{equation}
\begin{equation}
\cot\phi=(1+\gamma)\tan\frac{\theta}{2}
\end{equation}
%\end{subequations}


\end{document}

答案2

我会用

\documentclass{book}
\usepackage{amsmath}

\begin{document}

\begin{subequations}
\begin{align}
h\nu'&=\frac{h\nu}{1+\gamma(1-\cos\theta)}\\
T&=h\nu-h\nu'=h\nu \frac{\gamma(1-\cos\theta)}{1+\gamma(1-\cos\theta)}\\
\cos\theta&=1-\frac{2}{(1+\gamma)^2\tan^2\phi+1}\\
\cot\phi&=(1+\gamma)\tan\frac{\theta}{2}
\end{align}
\end{subequations}

\end{document}

效果很好。

相关内容