TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider the following example.

\documentclass{article}

\usepackage{amsmath}

\newcommand*\mathsetfont{\mathbf}
\newcommand*\DeclareMathSet[1]{%
  \expandafter\newcommand\csname set#1\endcsname{\mathsetfont{#1}}
}
\DeclareMathSet{N}
\DeclareMathSet{Q}

\begin{document}

\begin{align*}
  &\{1983/4, 1985/4, 1986/4, 1987/4, 1989/4, 1990/4, 1991/4,\\
  &\hphantom{{}\{} 1993/4, 1994/4, 1995/4, 1997/4, 1998/4, 1999/4\}
   \subseteq \setQ\setminus\setN.
\end{align*}

\end{document}

output

What is the best way to typeset this formula?

The reason I ask, is that I think my try looks 'odd' with \subseteq \setQ\setminus\setN begin just below 1991/4.

share|improve this question
1  
I don't know what do you want, but if you really want scientific notation, may be working with modulus would work great. By the way @PeterGrill I think it's really common to use that, but with amssymb you get the \smallseminus which is better in my opinion (not the best, but better). – Manuel Apr 10 '13 at 19:53
2  
Just to add to aesthetics, why not use \mathbb{Q}, \mathbb{N} instead of \textbf{Q} and \textbf{N}? – azetina Apr 10 '13 at 19:55
    
@Manuel: Thansk. I did not know that. I guess I should look things up first before ass uming I know things. :-) – Peter Grill Apr 10 '13 at 20:17
1  
@PeterGrill Just to add info that you are working with sets and not with numbers, functions, ... As I said \smallsetminus is more like a rotated minus and may be preferred for some people. – Manuel Apr 10 '13 at 20:21
    
@Manuel: Ok, good to know that there are at least three symbols for set minus. But I still think it is clearer when you overload an arithmetic minus as it is an operation on two sets, not numbers. – Peter Grill Apr 10 '13 at 20:24
up vote 28 down vote accepted

My personal motto is if I have a clear message to convey, it's better to make it obvious

\documentclass{article}
\usepackage{amsmath,array}
\usepackage{xcolor,cancel}

\newcommand*\mathsetfont{\mathbf}
\newcommand*\DeclareMathSet[1]{%
  \expandafter\newcommand\csname set#1\endcsname{\mathsetfont{#1}}
}
\DeclareMathSet{N}
\DeclareMathSet{Q}

\begin{document}

\[
\left\{
\begin{array}{c@{,}c@{,}c@{,}c@{,}}
\ldots         &\ldots         &\frac{1983}{4} &\cancel{\textcolor{red}{\frac{1984}{4}}}\\[1ex]
\frac{1985}{4} &\frac{1986}{4} &\frac{1987}{4} &\cancel{\textcolor{red}{\frac{1988}{4}}}\\[1ex]
\frac{1989}{4} &\frac{1990}{4} &\frac{1991}{4} &\cancel{\textcolor{red}{\frac{1992}{4}}}\\[1ex]
\frac{1993}{4} &\frac{1994}{4} &\frac{1995}{4} &\cancel{\textcolor{red}{\frac{1996}{4}}}\\[1ex]
\frac{1997}{4} &\frac{1998}{4} &\frac{1999}{4} &\ldots
\end{array}
\right\}\subseteq \setQ\setminus\setN.
\]


\end{document}

enter image description here

You can actually make a new column type to ease up the entries. But I always confuse myself with >{}, <{} groups. Block selection of text seemed easier this time :)


EDIT: Converted to a sequence such that mathematically sensitive ones are less offended.

share|improve this answer
    
I do like this, but one suggestion and one comment. I'd put the cancelled out terms over 4 to be consistent. Second, I am not 100% sure about a set notation with an element having a line through it to mean that it is not an element of the set. – Peter Grill Apr 10 '13 at 20:38
    
Oh, and when you add the commas back in, do the commas as part of the "cancelled" terms need to be cancelled? :-) – Peter Grill Apr 10 '13 at 20:41
    
@PeterGrill Indeed, but cancels ought to be read as discarded elements in the sequence not in terms of set notation. – percusse Apr 10 '13 at 21:02
    
@percusse: Ok, but its not a sequence, its a set. – Peter Grill Apr 10 '13 at 22:32
1  
@PeterGrill Exactly. But compare the unnecessary complication while trying to be super precise to explain a very very basic idea instead of abusing set notation. I think formal notation can be quite redundant at times. – percusse Apr 11 '13 at 7:01

Here are two other ways :

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}

\newcommand*\mathsetfont{\mathbf}
\newcommand*\DeclareMathSet[1]{%
  \expandafter\newcommand\csname set#1\endcsname{\mathsetfont{#1}}
}
\DeclareMathSet{N}
\DeclareMathSet{Q}

\begin{document}
The equation:
\[
\left\{ \frac{y}{4} \right\} \subseteq \setQ\setminus\setN
\]
where $y \in \{ 1983, 1985, 1986, 1987, 1989, 1990, 1991, 1993, 1994, 1995, 1997, 1998, 1999 \}$
\bigskip
\hrule
\bigskip
If we let $Y = \{ 1983, 1985, 1986, 1987, 1989, 1990, 1991, 1993, 1994, 1995, 1997, 1998, 1999 \}$, then
\[
\left\{ \frac{y}{4} \,\middle|\, y \in Y\right\} \subseteq \setQ\setminus\setN
\]
\bigskip
\hrule
\bigskip
The set $Y$ could also be expressed as
\[ Y = \{ n \in \setN \mid 1983 \le n \le 1999 \} \setminus \{ 1984,1988,1992,1996\} \]
\end{document}
share|improve this answer
    
Hmmm! This might be the way to go. I'll probably accet this if nothing better comes up. – Svend Tveskæg Apr 10 '13 at 19:58

Another take... very scientific look:

\documentclass{article}

\usepackage{amsmath}

\newcommand{\mathsetfont}{\mathbf}
\newcommand{\DeclareMathSet}[1]{%
  \expandafter\newcommand\csname set#1\endcsname{\mathsetfont{#1}}
}
\DeclareMathSet{N}
\DeclareMathSet{Q}

\begin{document}

\[ \{n/4\mid n\in [1983, 1999]\setminus\{1984,1988,1992,1996\} \cap \setN\}\subseteq \setQ\setminus\setN \]

\end{document}

enter image description here

EDIT: ... or you may even completely do away with any explicit enumeration of numbers, if that's what you're after:

\[ \{n/4\mid n\in [1983, 1999] \cap \setN\ \land n \neq 4m \mid m \in \setN\}\subseteq \setQ\setminus\setN \]

enter image description here

share|improve this answer
    
Instead of | you can use \mid. – Manuel Apr 10 '13 at 19:54
    
@Manuel: Thanks, that gives better spacing, indeed. I updated my code! :) – Count Zero Apr 10 '13 at 19:56
    
@SvendTveskæg: Thanks! Came up with another one in the meantime! :D – Count Zero Apr 10 '13 at 20:08

Would this work:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{multline}
\mathbf{Q}\setminus\mathbf{N} \supseteq \{1983/4, 1985/4, 1986/4, 1987/4, 1989/4, 1990/4,\\
1991/4, 1993/4, 1994/4, 1995/4, 1997/4, 1998/4, 1999/4\}
\end{multline}

\end{document}
share|improve this answer

What about:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath

\newcommand*\mathsetfont{\mathbf}
\newcommand*\DeclareMathSet[1]{%
  \expandafter\newcommand\csname set#1\endcsname{\mathsetfont{#1}}
}
\DeclareMathSet{N}
\DeclareMathSet{Q}

\begin{document}

\begin{align*}
  &\{1983/4, 1985/4, 1986/4, 1987/4, 1989/4, 1990/4, 1991/4,\\
  &\hphantom{{}\{} 1993/4, 1994/4, 1995/4, 1997/4, 1998/4, 1999/4\}
   \subseteq \setQ\setminus\setN.
\end{align*}

\begin{align*}
  \{y/4 \mid y \in \{1983,\dotsc, 1999\} \setminus \{1984,1988,1992,1996\}\}
    \subseteq \setQ\setminus\setN.
\end{align*}

\end{document}

You may even consider using \{\text{leap year}\} instead of \{1984,...,1996\}.

share|improve this answer

I ended up using the idea of percusse in my solution.

Code

\documentclass{article}

\usepackage{amsmath}
\usepackage{cancel}
\usepackage{xcolor}
\usepackage[locale=DE]{siunitx}

% \nonly: non-leap year
\newcommand*\nonly[1]{\cancel{\textcolor{red}{\num{#1}}}}

\begin{document}

\begin{equation*}
  \left\{
   \begin{array}{c @{\,,\,} c @{\,,\,} c @{\,,\,} c @{\,,\phantom{,}}}
    \dots          & \dots          & \frac{1983}{4} & \frac{1984}{4} \\[1ex]
    \frac{1985}{4} & \frac{1986}{4} & \frac{1987}{4} & \frac{1988}{4} \\[1ex]
    \frac{1989}{4} & \frac{1990}{4} & \frac{1991}{4} & \frac{1992}{4} \\[1ex]
    \frac{1993}{4} & \frac{1994}{4} & \frac{1995}{4} & \frac{1996}{4} \\[1ex]
    \frac{1997}{4} & \frac{1998}{4} & \frac{1999}{4} & \dots
   \end{array}
  \right\}
  =
  \left\{
   \begin{array}{c @{\ ,\ } c @{\ ,\ } c @{\ ,\ } c @{\ ,\phantom{,}}}
    \dots          & \dots         & \nonly{495.75} & 496   \\[1ex]
    \nonly{496.25} & \nonly{496.5} & \nonly{496.75} & 497   \\[1ex]
    \nonly{497.25} & \nonly{497.5} & \nonly{497.75} & 498   \\[1ex]
    \nonly{498.25} & \nonly{498.5} & \nonly{498.75} & 499   \\[1ex]
    \nonly{499.25} & \nonly{499.5} & \nonly{499.75} & \dots
   \end{array}
  \right\}
\end{equation*}

\end{document}

Output

output

share|improve this answer
1  
A typo on 2nd row, 1st col. That should be \frac{1985}{4}. – Aditya Apr 14 '13 at 21:43
\documentclass{minimal}
\usepackage{amsmath}
\begin{document}
\[\left\{\frac{1983}{4}, \frac{1985}{4}, \frac{1986}{4}, \frac{1987}{4}, \frac{1989}{4}, \frac{1990}{4}, \frac{1991}{4}, \frac{1993}{4}, \frac{1994}{4}, \frac{1995}{4}, \frac{1997}{4}, \frac{1998}{4}, \frac{1999}{4}\right\}\subseteq Q\backslash N\]
\end{document}
share|improve this answer
    
I'm not sure Svend is dealing with fractions... I think they are years – Mario S. E. Apr 10 '13 at 19:35
    
I should get extra points for the effort of playing with the big boys :P – Mario S. E. Apr 10 '13 at 19:40
    
Also: Why not use the minimal class – doncherry Apr 10 '13 at 19:42
    
@doncherry I'm using the article class in the real document and simply forgot to change it. – Svend Tveskæg Apr 10 '13 at 19:45
1  
@SvendTveskæg I believe you misread doncherry's comment: the minimal class should not be used for MWE's. The article class is just fine :) – clemens Apr 10 '13 at 19:57

What about using siunitx package and adding the extra year as uncertainty?

share|improve this answer
    
What about it? :P – percusse Apr 13 '13 at 10:29
    
well, that could solve the problem of the visual /s... – Mario S. E. Apr 13 '13 at 11:04
    
I mean why not making a MWE for demonstration? :) – percusse Apr 13 '13 at 18:20
    
Hahahaha, ok, I'm sorry, I'll get to it – Mario S. E. Apr 13 '13 at 19:04

Have you considered just writing something like $\{k / 4\}_{k = 1983}^{1999}$?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.