Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use the following code

\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}

However I get 5 errors

  1. Extra \else
  2. Missing \endcsname inserted
  3. Incomplete \iffalse; all text was ignored after line 329(This is line "\begin{equation}")
  4. Emergency stop
  5. Fatal Error occurred;no output pdf file produced.

I already use amsmath in my preamble.

My minimal Example is

\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}

Typing the aforementioned code produces no error. So I believe that there must be sth wrong in the preamble, which is

\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
share|improve this question
1  
Welcome to TeX.sx! Copy-pasting your code snippet into a compilable example yields no error for me, so you must be doing something different. Therefore, please add a minimal working example (MWE) that illustrates your problem. –  lockstep Dec 17 '11 at 10:57
    
This works for me too, simply with amsmath and the article class, nothing more. Btw. I recommend writing \arctan as operator, and using \circ instead of o. –  Stefan Kottwitz Dec 17 '11 at 10:58
    
The preamble does not seem to have problems (but it's not that pretty). The problem seems to be on the text that precedes the subequations environment. –  egreg Dec 17 '11 at 12:18
    
Since I erased \usepackage{hyperref} it works! However I need this package... –  Thanos Dec 17 '11 at 12:25
    
@Thanos: Does moving \usepackage{hyperref} towards the end of your preamble work? Since hyperref redefines a large number of standard LaTeX macros, it should usually be loaded last to maintain its usage. –  Werner Dec 17 '11 at 22:01

1 Answer 1

I don't get any errors from that snippet, so the problem is somewhere else before that. The code can be improved:

\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}

Notice that \mid is not to be used for absolute value; the "degree" symbol is better typeset with ^\circ and math operators such as "arctan" have their command.

Don't use two consecutive math environments: amsmath provides many environments for this purpose, in this case gather is appropriate.

share|improve this answer
    
@Thanos Please, add to your question rather than in comments that are of limited size. –  egreg Dec 17 '11 at 11:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.