Math & ScienceTwo-line Set Definition underneath Sum Operator

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Mr Me
Posts: 1
Joined: Tue Aug 14, 2012 11:38 pm

Two-line Set Definition underneath Sum Operator

Post by Mr Me »

I want to format properly the formula shown in the attached image. The formula is written within an algorithmic environment, and I can't get the spacing and sizes in the summation right.

The set I want to define for the summation limits would be read: "x in C such that x is in D and x is in E".

Here is my code:

Code: Select all

\begin{algorithm}
   \begin{algorithmic}
      \STATE $a \gets \sum\limits_{ b \in \left\{ x \in C \mid \begin{array}{c} x \in D \\
      \wedge x \in E \end{array} \right\} } b$
   \end{algorithmic}
\end{algorithm}
Any help is greatly appreciated!
Attachments
This is the formula I want to format
This is the formula I want to format
TwoLineSet.jpg (6.72 KiB) Viewed 4521 times

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Two-line Set Definition underneath Sum Operator

Post by Stefan Kottwitz »

You could use
  • \middle| for the middle delimiter "such that"
  • subarray of amsmath for a smaller array
  • \mathclap of mathtools to not stretch the formula because of the wide array below
  • \mathlarger of relsize to get a bigger summation symbol
  • perhaps add space before and after the \sum, if \mathclap has been used
Example:

Code: Select all

\documentclass{article}
\usepackage{mathtools}
\usepackage{relsize}
\begin{document}
$a \gets \mathlarger\sum\limits_{\mathclap{ b \in \left\{ x \in C \middle|
  \begin{subarray}{c} x \in D \\
    \wedge x \in E
  \end{subarray}\right\}}} b$
\end{document}
sum.png
sum.png (3.66 KiB) Viewed 4517 times
Btw. it would be good, in case of problems, to post a compilable Infominimal working example, as I did here. Then it's easier to provide help - a better chance to get a solution, and faster.

Stefan
LaTeX.org admin
Post Reply