2

In the mathtools documentation, page 27, a command \Set* (along with \Set) is defined to stretch according to the large input inside:

\providecommand\given{}

\newcommand\SetSymbol[1][]{
    \nonscript\:#1\vert
    \allowbreak
    \nonscript\:
    \mathopen{}}

\DeclarePairedDelimiterX\Set[1]\{\}{
    \renewcommand\given{\SetSymbol[\delimsize]}
    #1
}

For instance, using the above command, the following

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\[
    \Set{(2,\pm 1)} \cup \Set*{\left (\frac{2t^2 - 2t + 2}{t^2 + 1},\, \frac{1-t^2}{t+1}\right ) \given t \neq -1 }
\]
\end{document}

produces Result1

Now, I quite like the automatic scaling options. However, in my old own \Set command, I always added some space around the argument:

\newcommand{\Set}[1]{\{\, #1 \,\}}

This produced something like Result2 In this case, the extra spacing is particularly easy to see in the set on the left of the \cup.

Does anyone know how this spacing behaviour might be added to mathtools' approach to defining a set-command? Or even to create something entirely different, but which achieves both the scaling and the spacing?

3

Just add the thin spaces:

\documentclass{article}
\usepackage{mathtools}

\providecommand\given{}

\newcommand\SetSymbol[1][]{%
  \nonscript\:#1\vert
  \allowbreak
  \nonscript\:%
  \mathopen{}%
}

\DeclarePairedDelimiterX\Set[1]\{\}{%
  \renewcommand\given{\SetSymbol[\delimsize]}%
  \,#1\,% <--- thin spaces around the part in braces
}

\begin{document}

\[
\Set{(2,\pm 1)} \cup
\Set*{\left (\frac{2t^2 - 2t + 2}{t^2 + 1},\, \frac{1-t^2}{t+1}\right )
      \given t \neq -1 }
\]
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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