I am trying to typeset a integer interval like this: [0..m-1]

However, the space between 0,., and m - 1 are too small. Is there a package to improve this?

  • $[0 \dots m-1]$? – Rmano Apr 16 '16 at 19:00
  • 4
    @Rmano It must be two dots. – Henricus V. Apr 16 '16 at 19:01

Let's see how I can make a command that is like a \dots but with two dots. Firstly, I use the wisdom of TeX.SE and find how to find the content of a standard definition; then a bit of command line:

[romano:~] % texdef -t latex dots  
macro:->\protect \dots  
\dots :
\long macro:->\ifmmode \mathellipsis \else \textellipsis \fi 

[romano:~] % texdef -t latex mathellipsis
macro:->\mathinner {\ldotp \ldotp \ldotp }

and finally:

 \newcommand{\twodots}{\mathinner {\ldotp \ldotp}}

which results in:

twodots macro

(This is just for math mode, but you can easily extend it for text too, mimicking the \dots definition)


I like the two dots, too. My usual code is

[a\mathrel{{.}\,{.}}\nobreak b]

of course hidden in a macro.




$[0\isep m-1]$


enter image description here

A more elaborate solution for coping with intervals of any kind, while keeping a syntax that doesn't force a choice.


  \keys_set:nn { calcolo/interval } { o, #1 }
  \bool_if:NTF { \l_calcolo_interval_auto_bool }
  \calcolo_interval_set:nn #2
  \bool_if:NTF { \l_calcolo_interval_auto_bool }
\cs_new_protected:Nn \calcolo_interval_set:nn
  #1 \mathrel{{.}\,{.}}\nobreak #2
\keys_define:nn { calcolo/interval }
  size .code:n =
   \tl_if_eq:nnTF { #1 } { * }
    { \bool_set_true:N \l_calcolo_interval_auto_bool }
    { \tl_set:Nn \l_calcolo_interval_size_tl { #1 } },
  o .code:n =
   \tl_set:Nn \l_calcolo_interval_left_tl { ( }
   \tl_set:Nn \l_calcolo_interval_right_tl { ) },
  oo .code:n =
   \tl_set:Nn \l_calcolo_interval_left_tl { ( }
   \tl_set:Nn \l_calcolo_interval_right_tl { ) },
  c .code:n =
   \tl_set:Nn \l_calcolo_interval_left_tl { [ }
   \tl_set:Nn \l_calcolo_interval_right_tl { ] },
  cc .code:n =
   \tl_set:Nn \l_calcolo_interval_left_tl { [ }
   \tl_set:Nn \l_calcolo_interval_right_tl { ] },
  oc .code:n =
   \tl_set:Nn \l_calcolo_interval_left_tl { ( }
   \tl_set:Nn \l_calcolo_interval_right_tl { ] },
  co .code:n =
   \tl_set:Nn \l_calcolo_interval_left_tl { [ }
   \tl_set:Nn \l_calcolo_interval_right_tl { ) },
  o .value_forbidden:n = true,
  oo .value_forbidden:n = true,
  c .value_forbidden:n = true,
  cc .value_forbidden:n = true,
  oc .value_forbidden:n = true,
  co .value_forbidden:n = true,

\tl_new:N \l_calcolo_interval_left_tl
\tl_new:N \l_calcolo_interval_right_tl
\tl_new:N \l_calcolo_interval_size_tl
\bool_new:N \l_calcolo_interval_auto_bool










enter image description here


Here is a solution with mathtools and xparse. I define a command \Iintvl{m,n}. You need a font which contains the relevant delimiters, \llbracket and \rrbracket (fourier and stmaryrd) or equivalents (MnSymbol and MdSymbol have \lsem and \rsem). The star version of the command adapts the size of the delimiters to the contents, and you can fine-tune their size with an optional argument (\big, \Big, …).

\usepackage{mathtools, stmaryrd}
\usepackage{xparse} \DeclarePairedDelimiterX{\Iintv}[1]{\llbracket}{\rrbracket}{\iintvargs{#1}}
{\iintvargsaux#1} %
\NewDocumentCommand{\iintvargsaux}{mm} {#1\mkern1.5mu..\mkern1.5mu#2}


\[ \Iintv{-2,5} \quad \Iintv*{2^n, 2^{n + 1} } \quad \Iintv*{2^{2^n} + 1, 2^{2^{n + 1}} + 1}\]


enter image description here


Much less robust than others (it can of course be made more robust, but may be this is enough), but it might be nice looking and readable code


If you need \left[ .. \right] I can add the code.

  • 2
    \nobreak is necessary after \mathrel{...} or TeX would be allowed to put a line break. – egreg Apr 16 '16 at 21:42
  • Sorry, I definitely tried to copy your output code (while varying the input) but miss that one. – Manuel Apr 16 '16 at 21:43

Use \enleadertwodots in the stix package is perfect (aside from tiny spacing). I've added a couple variations on spacing so you can see how it looks:


\[[1\, \enleadertwodots\, m-1] \quad [1 \enleadertwodots\, m-1] \quad [1 \enleadertwodots m-1]\]



I found this after scanning through this huge list of symbols in latex.

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.