0

enter image description here

I have been using hspace to space things out, but it's really tedious to get it lined up correctly and there's no way that is the best way lol

  • 1
    Welcome to TeX.SE! Please show us a short compilable TeX code resulting in your screenshot ... – Mensch Nov 05 '22 at 23:48
  • Could this https://www.overleaf.com/learn/latex/Aligning_equations_with_amsmath or this https://tex.stackexchange.com/questions/391424/how-to-align-equation-with-text help – Paul A Nov 06 '22 at 00:29
  • @Mensch Unfortunately, it is from a PDF, and was wondering what I could write in LaTex to produce the same type of proof format – SomberTheScrub Nov 06 '22 at 00:37
  • But "I have been using hspace to space things out" suggests that you have something. That would have given us something to start from as well as showing how much of TeX you do already understand. – Teepeemm Nov 06 '22 at 01:12

2 Answers2

1

Here are three ways. First using tabular (no packages needed). Second using aligned (requires amsmath), and third using align* (also uses amsmath).

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

$x\in(\overline{A}\cup\overline{B})\setminus (A\cap B)$ [ \begin{tabular}{ll} $\equiv(x\in\overline{A}\cup\overline{B})\land\lnot(x\in A\cap B)$ & \textsf{Def of Difference}\ $\equiv((x\in\overline{A})\vee x\in\overline{B})\land(\lnot(x\in A\cup B)$ & \textsf{Def of Union}\ $\equiv(\cdots$ & \textsf{Def of \dots} \end{tabular} ]

\vspace{1cm} $x\in(\overline{A}\cup\overline{B})\setminus (A\cap B)$ [ \begin{aligned} &\equiv(x\in\overline{A}\cup\overline{B})\land\lnot(x\in A\cap B) && \textsf{Def of Difference}\ &\equiv((x\in\overline{A})\vee x\in\overline{B})\land(\lnot(x\in A\cup B) && \textsf{Def of Union}\ &\equiv(\cdots && \textsf{Def of \dots} \end{aligned} ]

\vspace{1cm} $x\in(\overline{A}\cup\overline{B})\setminus (A\cap B)$ \begin{align} &\equiv(x\in\overline{A}\cup\overline{B})\land\lnot(x\in A\cap B) && \textsf{Def of Difference}\ &\equiv((x\in\overline{A})\vee x\in\overline{B})\land(\lnot(x\in A\cup B) && \textsf{Def of Union}\ &\equiv(\cdots && \textsf{Def of \dots} \end{align}

\end{document}

Sandy G
  • 42,558
0

You want to be sure that TeX will keep the whole thing together.

\documentclass{article}
\usepackage{amsmath,mathtools}

\usepackage{lipsum} % for mock text

\newcommand{\justif}[1]{\textsf{#1}} \newcommand{\cmpl}[1]{\overline{#1}}

\begin{document}

\lipsum[1][1-4] \begin{equation} \begin{aligned} \MoveEqLeft x\in (\cmpl{A}\cup\cmpl{B})\setminus(A\cap B) \[1ex] &\equiv (x\in\cmpl{A}\cup\cmpl{B})\land\lnot(x\in A\cap B) && \justif{Def of Difference} \ &\equiv ((x\in\cmpl{A})\lor(x\in\cmpl{B}))\land\lnot(x\in A\cap B) && \justif{Def of Union} \ &\equiv (\lnot(x\in A)\lor\lnot(x\in B))\land\lnot(x\in A\cap B) && \justif{Def of Complement} \ &\equiv \lnot((x\in A)\land(x\in B))\land\lnot(x\in A\cap B) && \justif{De Morgan} \ &\equiv \lnot(x\in A\cap B)\land\lnot(x\in A\cap B) && \justif{Def of Intersection} \ &\equiv \lnot(x\in A\cap B) && \justif{Idempotence} \ &\equiv x\in\cmpl{A\cap B} && \justif{Def of Complement} \end{aligned} \end{equation*} \lipsum[2]

\end{document}

enter image description here

If you replace with

\begin{flalign*}
\quad
\MoveEqLeft x\in (\cmpl{A}\cup\cmpl{B})\setminus(A\cap B) \\[1ex]
<the same code as before follows>
\end{align*}

you get

enter image description here

Why the commands \justif and \compl? Suppose you or your coauthor finds the \overline to be ugly (I do, for instance). You may decide to experiment a different notation. Changing into

\documentclass{article}
\usepackage{amsmath,mathtools}

\usepackage{lipsum} % for mock text

% widebar, see https://tex.stackexchange.com/a/391193/4427 \DeclareFontFamily{U}{mathx}{} \DeclareFontShape{U}{mathx}{m}{n}{ <-> mathx10 }{} \DeclareSymbolFont{mathx}{U}{mathx}{m}{n} \DeclareFontSubstitution{U}{mathx}{m}{n} \DeclareMathAccent{\widebar}{\mathalpha}{mathx}{"73}

\newcommand{\justif}[1]{\textsf{#1}} %\newcommand{\cmpl}[1]{\overline{#1}} \newcommand{\cmpl}[1]{\widebar{#1}}

\begin{document}

\lipsum[1][1-4] \begin{flalign} \quad\MoveEqLeft x\in (\cmpl{A}\cup\cmpl{B})\setminus(A\cap B) \[1ex] &\equiv (x\in\cmpl{A}\cup\cmpl{B})\land\lnot(x\in A\cap B) && \justif{Def of Difference} \ &\equiv ((x\in\cmpl{A})\lor(x\in\cmpl{B}))\land\lnot(x\in A\cap B) && \justif{Def of Union} \ &\equiv (\lnot(x\in A)\lor\lnot(x\in B))\land\lnot(x\in A\cap B) && \justif{Def of Complement} \ &\equiv \lnot((x\in A)\land(x\in B))\land\lnot(x\in A\cap B) && \justif{De Morgan} \ &\equiv \lnot(x\in A\cap B)\land\lnot(x\in A\cap B) && \justif{Def of Intersection} \ &\equiv \lnot(x\in A\cap B) && \justif{Idempotence} \ &\equiv x\in\cmpl{A\cap B} && \justif{Def of Complement} \end{flalign*} \lipsum[2]

\end{document}

would turn the output (flalign* version) into

enter image description here

Similarly, if your coauthor doesn't like sans serif type, you can just change the definition of \justif.

egreg
  • 1,121,712