6

This question already has an answer here:

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.

marked as duplicate by Harald Hanche-Olsen, Sigur, Stefan Pinnow, Kurt, user2478 Dec 20 '17 at 21:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

7

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

  • 1
    @AntonPetrunin: Consider using mleftright and then \mleft] x, y \mright[. – Werner Dec 20 '17 at 21:24
8

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.

5

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.

3

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}\]
  • 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. – David Carlisle 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
  • use any of the answers here except this one:-) – David Carlisle Dec 20 '17 at 23:45

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