I'm trying to put three equations in the same line.
I used the tabularx
package as was advised by this post: How to place and number 3 short equations in one line?.
However since I am using equation with different heights, they do not align well vertically.
I manage to solve this using \vspace
but I would like to know if there is a more elegant solution. Here is the code I used:
\documentclass[11pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage[margin=0.25in]{geometry}
\begin{document}
\noindent\begin{tabularx}{\textwidth}{@{}XXX@{}}
\vspace{0.1mm}
\begin{equation}
Euc(P,Q)= \left( \sum_{i=1}^n \left| p_i - q_i \right|^2 \right)^{1/2}
\label{eqn:1}
\end{equation} &
\vspace{1.5mm}
\begin{equation}
Canb(P,Q)=\sum_{i=1}^n \frac{|p_i-q_i|}{|p_i|+|q_i|}
\label{eqn:2}
\end{equation} &
\vspace{5.8mm}
\begin{equation}
Man(P,Q)=\sum_{i=1}^n |p_i-q_i|
\label{eqn:3}
\end{equation}
\end{tabularx}
\end{document}
Best Answer
To place three numbered equations next to one another, you could use the
multicols
environment, which is provided by themulticol
package. In the example below, using this environment makes it unnecessary to fiddle with various tabular-like environments or experiment with\vspace
adjustments.Incidentally, using
\left(
...\right)
to enclose a summation symbol with limits tends to generate parentheses that are far too large, typographically speaking. Better to use\biggl(
...\biggr)
in such cases. (This is not only my prescription; you may find it in the TeXbook as well.)