Typesetting an integer interval Announcing the arrival of Valued Associate #679: Cesar...

As Singapore Airlines (Krisflyer) Gold, can I bring my family into the lounge on a domestic Virgin Australia flight?

Most bit efficient text communication method?

Co-worker has annoying ringtone

Does the Mueller report show a conspiracy between Russia and the Trump Campaign?

How to identify unknown coordinate type and convert to lat/lon?

Deconstruction is ambiguous

Crossing US/Canada Border for less than 24 hours

Is CEO the "profession" with the most psychopaths?

Putting class ranking in CV, but against dept guidelines

How does the math work when buying airline miles?

What's the point of the test set?

Sum letters are not two different

The test team as an enemy of development? And how can this be avoided?

Should a wizard buy fine inks every time he want to copy spells into his spellbook?

What are the discoveries that have been possible with the rejection of positivism?

Why weren't discrete x86 CPUs ever used in game hardware?

What does it mean that physics no longer uses mechanical models to describe phenomena?

What does Turing mean by this statement?

Did any compiler fully use 80-bit floating point?

What does 丫 mean? 丫是什么意思?

How do I find out the mythology and history of my Fortress?

How many morphisms from 1 to 1+1 can there be?

The Nth Gryphon Number

Draw 4 of the same figure in the same tikzpicture



Typesetting an integer interval



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)How can I see the “implementation” of the LaTeX command?How to properly typeset math intervalsvertical spacing in multiline gather with amsmathExtra space between number and variable in math modeCorrectly typesetting a relationUsing the parskip package, I find the space between subtitles uglyToo much space below figuresDecrease horizontal space in moderncv's cvdoubleitemTypesetting longitude or latitude followed by a commaZero space between bars of the same interval in pgfplots ybar interval plotsLarge Brackets Make Line Breaks too SmallTypesetting Hermann-Mauguin notation correctlyHow to increase Chinese character space?












12















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?










share|improve this question























  • $[0 dots m-1]$?

    – Rmano
    Apr 16 '16 at 19:00






  • 3





    @Rmano It must be two dots.

    – Henricus V.
    Apr 16 '16 at 19:01
















12















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?










share|improve this question























  • $[0 dots m-1]$?

    – Rmano
    Apr 16 '16 at 19:00






  • 3





    @Rmano It must be two dots.

    – Henricus V.
    Apr 16 '16 at 19:01














12












12








12


3






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?










share|improve this question














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?







spacing






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 16 '16 at 18:35









Henricus V.Henricus V.

448412




448412













  • $[0 dots m-1]$?

    – Rmano
    Apr 16 '16 at 19:00






  • 3





    @Rmano It must be two dots.

    – Henricus V.
    Apr 16 '16 at 19:01



















  • $[0 dots m-1]$?

    – Rmano
    Apr 16 '16 at 19:00






  • 3





    @Rmano It must be two dots.

    – Henricus V.
    Apr 16 '16 at 19:01

















$[0 dots m-1]$?

– Rmano
Apr 16 '16 at 19:00





$[0 dots m-1]$?

– Rmano
Apr 16 '16 at 19:00




3




3





@Rmano It must be two dots.

– Henricus V.
Apr 16 '16 at 19:01





@Rmano It must be two dots.

– Henricus V.
Apr 16 '16 at 19:01










5 Answers
5






active

oldest

votes


















13














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  
dots:
macro:->protect dots
dots :
long macro:->ifmmode mathellipsis else textellipsis fi

[romano:~] % texdef -t latex mathellipsis
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)






share|improve this answer

































    9














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



    [amathrel{{.},{.}}nobreak b]


    of course hidden in a macro.



    documentclass{article}
    usepackage{amsmath}

    newcommand{isep}{mathrel{{.},{.}}nobreak}

    begin{document}

    $[0isep m-1]$

    end{document}


    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.



    documentclass{article}
    usepackage{amsmath,mleftright}
    usepackage{xparse}

    ExplSyntaxOn
    NewDocumentCommand{interval}{O{}>{SplitArgument{1}{,}}m}
    {
    group_begin:
    keys_set:nn { calcolo/interval } { o, #1 }
    bool_if:NTF { l_calcolo_interval_auto_bool }
    {mleftl_calcolo_interval_left_tl}
    {mathopen{l_calcolo_interval_size_tll_calcolo_interval_left_tl}}
    calcolo_interval_set:nn #2
    bool_if:NTF { l_calcolo_interval_auto_bool }
    {mrightl_calcolo_interval_right_tl}
    {mathclose{l_calcolo_interval_size_tll_calcolo_interval_right_tl}}
    group_end:
    }
    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
    ExplSyntaxOff


    begin{document}

    $interval{a,b}$

    $interval[c]{a,b}$

    $interval[co]{a,b}$

    $interval[oc]{a,b}$

    $interval[size=Big]{a,b}$

    bigskip

    $interval[size=*,co]{dfrac{dfrac{1}{2}}{dfrac{3}{4}},b}$

    end{document}


    enter image description here






    share|improve this answer

































      4














      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, …).



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

      begin{document}

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

      end{document}


      enter image description here






      share|improve this answer































        0














        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



        defintv#1[#2..#3]{mathopen{#1[}#2mathrel{{.},{.}}nobreak#3mathclose{#1]}}
        $
        intv[a..b]
        intvbig[a..b]
        intvBigg[frac{a}{b}..c]
        $


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






        share|improve this answer





















        • 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



















        0














        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:



        documentclass[10pt]{article}
        usepackage{stix}
        begin{document}

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

        end{document}


        p1



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






        share|improve this answer








        New contributor




        ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





















          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "85"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f304662%2ftypesetting-an-integer-interval%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          13














          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  
          dots:
          macro:->protect dots
          dots :
          long macro:->ifmmode mathellipsis else textellipsis fi

          [romano:~] % texdef -t latex mathellipsis
          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)






          share|improve this answer






























            13














            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  
            dots:
            macro:->protect dots
            dots :
            long macro:->ifmmode mathellipsis else textellipsis fi

            [romano:~] % texdef -t latex mathellipsis
            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)






            share|improve this answer




























              13












              13








              13







              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  
              dots:
              macro:->protect dots
              dots :
              long macro:->ifmmode mathellipsis else textellipsis fi

              [romano:~] % texdef -t latex mathellipsis
              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)






              share|improve this answer















              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  
              dots:
              macro:->protect dots
              dots :
              long macro:->ifmmode mathellipsis else textellipsis fi

              [romano:~] % texdef -t latex mathellipsis
              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)







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Apr 13 '17 at 12:35









              Community

              1




              1










              answered Apr 16 '16 at 19:14









              RmanoRmano

              8,28121648




              8,28121648























                  9














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



                  [amathrel{{.},{.}}nobreak b]


                  of course hidden in a macro.



                  documentclass{article}
                  usepackage{amsmath}

                  newcommand{isep}{mathrel{{.},{.}}nobreak}

                  begin{document}

                  $[0isep m-1]$

                  end{document}


                  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.



                  documentclass{article}
                  usepackage{amsmath,mleftright}
                  usepackage{xparse}

                  ExplSyntaxOn
                  NewDocumentCommand{interval}{O{}>{SplitArgument{1}{,}}m}
                  {
                  group_begin:
                  keys_set:nn { calcolo/interval } { o, #1 }
                  bool_if:NTF { l_calcolo_interval_auto_bool }
                  {mleftl_calcolo_interval_left_tl}
                  {mathopen{l_calcolo_interval_size_tll_calcolo_interval_left_tl}}
                  calcolo_interval_set:nn #2
                  bool_if:NTF { l_calcolo_interval_auto_bool }
                  {mrightl_calcolo_interval_right_tl}
                  {mathclose{l_calcolo_interval_size_tll_calcolo_interval_right_tl}}
                  group_end:
                  }
                  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
                  ExplSyntaxOff


                  begin{document}

                  $interval{a,b}$

                  $interval[c]{a,b}$

                  $interval[co]{a,b}$

                  $interval[oc]{a,b}$

                  $interval[size=Big]{a,b}$

                  bigskip

                  $interval[size=*,co]{dfrac{dfrac{1}{2}}{dfrac{3}{4}},b}$

                  end{document}


                  enter image description here






                  share|improve this answer






























                    9














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



                    [amathrel{{.},{.}}nobreak b]


                    of course hidden in a macro.



                    documentclass{article}
                    usepackage{amsmath}

                    newcommand{isep}{mathrel{{.},{.}}nobreak}

                    begin{document}

                    $[0isep m-1]$

                    end{document}


                    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.



                    documentclass{article}
                    usepackage{amsmath,mleftright}
                    usepackage{xparse}

                    ExplSyntaxOn
                    NewDocumentCommand{interval}{O{}>{SplitArgument{1}{,}}m}
                    {
                    group_begin:
                    keys_set:nn { calcolo/interval } { o, #1 }
                    bool_if:NTF { l_calcolo_interval_auto_bool }
                    {mleftl_calcolo_interval_left_tl}
                    {mathopen{l_calcolo_interval_size_tll_calcolo_interval_left_tl}}
                    calcolo_interval_set:nn #2
                    bool_if:NTF { l_calcolo_interval_auto_bool }
                    {mrightl_calcolo_interval_right_tl}
                    {mathclose{l_calcolo_interval_size_tll_calcolo_interval_right_tl}}
                    group_end:
                    }
                    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
                    ExplSyntaxOff


                    begin{document}

                    $interval{a,b}$

                    $interval[c]{a,b}$

                    $interval[co]{a,b}$

                    $interval[oc]{a,b}$

                    $interval[size=Big]{a,b}$

                    bigskip

                    $interval[size=*,co]{dfrac{dfrac{1}{2}}{dfrac{3}{4}},b}$

                    end{document}


                    enter image description here






                    share|improve this answer




























                      9












                      9








                      9







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



                      [amathrel{{.},{.}}nobreak b]


                      of course hidden in a macro.



                      documentclass{article}
                      usepackage{amsmath}

                      newcommand{isep}{mathrel{{.},{.}}nobreak}

                      begin{document}

                      $[0isep m-1]$

                      end{document}


                      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.



                      documentclass{article}
                      usepackage{amsmath,mleftright}
                      usepackage{xparse}

                      ExplSyntaxOn
                      NewDocumentCommand{interval}{O{}>{SplitArgument{1}{,}}m}
                      {
                      group_begin:
                      keys_set:nn { calcolo/interval } { o, #1 }
                      bool_if:NTF { l_calcolo_interval_auto_bool }
                      {mleftl_calcolo_interval_left_tl}
                      {mathopen{l_calcolo_interval_size_tll_calcolo_interval_left_tl}}
                      calcolo_interval_set:nn #2
                      bool_if:NTF { l_calcolo_interval_auto_bool }
                      {mrightl_calcolo_interval_right_tl}
                      {mathclose{l_calcolo_interval_size_tll_calcolo_interval_right_tl}}
                      group_end:
                      }
                      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
                      ExplSyntaxOff


                      begin{document}

                      $interval{a,b}$

                      $interval[c]{a,b}$

                      $interval[co]{a,b}$

                      $interval[oc]{a,b}$

                      $interval[size=Big]{a,b}$

                      bigskip

                      $interval[size=*,co]{dfrac{dfrac{1}{2}}{dfrac{3}{4}},b}$

                      end{document}


                      enter image description here






                      share|improve this answer















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



                      [amathrel{{.},{.}}nobreak b]


                      of course hidden in a macro.



                      documentclass{article}
                      usepackage{amsmath}

                      newcommand{isep}{mathrel{{.},{.}}nobreak}

                      begin{document}

                      $[0isep m-1]$

                      end{document}


                      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.



                      documentclass{article}
                      usepackage{amsmath,mleftright}
                      usepackage{xparse}

                      ExplSyntaxOn
                      NewDocumentCommand{interval}{O{}>{SplitArgument{1}{,}}m}
                      {
                      group_begin:
                      keys_set:nn { calcolo/interval } { o, #1 }
                      bool_if:NTF { l_calcolo_interval_auto_bool }
                      {mleftl_calcolo_interval_left_tl}
                      {mathopen{l_calcolo_interval_size_tll_calcolo_interval_left_tl}}
                      calcolo_interval_set:nn #2
                      bool_if:NTF { l_calcolo_interval_auto_bool }
                      {mrightl_calcolo_interval_right_tl}
                      {mathclose{l_calcolo_interval_size_tll_calcolo_interval_right_tl}}
                      group_end:
                      }
                      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
                      ExplSyntaxOff


                      begin{document}

                      $interval{a,b}$

                      $interval[c]{a,b}$

                      $interval[co]{a,b}$

                      $interval[oc]{a,b}$

                      $interval[size=Big]{a,b}$

                      bigskip

                      $interval[size=*,co]{dfrac{dfrac{1}{2}}{dfrac{3}{4}},b}$

                      end{document}


                      enter image description here







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Apr 16 '16 at 20:18









                      AboAmmar

                      34.7k32985




                      34.7k32985










                      answered Apr 16 '16 at 19:33









                      egregegreg

                      735k8919343259




                      735k8919343259























                          4














                          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, …).



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

                          begin{document}

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

                          end{document}


                          enter image description here






                          share|improve this answer




























                            4














                            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, …).



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

                            begin{document}

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

                            end{document}


                            enter image description here






                            share|improve this answer


























                              4












                              4








                              4







                              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, …).



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

                              begin{document}

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

                              end{document}


                              enter image description here






                              share|improve this answer













                              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, …).



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

                              begin{document}

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

                              end{document}


                              enter image description here







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Apr 16 '16 at 19:15









                              BernardBernard

                              176k778210




                              176k778210























                                  0














                                  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



                                  defintv#1[#2..#3]{mathopen{#1[}#2mathrel{{.},{.}}nobreak#3mathclose{#1]}}
                                  $
                                  intv[a..b]
                                  intvbig[a..b]
                                  intvBigg[frac{a}{b}..c]
                                  $


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






                                  share|improve this answer





















                                  • 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
















                                  0














                                  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



                                  defintv#1[#2..#3]{mathopen{#1[}#2mathrel{{.},{.}}nobreak#3mathclose{#1]}}
                                  $
                                  intv[a..b]
                                  intvbig[a..b]
                                  intvBigg[frac{a}{b}..c]
                                  $


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






                                  share|improve this answer





















                                  • 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














                                  0












                                  0








                                  0







                                  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



                                  defintv#1[#2..#3]{mathopen{#1[}#2mathrel{{.},{.}}nobreak#3mathclose{#1]}}
                                  $
                                  intv[a..b]
                                  intvbig[a..b]
                                  intvBigg[frac{a}{b}..c]
                                  $


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






                                  share|improve this answer















                                  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



                                  defintv#1[#2..#3]{mathopen{#1[}#2mathrel{{.},{.}}nobreak#3mathclose{#1]}}
                                  $
                                  intv[a..b]
                                  intvbig[a..b]
                                  intvBigg[frac{a}{b}..c]
                                  $


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







                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited Apr 16 '16 at 21:44

























                                  answered Apr 16 '16 at 21:16









                                  ManuelManuel

                                  21.6k847109




                                  21.6k847109








                                  • 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














                                  • 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








                                  2




                                  2





                                  nobreak is necessary after mathrel{...} or TeX would be allowed to put a line break.

                                  – egreg
                                  Apr 16 '16 at 21:42





                                  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





                                  Sorry, I definitely tried to copy your output code (while varying the input) but miss that one.

                                  – Manuel
                                  Apr 16 '16 at 21:43











                                  0














                                  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:



                                  documentclass[10pt]{article}
                                  usepackage{stix}
                                  begin{document}

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

                                  end{document}


                                  p1



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






                                  share|improve this answer








                                  New contributor




                                  ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                  Check out our Code of Conduct.

























                                    0














                                    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:



                                    documentclass[10pt]{article}
                                    usepackage{stix}
                                    begin{document}

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

                                    end{document}


                                    p1



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






                                    share|improve this answer








                                    New contributor




                                    ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                    Check out our Code of Conduct.























                                      0












                                      0








                                      0







                                      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:



                                      documentclass[10pt]{article}
                                      usepackage{stix}
                                      begin{document}

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

                                      end{document}


                                      p1



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






                                      share|improve this answer








                                      New contributor




                                      ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.










                                      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:



                                      documentclass[10pt]{article}
                                      usepackage{stix}
                                      begin{document}

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

                                      end{document}


                                      p1



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







                                      share|improve this answer








                                      New contributor




                                      ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.









                                      share|improve this answer



                                      share|improve this answer






                                      New contributor




                                      ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.









                                      answered 10 mins ago









                                      ryanryan

                                      1012




                                      1012




                                      New contributor




                                      ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.





                                      New contributor





                                      ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.






                                      ryan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                      Check out our Code of Conduct.






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f304662%2ftypesetting-an-integer-interval%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Can't compile dgruyter and caption packagesLaTeX templates/packages for writing a patent specificationLatex...

                                          Schneeberg (Smreczany) Bibliografia | Menu...

                                          Hans Bellmer Spis treści Życiorys | Upamiętnienie | Przypisy | Bibliografia | Linki zewnętrzne |...