Math & ScienceAligning formulas with both left and right alignment

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
TinyMushroom
Posts: 1
Joined: Wed Jul 02, 2025 5:40 pm

Aligning formulas with both left and right alignment

Post by TinyMushroom »

How can I align formulas with text that requires both left and right alignment. While this alignment works, it is leaving a lot of empty space in between and does not dynamically decrease the width of the alignment. You can refer to my image what I mean, I am not that great in explaining what I want.

Code:

Code: Select all

\documentclass[12pt, twoside, a4paper]{article}
\usepackage{mathtools}
\usepackage[italicdiff]{physics}
\numberwithin{equation}{subsection}
\begin{document}
\begin{subequations}
\label{eq:Cartesian}
    \noindent
    \textbf{Cartesian:}
    \begin{flalign}
    & \text{Line differential:} \quad & \dd{\vb{l}} &= \dd{x} \vu{x} + \dd{y} \vu{y} + \dd{z} \vu{z}  \label{eq:CartesianLine} &&\\
    & \text{Volume differential:} \quad & \dd{\tau} &= \dd{x} \dd{y} \dd{z} \label{eq:CartesianVolume} & \\
    & \text{Gradient:} \quad & \grad{t} &= \pdv{t}{x} \vu{x} + \pdv{t}{y} \vu{y} + \pdv{t}{z} \vu{z} \label{eq:CartesianGradient} && \\
    & \text{Divergence:} \quad & \div{\vb{v}} &= \pdv{v_x}{x} + \pdv{v_y}{x} + \pdv{v_z}{z} \label{eq:CartesianDivergence} && \\
    & \text{Curl:} \quad & \curl{\vb{v}} &= \left( \pdv{v_z}{y} - \pdv{v_y}{z} \right) \vu{x} + \left( \pdv{v_x}{z}
      - \pdv{v_z}{x} \right) \vu{y} + \left( \pdv{v_y}{x} - \pdv{v_x}{y} \right) \vu{z} \label{eq:CartesianCurl} && \\
    & \text{Laplacian:} \quad & \laplacian{\vb{v}} &= \pdv{v_x}{x} + \pdv{v_y}{x} + \pdv{v_z}{z} \label{eq:CartesianLaplacian} && 
    \end{flalign}
\end{subequations}
\end{document}
Attachments
align a group with left right alignment.png
align a group with left right alignment.png (76.19 KiB) Viewed 260 times

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Re: Aligning formulas with both left and right alignment

Post by Stefan Kottwitz »

Welcome to the forum!

You yould insert more column separators:

Code: Select all

\documentclass[12pt, twoside, a4paper]{article}
\usepackage{mathtools}
\usepackage[italicdiff]{physics}
\numberwithin{equation}{subsection}
\begin{document}
\begin{subequations}
\label{eq:Cartesian}
    \noindent
    \textbf{Cartesian:}
    \begin{flalign}
    & \text{Line differential:} \quad && \dd{\vb{l}}& &= \dd{x} \vu{x} + \dd{y} \vu{y} + \dd{z} \vu{z}  \label{eq:CartesianLine} &&\\
    & \text{Volume differential:} \quad && \dd{\tau}& &= \dd{x} \dd{y} \dd{z} \label{eq:CartesianVolume} & \\
    & \text{Gradient:} \quad && \grad{t}& &= \pdv{t}{x} \vu{x} + \pdv{t}{y} \vu{y} + \pdv{t}{z} \vu{z} \label{eq:CartesianGradient} && \\
    & \text{Divergence:} \quad && \div{\vb{v}}& &= \pdv{v_x}{x} + \pdv{v_y}{x} + \pdv{v_z}{z} \label{eq:CartesianDivergence} && \\
    & \text{Curl:} \quad && \curl{\vb{v}}& &= \left( \pdv{v_z}{y} - \pdv{v_y}{z} \right) \vu{x} + \left( \pdv{v_x}{z} -
          \pdv{v_z}{x} \right) \vu{y} + \left( \pdv{v_y}{x} - \pdv{v_x}{y} \right) \vu{z} \label{eq:CartesianCurl} && \\
    & \text{Laplacian:} \quad && \laplacian{\vb{v}}& &= \pdv{v_x}{x} + \pdv{v_y}{x} + \pdv{v_z}{z} \label{eq:CartesianLaplacian} && 
    \end{flalign}
\end{subequations}
\end{document}
align.jpg
align.jpg (79.71 KiB) Viewed 86 times
Stefan
LaTeX.org admin
Post Reply