# How to align math expressions and texts

In fact, I want to have the fourth expression (T_v) aligned in the left as the previous ones and also I want to have a good align design in the second case where there is speed on point, mean speed and noise

\documentclass{article}
\usepackage{amsmath}
\begin{document}
With:\\ \\
$m_1$= 0.4 . \\
$m_2$= 0.25 .\\
$K_f$= $\sqrt{2T_v(1-m_{2}^2)(\frac{m_1^2}{m_2^2}-m_2+1-m_1^2)^{-1}}$ . \\
$T_v= \frac{L_v}{V_{moy}}$
\\ \\ \\
With:\\ \\
$V_{0}$\textit{(t,$\omega$)}: Speed on point $V_0$.\\
$V_{mea}$: Mean speed.\\
B\textit{(t,$\omega$)}: Noise.\par
\end{document}

• you should almost never use \\  outside of tables and alignments and certainly never do \\ \\  which generates Underfull \hbox (badness 10000) which is the maximum measure of badness that TeX assigns – David Carlisle Mar 8 '18 at 18:59

## 3 Answers

Here's a solution that employs two array environments. All material is snugged up against the left-hand edge of the text block.

\documentclass{article}

\usepackage{array}
\newcolumntype{L}{>{$}l<{$}}
\newcolumntype{m}{>{\displaystyle}l}

\begin{document}
\renewcommand\arraystretch{1.3}
\noindent
With:\\[1ex]
$\begin{array}{@{} m @{{}={}} m } m_1 & 0.4 \\ m_2 & 0.25 \\ K_f & \Bigl[2T_v(1-m_{2}^2)\Bigl(\frac{m_1^2}{m_2^2} -m_2+1-m_1^2 \Bigr)^{\!\!-1}\, \Bigr]^{1/2} \\ T_v & \frac{L_v}{V_{\mathrm{moy}}} \end{array}$

\bigskip\noindent
With:\\[1ex]
$\begin{array}{@{}mL} V_{0}(t,\omega) & Speed on point$V_0$\\ V_{\mathrm{mea}} & Mean speed\\ B(t,\omega) & Noise \end{array}$

\end{document}


I really do not fully understand what you want to achieve, but I am wondering if the following goes in the right direction.

\documentclass[fleqn]{article}
\usepackage{amsmath}
\begin{document}
With:
\begin{align*}
m_1&= 0.4 . \\
m_2&= 0.25 .\\
K_f&= \sqrt{2T_v(1-m_{2}^2)\left(\frac{m_1^2}{m_2^2}-m_2+1-m_1^2\right)^{-1}} . \\
T_v&= \frac{L_v}{V_\mathrm{moy}}
\end{align*}
With:
\begin{align*}
V_{0}(t,\omega)&:~\text{Speed on point $V_0$}.\\
V_\mathrm{mea}&:~\text{Mean speed}.\\
B(t,\omega)&:~\text{Noise}.
\end{align*}
\end{document}


EDIT: If you want to move the equations to the left, use

\documentclass[fleqn]{article}
\usepackage{amsmath}
\setlength{\mathindent}{0pt} % from https://tex.stackexchange.com/a/8744/121799
\begin{document}
\noindent
With:
\begin{align*}
m_1&= 0.4 . \\
m_2&= 0.25 .\\
K_f&= \sqrt{2T_v(1-m_{2}^2)\left(\frac{m_1^2}{m_2^2}-m_2+1-m_1^2\right)^{-1}} . \\
T_v&= \frac{L_v}{V_\mathrm{moy}}
\end{align*}
With:
\begin{align*}
V_{0}(t,\omega)&:~\text{Speed on point $V_0$}.\\
V_\mathrm{mea}&:~\text{Mean speed}.\\
B(t,\omega)&:~\text{Noise}.
\end{align*}
\end{document}


And if you want the alignment anchor to be on the left, use

\documentclass[fleqn]{article}
\usepackage{amsmath}
\setlength{\mathindent}{0pt}
\begin{document}
\noindent
With:
\begin{align*}
&m_1= 0.4 . \\
&m_2= 0.25 .\\
&K_f= \sqrt{2T_v(1-m_{2}^2)\left(\frac{m_1^2}{m_2^2}-m_2+1-m_1^2\right)^{-1}} . \\
&T_v= \frac{L_v}{V_\mathrm{moy}}
\end{align*}
With:
\begin{align*}
&V_{0}(t,\omega):~\text{Speed on point $V_0$}.\\
&V_\mathrm{mea}:~\text{Mean speed}.\\
&B(t,\omega):~\text{Noise}.
\end{align*}
\end{document}


None of these options look too nice to me, but this is a matter of taste.

• Yes that's what I want but I want them to be aligned on the left – twimo Mar 8 '18 at 19:13
• In fact it's not working for me, I don't know why when I use \setlength{\mathindent}{0pt} and run latex it says ! LaTeX Error: Missing \begin{document}. Do you have a better representation of that – twimo Mar 8 '18 at 19:27
• @twimo Sorry, I can't reproduce your statement. These snippets run without an error. I have double-checked this with pdflatex, xelatex and lualatex. – user121799 Mar 8 '18 at 19:55

You can align using flalign* and \shortintertext (from mathtools ). For the second alignment, I prefer a description environment, with style nextline, and a tabular environment with a vertical rule on the left, like this:

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{array, mathtools}
\usepackage{enumitem}

\begin{document}

\begin{flalign*}
\shortintertext{With:}
& m_1= 0.4 . & \\
& m_2= 0.25. \\
& K_f = \sqrt{2T_v(1-m_{2}^2)\biggl(\frac{m_1^2}{m_2^2}-m_2+1-m_1^2\biggr)^{\!-1}}. \\
& T_v= \frac{L_v}{V_\text{moy}} .
\end{flalign*}

\begin{description}[style = nextline, font = \mdseries, leftmargin = 0.5em]
\item[With\medskip]
\begin{tabular}{|>{$}l <{$} l}
V_{0}(t, \omega): & Speed on point $V_0$.\\
V_\text{mea}: & Mean speed.\\
B(t,\omega): & Noise.
\end{tabular}
\end{description}

\end{document}