1

Does anyone how to write this formula in Latex? enter image description here

MWE:

\documentclass{article}
\usepackage{amsmath, amssymb, latexsym}
\begin{document}
$$R (A, B, C) \cup P (D, E, F) = Q (A, B, C)$$
% a b c     m n o     a b c
% d e f     g h i     d e f
% g h i               g h i
% j k l               j k l
%                     m n o.
\end{document}
Youra_P
  • 1,054
  • 1
    Off-topic: The latexsym package was superseded by the amssymb package in 1994 [!]. For sure, ever since then, there's no need or reason to load latexsym if amssymb is loaded. – Mico Aug 27 '22 at 18:33

3 Answers3

0

The easiest way is probably to use an array.

\documentclass{article}
\usepackage{amsmath, amssymb}
\begin{document}
\[ \begin{array}{*{4}{c@{}c@{\,}c@{\,}c@{}}}
    R( & A, & B, & C & ) \cup P( & D, & E, & F & ) = Q( & A, & B, & C) \\
       & a  & b  & c &           & m  & n  & o &        & a  & b  & c  \\
       & d  & e  & f &           & g  & h  & i &        & d  & e  & f  \\
       & g  & h  & i &           &    &    &   &        & g  & h  & i  \\
       & j  & k  & l &           &    &    &   &        & j  & k  & l  \\
       &    &    &   &           &    &    &   &        & m  & n  & o.
\end{array} \]
\end{document}
Vincent
  • 20,157
0

Here's a solution with 3 top-aligned array environments.

enter image description here

\documentclass{article}
\begin{document}
\[
\setlength\arraycolsep{1pt}     % default: 5pt
\renewcommand\arraystretch{1.5} % default: 1
R(\begin{array}[t]{@{} lll @{}}
  A, & B, & C \\
  a  & b  & c \\
  d  & e  & f \\
  g  & h  & i \\
  j  & k  & l 
\end{array}) 
\cup
P(\begin{array}[t]{@{} lll @{}}
  D, & E, & F \\
  m  & n  & o \\
  g  & h  & i 
\end{array})
=
Q(\begin{array}[t]{@{} lll @{}}
  A, & B, & C \\
  a  & b  & c \\
  d  & e  & f \\
  g  & h  & i \\
  j  & k  & l \\
  m  & n  & o
\end{array})
\]
\end{document}
Mico
  • 506,678
0

You have two options, either array and control set column alignment to left, centre, or right or use alignat{n} with groups of right & left alignment (see this quation)

enter image description here

EDIT. Please see the comment regarding the package latexsym.

\documentclass{article}
\usepackage{amsmath, amssymb}
\begin{document}

[ \begin{array}{c @{;}c@{;} c @{\ }c@{\ } c} R(A,B,C) &\cup& P(D,E,F) &=& Q(A,B,C) \ a b c & & m n o & & a b c \ d e f & & g h i & & d e f \ g h i & & & & g h i \ j k l & & & & j k l \ & & & & m n o \end{array} ]

\begin{alignat}{3} R(A,B,C) &;\cup;&& P(D,E,F) &;=;& Q(A,B,C) \ a b c & && m n o & & a b c \ d e f & && g h i & & d e f \ g h i & && & & g h i \ j k l & && & & j k l \ & && & & m n o \end{alignat}

\end{document}

Celdor
  • 9,058
  • 1
    The latexsym package was superseded by the amssymb package in 1994 [!]. For sure, no need or reason to load latexsym if amssymb is loaded. – Mico Aug 27 '22 at 18:09
  • 1
    I am usually not trying to mess with OP's list of packages but didn't realise someone would bring an almost 30 years old one. I'll add a suggestion. – Celdor Aug 27 '22 at 18:19
  • My bad -- I had completely missed the fact that the OP's code loads latexsym. – Mico Aug 27 '22 at 18:34
  • @Mico Thanks for pointing this out. It's definitely important to know if someone is still trying to use those kind of files. Otherwise, I wouldn't be aware of that, at all. – Celdor Aug 27 '22 at 18:54