# Best typesetting of formula

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}


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.

-
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
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 I don't necessarily want a scientific notation. I just don't like the look of my equation. –  Svend Tveskæg Apr 10 '13 at 19:55
@azetina Because I like this better. ;) Your suggestion is blackboard notation to me. –  Svend Tveskæg Apr 10 '13 at 19:56
@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

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}


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.

-
Good point. This is yet another good solution. –  Svend Tveskæg Apr 10 '13 at 20:29
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
@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 :

## 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}

-
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}


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$


-
Nice idea. :) –  Svend Tveskæg Apr 10 '13 at 19:50
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:

\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}

-
This is a good solution! –  Svend Tveskæg Apr 11 '13 at 12:46

\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\}.

-
This look interesting. I'll accept this answer if nothing better comes up. –  Svend Tveskæg Apr 10 '13 at 19:43

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 - A typo on 2nd row, 1st col. That should be \frac{1985}{4}. – Aditya Apr 14 '13 at 21:43 add comment \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}

-
I'm not sure Svend is dealing with fractions... I think they are years –  Mario S. E. Apr 10 '13 at 19:35
That is not very good, I think, but thank you for the contribution. –  Svend Tveskæg Apr 10 '13 at 19:36
@MarioS.E. Well spotted. :) –  Svend Tveskæg Apr 10 '13 at 19:36
I should get extra points for the effort of playing with the big boys :P –  Mario S. E. Apr 10 '13 at 19:40
@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 :) –  cgnieder Apr 10 '13 at 19:57

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

-
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}$?
Welcome to TeX.SX. Could you elaborate a bit more your answer, perhaps with a minimal working example (MWE) starting with \documentclass{...} and ending with \end{document}? –  Claudio Fiandrino Apr 11 '13 at 12:47