## LaTeX forum ⇒ Math & Science ⇒ align function with long equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
LLLatexJ9
Posts: 1
Joined: Thu Aug 01, 2024 7:41 am

### align function with long equations

Hi all,

I'm having two issues:
1. The align function is not aligning my equation to the centre of the page centred at the "=" sign
2. It is also not wrapping my equation around, I couldn't figure out how to make it do this

Any help would be much appreciated, please find the code below:

\begin{align*}
\sum_{v \in V(G)} \deg_G(v) &= 2 \left| E(G) \right|
\\
\left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 1 \} \right| + \left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 2 \} \right| + \left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 3 \} \right| &= 2\left| E(G) \right|\\
\left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 1 \} \right| &= 2\left| E(G) \right| - \left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 2 \} \right| - \left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 3 \} \right|
\hfill\\
\end{align*}

Thanks
Last edited by Stefan Kottwitz on Thu Aug 01, 2024 1:54 pm, edited 1 time in total.
Reason: code marked

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Stefan Kottwitz
Posts: 10215
Joined: Mon Mar 10, 2008 9:44 pm

### align function with long equations

Hi,

welcome to the forum!

1. That's because the equation ist too wide and doesn't fit. It can only start at the left margin, so the "=" sign cannot be at the page center. You see it when you use a bigger paper in landscape mode:

\documentclass{article}
\usepackage[a3paper,landscape]{geometry}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\sum_{v \in V(G)} \deg_G(v) &= 2 \left| E(G) \right|
\\
\left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 1 \} \right| + \left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 2 \} \right| + \left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 3 \} \right| &= 2\left| E(G) \right|\\
\left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 1 \} \right| &= 2\left| E(G) \right| - \left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 2 \} \right| - \left| \{ \text{deg}_G(v) : \text{deg}_G(v) = 3 \} \right|
\hfill\\
\end{align*}
\end{document}

2. There's no automatic line breaking in displayed equations, you need to do it manually. The breqn package supports automatic line breaking, but it's hard to apply here.

Stefan