# Writing Equation in latex

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}

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


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


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. \documentclass{article}
\usepackage{amsmath} % for 'split' env.
\newcommand\vn{\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}

• 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
• @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{\mathit{#1}} to \newcommand\vn{\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
• 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
• @MassimoOrtolano - What can I say but "great minds think alike"! :-) – Mico Jul 28 '18 at 13:42

I have used the option align* without enumeration. It is the same result. \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: \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
• i liked your answer, so +1! – Zarko Jul 27 '18 at 22:08
• I've also upvoted your answer. – Mico Jul 28 '18 at 10:55