7

I use French notation for intervals, like ]x,y[. But the brackets behave funny --- they try to surround wrong thing, like

] x,y [∪] a,b [

Writing \left]x,y\right[\cup\left]a,b\right[ solves the problem in most cases. But I want these brackets to have the same size, but they become larger on something like ]a,B^c[.

P.S. My question is closely related to "How to input open intervals", but not the same.

0
9

you can use \mathopen]x,y\mathclose[

3
  • 1
    @AntonPetrunin: Consider using mleftright and then \mleft] x, y \mright[.
    – Werner
    Dec 20 '17 at 21:24
  • 2
    @DavidCarlisle Wouldn't it be better to use \mathopen]x,y\mathclose[ instead of \mathopen{]}x,y\mathclose{[}? Suppose you want to write ]x,y[²: If you use \mathopen{]}x,y\mathclose{[}^2 the vertical positioning of the superscript "²" is bad. (Note that the braces aren't argument delimiters here because \mathclose is a TeX primitive. See also tex.stackexchange.com/a/110220/227621.)
    – user227621
    Nov 5 '20 at 22:17
  • @user227621 er, yes, done, thanks. Nov 5 '20 at 23:36
10

The interval package by Lars Madsen has been designed to take care of this kind of problem (and some others):

\documentclass{article}
\usepackage{interval}
\begin{document}
\[
    \interval[open]{x}{y} \cup \interval[open]{a}{b}
\]
\end{document}

enter image description here

See its documentation for more information.

1
  • Thanks for sharing this clean package!
    – Diaa
    Nov 6 '20 at 0:13
6

If you have many of these intervals, you may want to create a dedicated macro called, say, \frint (short for "French-notation interval"...), as follows:

\documentclass{article}
\usepackage{mathtools} % for "\DeclarePairedDelimiter" macro
\DeclarePairedDelimiter{\frint}{]}{[}

\begin{document}
$\frint{x,y}\cup\frint{a,b}$
%% same output as '$\mathopen{]}x,y\mathclose{[} \cup \mathopen{]}a,b\mathclose{[}$'
\end{document}

enter image description here

Then, write \frint* to auto-size the "fences", and write \frint[\big], \frint[\Big], \frint[\bigg], or \frint[\Bigg] to enlarge the fences to a specific, fixed size.

4

Time ago, I created my own french notation intervals with several commands depending on type of interval (they added some unnecessary extra space). Now I implemented the \mathopen{]} and \mathclose{[} (as in David Carlisle answer). I use (in preamble)

\newcommand{\cord}{\mathopen{]}}
\newcommand{\cori}{\mathclose{[}}
\newcommand{\intsai}[2]{\cord #1,#2\cord}
\newcommand{\intsad}[2]{\cori #1,#2\cori}
\newcommand{\intc}[2]{\cori #1,#2\cord}
\newcommand{\inta}[2]{\cord #1,#2\cori}

Here is an example of application

enter image description here

\[
\arraycolsep=10pt
\renewcommand{\arraystretch}{1.5}
\begin{array}{cc}
\textbf{bounded}    &   \textbf{unbounded}  \\
\inta{x}{y}         &   \inta{-\infty}{y}   \\
\intc{x}{y}         &   \intsai{-\infty}{y} \\
\intsad{x}{y}       &   \inta{x}{+\infty}   \\   
\intsai{x}{y}       &   \intsad{x}{+\infty} \\
\end{array}
\]
\qquad
\[\inta{x}{y}\cup\inta{a}{b}\]
2
  • 1
    this is still using a mathclose node on the left and a mathopen on the right so the extra fixed spacing will not always be right depending on the context and the spacing that the mathopen and mathclose nodes add. Dec 20 '17 at 21:29
  • @DavidCarlisle Yes, that is true. Actually as you say, the fixed space make the intervals look weird (e.g. infinite negative intervals above). What would be a good practice to avoid that, preserving some "good looking" space in custom commands?
    – Cragfelt
    Dec 20 '17 at 23:41

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