8

I am new to Latex. I am trying to write this equation in Latex, but I've been getting the following error: Missing $

\begin{equation} \label{tranfdc}
\begin{split} 
T_v(s) &= \frac{V_{dc}(s)}{V_{dcref}(s)} &= \frac{\omega _B}{B} 
\frac{k_{pdc}s + k_{idc}} {s^2 + \frac{ k_{pdc} \omega _B s} {B} + 
\frac{k_{idc} \omega _B} {B}} \\

 T_i(s) &= \frac{V_{dc}(s)}{i_{l}(s)} &= - \frac{\omega _B}{B} \frac{s} {s^2 
+ \frac{ k_{pdc} \omega _B s} {B} + \frac{k_{idc} \omega _B} {B}} 

\end{split}
\end{equation}
  • 5
    No blank lines allowed in math mode. If you like them for appearance sake in the source, you could always make the blank line a simple % instead. – Steven B. Segletes Jul 27 '18 at 18:46
  • You may want to defne a new variable \omega_B' \equiv \omega_B / B to clean up those equations. – DanielSank Jul 28 '18 at 17:18
11

enter image description here

  • empty lines are forbidden in math environments
  • environment split allow only one ampersand per equation line

    \documentclass[11pt]{book}
    \usepackage{amsmath}
    
    \begin{document}
    \begin{equation} \label{tranfdc}
    \begin{split}
    T_v(s) & = \frac{V_{dc}(s)}{V_{dcref}(s)}
             = \frac{\omega _B}{B}
    \frac{k_{pdc}s + k_{idc}} {s^2 + \frac{ k_{pdc} \omega _B s} {B} +
    \frac{k_{idc} \omega _B} {B}} \\
    %
     T_i(s) & = \frac{V_{dc}(s)}{i_{l}(s)}
              = - \frac{\omega _B}{B} \frac{s} {s^2
    + \frac{ k_{pdc} \omega _B s} {B} + \frac{k_{idc} \omega _B} {B}}
    \end{split}
    \end{equation}
    \end{document}
    
8

Seeing as in your original MWE you tried adding two & symbols per line, perhaps that means you were trying to align the equations at two points? i.e. you wanted both sets of equal signs to be aligned.

If so, then this is possible using alignat like so:

enter image description here

\documentclass[11pt]{book}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{2}\label{tranfdc}
T_v(s) & = \frac{V_{dc}(s)}{V_{dcref}(s)}
         && = \frac{\omega _B}{B}
\frac{k_{pdc}s + k_{idc}} {s^2 + \frac{ k_{pdc} \omega _B s} {B} +
\frac{k_{idc} \omega _B} {B}} \\
%
 T_i(s) & = \frac{V_{dc}(s)}{i_{l}(s)}
         && = - \frac{\omega _B}{B} \frac{s} {s^2
+ \frac{ k_{pdc} \omega _B s} {B} + \frac{k_{idc} \omega _B} {B}}
\end{alignat}
\end{document}

If you want just one equation number for this set of equations, then use alignedat and equation. Note the difference between alignat and alignedat!

enter image description here

\documentclass[11pt]{book}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{alignedat}{2}\label{tranfdc}
T_v(s) & = \frac{V_{dc}(s)}{V_{dcref}(s)}
         && = \frac{\omega _B}{B}
\frac{k_{pdc}s + k_{idc}} {s^2 + \frac{ k_{pdc} \omega _B s} {B} +
\frac{k_{idc} \omega _B} {B}} \\
%
 T_i(s) & = \frac{V_{dc}(s)}{i_{l}(s)}
         && = - \frac{\omega _B}{B} \frac{s} {s^2
+ \frac{ k_{pdc} \omega _B s} {B} + \frac{k_{idc} \omega _B} {B}}
\end{alignedat}
\end{equation}
\end{document}
6

In addition to fixing the two syntactical errors -- (i) blank lines in a display-math environment; (ii) more than 1 & alignment point in a split environment -- you may also wish to make the equations more readable. I'd like to suggest that you (a) not use \frac macros in the two long denominator terms (use inline-style fraction notation instead) and (b) render the variable names (esp. dcref) in math-italics for more even interletter spacing and "snug up" the space between V and \omega and their respective subscript terms.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'split' env.
\newcommand\vn[1]{\mathit{#1}} % "variable name"
\renewcommand\!{\mkern-1.5mu} % optional; default is "\mkern-3mu"
\begin{document}

\begin{equation} \label{tranfdc}
\begin{split} 
T_v(s) &= \frac{V_{\!\vn{dc}}(s)}{V_{\!\vn{dcref}}(s)} 
   = \frac{\omega_{\!B}}{B} \frac{k_{\vn{pdc}}s + k_{\vn{idc}}} {s^2 + k_{\vn{pdc}} \omega_{\!B} s/B + 
k_{\vn{idc}} \omega_{\!B}/B} \\
 T_i(s) &= \frac{V_{\!\vn{dc}}(s)}{i_{l}(s)} 
    = - \frac{\omega_{\!B}}{B} \frac{s} {s^2 + k_{\vn{pdc}} \omega_{\!B} s/B + k_{\vn{idc}} \omega_{\!B}/B} 
\end{split}
\end{equation}
\end{document}
  • 1
    And subscripts that represent nouns are even better typeset upright rather than italics. See e.g. the IUPAC Green Book, p.5. – Massimo Ortolano Jul 28 '18 at 13:25
  • 1
    @MassimoOrtolano - Thanks! An advantage of using the \vn ("variable name") approach used in this answer is that (assuming, of course, that \vn is used consistently in all formulas involving subscripts (and, possibly, superscripts)...) it's trivially easy to switch the style from italic to upright lettering, merely by changing \newcommand\vn[1]{\mathit{#1}} to \newcommand\vn[1]{\mathrm{#1}}. BTW, I don't claim any originality here -- I picked up the \vn method some time ago from an @egreg answer! – Mico Jul 28 '18 at 13:36
  • 1
    In fact, when writing equations, I use the command \tsub, again borrowed from an egreg's answer ;-) – Massimo Ortolano Jul 28 '18 at 13:39
  • 1
    @MassimoOrtolano - What can I say but "great minds think alike"! :-) – Mico Jul 28 '18 at 13:42
4

I have used the option align* without enumeration. It is the same result.

enter image description here

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}

\begin{align*}\label{tranfdc}
T_v(s) & = \frac{V_{dc}(s)}{V_{dcref}(s)} =  
 \frac{\omega _B}{B} \frac{k_{pdc}s + k_{idc}} {s^2 + \frac{ k_{pdc} \omega _B s} {B} + \frac{k_{idc} \omega _B} {B}} &\\
T_i(s) & =  \frac{V_{dc}(s)}{i_{l}(s)} = - \frac{\omega _B}{B} \frac{s} {s^2 
+ \frac{ k_{pdc} \omega _B s} {B} + \frac{k_{idc} \omega _B} {B}}\\
\end{align*}

\end{document} 

With the enumeration of the formulas:

enter image description here

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}

\begin{align}\label{tranfdc}
T_v(s) & = \frac{V_{dc}(s)}{V_{dcref}(s)} =  
 \frac{\omega _B}{B} \frac{k_{pdc}s + k_{idc}} {s^2 + \frac{ k_{pdc} \omega _B s} {B} + \frac{k_{idc} \omega _B} {B}} &\\
T_i(s) & =  \frac{V_{dc}(s)}{i_{l}(s)} = - \frac{\omega _B}{B} \frac{s} {s^2 
+ \frac{ k_{pdc} \omega _B s} {B} + \frac{k_{idc} \omega _B} {B}}\\
\nonumber
\end{align}

\end{document} 
  • Given that I have received a negative reputation I kindly ask you to explain the reason. Thank you. – Sebastiano Jul 27 '18 at 21:14
  • 1
    i liked your answer, so +1! – Zarko Jul 27 '18 at 22:08
  • 1
    I've also upvoted your answer. – Mico Jul 28 '18 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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