# Two equations in one line

How can I write these two equations in a single row:

∀i,j 1≤i,j≤n and cij = ∑ aikbkj


Thank you

• Welcome to TeX.SX! This is quite straightforward with the align or alignat environment
– user31729
Commented Jan 18, 2016 at 17:56

Even ordinary equation enable to write two equation in the same row (transcribed in classic math notation):

$$\forall i,j:\ 1\leq i,j\leq n \quad\mathrm{and}\quad c_{ij} = \sum a_{ik} b_{kj}$$


where with \mathrm is mimic surrounding text font. In this case, both equation will have common number. Without equation numbering just use equation* or $...$.

With package amsmath or mathtools you can write:

\documentclass{article
\usepackage{mathtools}

\begin{document}
$$\forall i,j 1\leq i,j\leq n \quad\text{and}\quad c_{ij} = \sum a_{ik} b_{kj}$$
or if you liked
$$\forall i,j:\ 1\leq i,j\leq n \text{ and } c_{ij} = \sum a_{ik} b_{kj}$$
\end{document}


which gives:

or use math environments, which are defined by amsmath or mathtools. For example: gather. In this case you can use \text{ ...} which for text use font from main text together with spaces (what mathrm not).

In the case, that those equations is in the text, than seems to be naturally to write (split them into two math expression):

some text $\forall i,j:\ 1\leq i,j\leq n$ and $c_{ij} = \sum a_{ik} b_{kj}$ some more text

• I wouldn't use \mathrm for text and. Commented Jan 18, 2016 at 21:56
• @Sigur, see upgrade of my answer. Personally I always use package mathtools and \text{ ... }. So the first example only show what you can do, if for some reason you don't use amsmath or mathtools package. Commented Jan 19, 2016 at 3:20

First, without proper UTF support, the compiler is going to choke on the suggested input (or at least omit some symbols). Assuming that you want pdfLaTeX to do the job, you rewrite those symbols using LaTeX conventions. Here is an MWE:

\documentclass{article}
\usepackage{mathtools}
\begin{document}
You have $\forall i,j\quad 1\le i, j\le n$ and $c_{ij} = \sum a_{ik} b_{kj}$, but consider this:
$\forall i,j\quad 1\le i, j\le n \quad \text{and} \quad c_{ij} = \sum a_{ik} b_{kj}$
There goes the rest of your text.
\end{document}


The result looks like this:

Note the difference in the size of the summation symbol in inline ($formula$) and displayed ($formula$) math.

If the space seems too wide to you, you can change the \quad command into a simple escaped space \ ​. The mathtools package is required to typeset proper text in math mode (spaces are not being ignored etc., unlike the suggested solutions with \mathrm{and} that does not require the aforementioned package but still treats the text as roman symbols in math mode).

You might want to separate those lower indices with a semicolon (like a_{i;j}) because in some fields (like panel data analysis) it is quite unclear whether a_{2t-1} means “a at period (2t−1)” or “a_2 at period (t−1)”, so this is not just a matter of æsthetics.

If you want to write the equation in a inline-mode, then:

\documentclass{article}
\usepackage{mathtools}

$\forall i,j \text{ } 1\leq i,j\leq n \text{ and } c_{ij} = \sum{a_{ik} b_{kj}}$

\end{document}