# How to left align the beginnings of two equations and right align the ends of the equations

I am using an align environment to display two expressions on each of two lines. I would like the first expression in each line to be left aligned and the second expression in each line to be right aligned. The first expression in each line are aligned but I can't get the second expression in each line right aligned. The quads are used to reduce the empty space in the center of each line.

\documentclass[paper=letter,twoside,fontsize=12pt,leqno]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{microtype}
\usepackage{enumitem}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{scrlayer-scrpage}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{mathtools}
\newcommand{\ceilset}{\mathsf{Ceil}}
\newcommand{\ceilf}[1]{\lceil #1 \rceil}
\begin{document}
Define the following two functions:
\begin{align*}
\intertext{for each $(A, B) \in \ceilset \times \ceilset$ by the assignments}
\end{align*}
These functions will be used shortly.
\end{document}


If my proposed alignment is a bad idea, please suggest an alternative.

• Your MWE doesn't compile. Are there packages or custom macro definitions missing? – Tiuri Nov 17 at 15:48
• What is the \ceilset and \ceilf commands? – Bernard Nov 17 at 15:51
• My bad, forgot to check the MWE. – Jay Nov 17 at 18:12

Use alignat, that makes pairs of “right aligned/left aligned” columns with no intervening space (that you can add yourself).

\documentclass{article}
\usepackage{amsmath}

\newcommand{\ceilset}{\mathsf{Ceil}}
\newcommand{\ceilf}[1]{\lceil #1 \rceil}

\begin{document}

Define the following two functions
\begin{alignat*}{3}
&\wedge \colon \ceilset \times \ceilset \longrightarrow \ceilset
\vee \colon \ceilset \times \ceilset \longrightarrow \ceilset \\
\intertext{for each $(A, B) \in \ceilset \times \ceilset$ by the assignments}
&\wedge \colon (A, B) \longmapsto A \cap B
\vee \colon (A, B) \longmapsto \ceilf{A \cup B} \makebox[0pt][l]{.}
\end{alignat*}
These functions will be used shortly.

\end{document}


I set the period hanging right, so the symbols are aligned.

You should also considering aligning at the wedge and vee:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\ceilset}{\mathsf{Ceil}}
\newcommand{\ceilf}[1]{\lceil #1 \rceil}

\begin{document}

Define the following two functions
\begin{alignat*}{2}
&\wedge \colon \ceilset \times \ceilset \longrightarrow \ceilset
\vee \colon \ceilset \times \ceilset \longrightarrow \ceilset \\
\intertext{for each $(A, B) \in \ceilset \times \ceilset$ by the assignments}
&\wedge \colon (A, B) \longmapsto A \cap B
\vee \colon (A, B) \longmapsto \ceilf{A \cup B} .
\end{alignat*}
These functions will be used shortly.

\end{document}


Notes.

1. I only left the package amsmath that's essential for the code.
2. The colon after “functions” is wrong.
• Thank you for the comment about the colon. – Jay Nov 18 at 17:03

Define \ceilset and \ceilif according to your needs and try the following

\documentclass[paper=letter,twoside,fontsize=12pt,leqno]{scrbook}
\usepackage{mathtools}
\begin{document}
\noindent Define the following two functions:
\begin{align*}
&\wedge \colon \ceilset \times \ceilset \longrightarrow \ceilset & & \text{and} & \vee \colon \ceilset \times \ceilset \longrightarrow \ceilset &  \\
\intertext{for each $(A, B) \in \ceilset \times \ceilset$ by the assignments}
&\wedge \colon (A, B) \longmapsto A \cap B && \text{and} & \vee \colon (A, B) \longmapsto \ceilf{A \cup B} &\text{.}
\end{align*}
\end{document}


If you also want to align the operators:

\documentclass[paper=letter,twoside,fontsize=12pt,leqno]{scrbook}
\usepackage{mathtools}

\usepackage{showframe}
\let\ceilset=\relax
\let\ceilf=\relax
\begin{document}
Define the following two functions:
\begin{align*}
&\wedge \colon \ceilset \times \ceilset &&\longrightarrow \ceilset && \text{and} && \vee \colon \ceilset \times \ceilset &&\longrightarrow  \\
\intertext{for each $(A, B) \in \ceilset \times \ceilset$ by the assignments}
&\wedge \colon (A, B) &&\longmapsto A \cap B && \text{and} && \vee \colon (A, B) &&\longmapsto \ceilf{A \cup B} \quad\text{.} \\
\end{align*}
\end{document}