0

Can somebody explain to me how to put this in proper LaTeX-Code? Math Equation

I am really not sure... let's see:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\sum_{(i,j)\el E} x_(i,j)^(s,d) - \sum_{(i,j)\el E} x_(j,i)^(s,d) = 
\begin{cases}
    1 &\text{if i=s} \\
    -1 &\text{if i=d} &\forall s,d,i \el V \\
    0 &\text{otherwise}
\end{cases}
\end{align} 
\end{document}

I am almost sure the sub- and superscripts will not look nice this way. But the problem is also: I get an error saying "undefined control sequence \end{align}" In order to be able to use the align-environment I should only need to import amsmath, is that correct?

2
  • do you use texstudio? – David Carlisle Oct 31 '18 at 9:43
  • thx so much guys! You really helped me a lot – user503842 Oct 31 '18 at 10:38
1

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather*}
\sum\limits_{(i,j)\in E}x_{i,j}^{s,d}-\sum\limits_{(j,i)\in E}x_{j,i}^{s,d} = 
    \begin{cases} 
        1 & \mbox{if } i = s \\
        -1 & \mbox{if } i = d \\
        0 & \text{otherwise} 
    \end{cases} 
    \forall s,d,i \in V \\
\sum\limits_{(s,d)}x_{i,j}^{s,d}t^{s,d}\leq \sum\limits_{n\in [1\ldots N]}K_{n}l^{n}_{i,j} 
\qquad 
\forall (i,j)\in E 
\end{gather*} 
\end{document}

I would like to add to the previous answer that instead of align, using gather* environment will allow you to center both equations and to print them without any number marks.

2

perhaps something like

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
% no alignment
\begin{gather}
\sum_{(i,j)
% \in not \el
\in
 E}
% {} not () 
x_{i,j}^{s,d} - \sum_{(i,j)\in E}
% {} not ()
x_{j,i}^{s,d} = 
\begin{cases}
%  math around equation
    1 &\text{if $i=s$}\\
% \in not \el
    -1 &\text{if $i=d \quad\forall s,d,i \in V$}\\
    0 &\text{otherwise}
\end{cases}\\
\sum_{\ldots} \leq \sum_{\ldots}
\end{gather} 
\end{document}

The second inequality just a sketch of course.

0

I propose this variant layout, with mathtools (needless to load amsmath):

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{alignat*}{2}
\smashoperator[r]{\sum_{(i,j)\in E}}x_{i,j}^{s,d}-\smashoperator{\sum_{(j,i)\in E}}x_{j,i}^{s,d} & =
    \begin{cases}
        \phantom{-}1 & \mbox{if } i = s \\
        -1 & \mbox{if } i = d \\
        \phantom{-}0 & \text{otherwise}
    \end{cases}
     &\qquad & \forall s,d,i \in V \\[1.5ex]
\sum_{(s,d)}x_{i,j}^{s,d}t^{s,d} & \leq \smashoperator{\sum_{n\in [1\ldots N]}}K_{n}l^{n}_{i,j}
 & &
\forall (i,j)\in E
\end{alignat*}

\end{document} 

enter image description here

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.