Make commas not italicized inside a macro using textit

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












I'm trying to set up a shortcut for writing semantic types. These are usually written inside $langle$ and $rangle$ delimiters, with italicized letters standing for each type and commas separating these. They should look something like this:



enter image description here



I've come up with a macro like the following:



newcommandtype[1]%
$langle$textit#1$rangle$%



However, this of course results in the commas being italicized, too, which is not usually done in this context:



enter image description here



Is there a way to exclude commas from being italicized when using this command?



MWE:



documentclassarticle

newcommandtype[1]%
$langle$textit#1$rangle$%


usepackage[T1]fontenc
usepackagetimes

begindocument
typee, t % Don't want comma italicized
$langle e, trangle$ % Don't want math typeface for letters
$langle$textite, textitt$rangle$ % Desired result, but cumbersome
enddocument


Edit:



To clarify, the reason I don't want to just do $langle#1#rangle$ is because I want the semantic types to be set in the same typeface as the main text, not the math mode typeface. I've updated the MWE to reflect this, and here's the comparison:



enter image description here










share|improve this question



















  • 1




    it seems logically wrong to use the text face here, for textit will pick up tje current text style eg bold, you seem to be just useing the deprecated times package so using times roman text with computer modern math, if you used compatible math and text types it may look better to use the math font here.
    – David Carlisle
    36 mins ago














up vote
2
down vote

favorite












I'm trying to set up a shortcut for writing semantic types. These are usually written inside $langle$ and $rangle$ delimiters, with italicized letters standing for each type and commas separating these. They should look something like this:



enter image description here



I've come up with a macro like the following:



newcommandtype[1]%
$langle$textit#1$rangle$%



However, this of course results in the commas being italicized, too, which is not usually done in this context:



enter image description here



Is there a way to exclude commas from being italicized when using this command?



MWE:



documentclassarticle

newcommandtype[1]%
$langle$textit#1$rangle$%


usepackage[T1]fontenc
usepackagetimes

begindocument
typee, t % Don't want comma italicized
$langle e, trangle$ % Don't want math typeface for letters
$langle$textite, textitt$rangle$ % Desired result, but cumbersome
enddocument


Edit:



To clarify, the reason I don't want to just do $langle#1#rangle$ is because I want the semantic types to be set in the same typeface as the main text, not the math mode typeface. I've updated the MWE to reflect this, and here's the comparison:



enter image description here










share|improve this question



















  • 1




    it seems logically wrong to use the text face here, for textit will pick up tje current text style eg bold, you seem to be just useing the deprecated times package so using times roman text with computer modern math, if you used compatible math and text types it may look better to use the math font here.
    – David Carlisle
    36 mins ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I'm trying to set up a shortcut for writing semantic types. These are usually written inside $langle$ and $rangle$ delimiters, with italicized letters standing for each type and commas separating these. They should look something like this:



enter image description here



I've come up with a macro like the following:



newcommandtype[1]%
$langle$textit#1$rangle$%



However, this of course results in the commas being italicized, too, which is not usually done in this context:



enter image description here



Is there a way to exclude commas from being italicized when using this command?



MWE:



documentclassarticle

newcommandtype[1]%
$langle$textit#1$rangle$%


usepackage[T1]fontenc
usepackagetimes

begindocument
typee, t % Don't want comma italicized
$langle e, trangle$ % Don't want math typeface for letters
$langle$textite, textitt$rangle$ % Desired result, but cumbersome
enddocument


Edit:



To clarify, the reason I don't want to just do $langle#1#rangle$ is because I want the semantic types to be set in the same typeface as the main text, not the math mode typeface. I've updated the MWE to reflect this, and here's the comparison:



enter image description here










share|improve this question















I'm trying to set up a shortcut for writing semantic types. These are usually written inside $langle$ and $rangle$ delimiters, with italicized letters standing for each type and commas separating these. They should look something like this:



enter image description here



I've come up with a macro like the following:



newcommandtype[1]%
$langle$textit#1$rangle$%



However, this of course results in the commas being italicized, too, which is not usually done in this context:



enter image description here



Is there a way to exclude commas from being italicized when using this command?



MWE:



documentclassarticle

newcommandtype[1]%
$langle$textit#1$rangle$%


usepackage[T1]fontenc
usepackagetimes

begindocument
typee, t % Don't want comma italicized
$langle e, trangle$ % Don't want math typeface for letters
$langle$textite, textitt$rangle$ % Desired result, but cumbersome
enddocument


Edit:



To clarify, the reason I don't want to just do $langle#1#rangle$ is because I want the semantic types to be set in the same typeface as the main text, not the math mode typeface. I've updated the MWE to reflect this, and here's the comparison:



enter image description here







italic






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 45 mins ago

























asked 1 hour ago









Jigsaw

1136




1136







  • 1




    it seems logically wrong to use the text face here, for textit will pick up tje current text style eg bold, you seem to be just useing the deprecated times package so using times roman text with computer modern math, if you used compatible math and text types it may look better to use the math font here.
    – David Carlisle
    36 mins ago












  • 1




    it seems logically wrong to use the text face here, for textit will pick up tje current text style eg bold, you seem to be just useing the deprecated times package so using times roman text with computer modern math, if you used compatible math and text types it may look better to use the math font here.
    – David Carlisle
    36 mins ago







1




1




it seems logically wrong to use the text face here, for textit will pick up tje current text style eg bold, you seem to be just useing the deprecated times package so using times roman text with computer modern math, if you used compatible math and text types it may look better to use the math font here.
– David Carlisle
36 mins ago




it seems logically wrong to use the text face here, for textit will pick up tje current text style eg bold, you seem to be just useing the deprecated times package so using times roman text with computer modern math, if you used compatible math and text types it may look better to use the math font here.
– David Carlisle
36 mins ago










2 Answers
2






active

oldest

votes

















up vote
3
down vote



accepted










You want the semantic types to be math variables. Note mathptmx below, not the long deprecated times package.



documentclassarticle
usepackage[T1]fontenc
usepackagemathptmx

newcommandtype[1]ensuremathlangle#1rangle

begindocument

typee, t

$langle$textite, textitt$rangle$

enddocument


enter image description here



As you see, the only difference is in the (excessive) spacing in the complicated version.



An even better version, because newtx provides for much richer Times-like fonts for math:



documentclassarticle
usepackage[T1]fontenc
usepackagenewtxtext,newtxmath

newcommandtype[1]ensuremathlangle#1rangle

begindocument

typee, t

$langle$textite, textitt$rangle$

enddocument


enter image description here



For XeLaTeX and text font set to TeX Gyre Pagella, use newpxmath; a small fix is needed, though.



documentclassarticle
usepackage[no-math]fontspec
usepackagenewpxmath
usepackageamsmath

setmainfontTeX Gyre Pagella

DeclareSymbolFontoperatorsOT1zpltlfmn
SetSymbolFontoperatorsboldOT1zpltlfbn

newcommandtype[1]ensuremathlangle#1rangle

begindocument

typee, t

enddocument





share|improve this answer





























    up vote
    2
    down vote













    How about using:



    documentclassarticle

    deftype<#1,#2>$langle$textit#1, textit#2$rangle$

    begindocument
    type<e, t>
    enddocument


    to produce:



    enter image description here



    You could also drop the type and just use



    def<#1,#2>$langle$textit#1, textit#2$rangle$


    and then have <e,t> in your document.



    EDIT



    To allow for nesting you should explicitly typeset the comma in textrm:



    documentclassarticle

    def<#1,#2>$langle$textit#1textrm, textit#2$rangle$

    begindocument
    <e, t>

    <<e,t>,<e,t>>
    enddocument





    share|improve this answer






















      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',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      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%2f456047%2fmake-commas-not-italicized-inside-a-macro-using-textit%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote



      accepted










      You want the semantic types to be math variables. Note mathptmx below, not the long deprecated times package.



      documentclassarticle
      usepackage[T1]fontenc
      usepackagemathptmx

      newcommandtype[1]ensuremathlangle#1rangle

      begindocument

      typee, t

      $langle$textite, textitt$rangle$

      enddocument


      enter image description here



      As you see, the only difference is in the (excessive) spacing in the complicated version.



      An even better version, because newtx provides for much richer Times-like fonts for math:



      documentclassarticle
      usepackage[T1]fontenc
      usepackagenewtxtext,newtxmath

      newcommandtype[1]ensuremathlangle#1rangle

      begindocument

      typee, t

      $langle$textite, textitt$rangle$

      enddocument


      enter image description here



      For XeLaTeX and text font set to TeX Gyre Pagella, use newpxmath; a small fix is needed, though.



      documentclassarticle
      usepackage[no-math]fontspec
      usepackagenewpxmath
      usepackageamsmath

      setmainfontTeX Gyre Pagella

      DeclareSymbolFontoperatorsOT1zpltlfmn
      SetSymbolFontoperatorsboldOT1zpltlfbn

      newcommandtype[1]ensuremathlangle#1rangle

      begindocument

      typee, t

      enddocument





      share|improve this answer


























        up vote
        3
        down vote



        accepted










        You want the semantic types to be math variables. Note mathptmx below, not the long deprecated times package.



        documentclassarticle
        usepackage[T1]fontenc
        usepackagemathptmx

        newcommandtype[1]ensuremathlangle#1rangle

        begindocument

        typee, t

        $langle$textite, textitt$rangle$

        enddocument


        enter image description here



        As you see, the only difference is in the (excessive) spacing in the complicated version.



        An even better version, because newtx provides for much richer Times-like fonts for math:



        documentclassarticle
        usepackage[T1]fontenc
        usepackagenewtxtext,newtxmath

        newcommandtype[1]ensuremathlangle#1rangle

        begindocument

        typee, t

        $langle$textite, textitt$rangle$

        enddocument


        enter image description here



        For XeLaTeX and text font set to TeX Gyre Pagella, use newpxmath; a small fix is needed, though.



        documentclassarticle
        usepackage[no-math]fontspec
        usepackagenewpxmath
        usepackageamsmath

        setmainfontTeX Gyre Pagella

        DeclareSymbolFontoperatorsOT1zpltlfmn
        SetSymbolFontoperatorsboldOT1zpltlfbn

        newcommandtype[1]ensuremathlangle#1rangle

        begindocument

        typee, t

        enddocument





        share|improve this answer
























          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          You want the semantic types to be math variables. Note mathptmx below, not the long deprecated times package.



          documentclassarticle
          usepackage[T1]fontenc
          usepackagemathptmx

          newcommandtype[1]ensuremathlangle#1rangle

          begindocument

          typee, t

          $langle$textite, textitt$rangle$

          enddocument


          enter image description here



          As you see, the only difference is in the (excessive) spacing in the complicated version.



          An even better version, because newtx provides for much richer Times-like fonts for math:



          documentclassarticle
          usepackage[T1]fontenc
          usepackagenewtxtext,newtxmath

          newcommandtype[1]ensuremathlangle#1rangle

          begindocument

          typee, t

          $langle$textite, textitt$rangle$

          enddocument


          enter image description here



          For XeLaTeX and text font set to TeX Gyre Pagella, use newpxmath; a small fix is needed, though.



          documentclassarticle
          usepackage[no-math]fontspec
          usepackagenewpxmath
          usepackageamsmath

          setmainfontTeX Gyre Pagella

          DeclareSymbolFontoperatorsOT1zpltlfmn
          SetSymbolFontoperatorsboldOT1zpltlfbn

          newcommandtype[1]ensuremathlangle#1rangle

          begindocument

          typee, t

          enddocument





          share|improve this answer














          You want the semantic types to be math variables. Note mathptmx below, not the long deprecated times package.



          documentclassarticle
          usepackage[T1]fontenc
          usepackagemathptmx

          newcommandtype[1]ensuremathlangle#1rangle

          begindocument

          typee, t

          $langle$textite, textitt$rangle$

          enddocument


          enter image description here



          As you see, the only difference is in the (excessive) spacing in the complicated version.



          An even better version, because newtx provides for much richer Times-like fonts for math:



          documentclassarticle
          usepackage[T1]fontenc
          usepackagenewtxtext,newtxmath

          newcommandtype[1]ensuremathlangle#1rangle

          begindocument

          typee, t

          $langle$textite, textitt$rangle$

          enddocument


          enter image description here



          For XeLaTeX and text font set to TeX Gyre Pagella, use newpxmath; a small fix is needed, though.



          documentclassarticle
          usepackage[no-math]fontspec
          usepackagenewpxmath
          usepackageamsmath

          setmainfontTeX Gyre Pagella

          DeclareSymbolFontoperatorsOT1zpltlfmn
          SetSymbolFontoperatorsboldOT1zpltlfbn

          newcommandtype[1]ensuremathlangle#1rangle

          begindocument

          typee, t

          enddocument






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 15 mins ago

























          answered 29 mins ago









          egreg

          690k8518383086




          690k8518383086




















              up vote
              2
              down vote













              How about using:



              documentclassarticle

              deftype<#1,#2>$langle$textit#1, textit#2$rangle$

              begindocument
              type<e, t>
              enddocument


              to produce:



              enter image description here



              You could also drop the type and just use



              def<#1,#2>$langle$textit#1, textit#2$rangle$


              and then have <e,t> in your document.



              EDIT



              To allow for nesting you should explicitly typeset the comma in textrm:



              documentclassarticle

              def<#1,#2>$langle$textit#1textrm, textit#2$rangle$

              begindocument
              <e, t>

              <<e,t>,<e,t>>
              enddocument





              share|improve this answer


























                up vote
                2
                down vote













                How about using:



                documentclassarticle

                deftype<#1,#2>$langle$textit#1, textit#2$rangle$

                begindocument
                type<e, t>
                enddocument


                to produce:



                enter image description here



                You could also drop the type and just use



                def<#1,#2>$langle$textit#1, textit#2$rangle$


                and then have <e,t> in your document.



                EDIT



                To allow for nesting you should explicitly typeset the comma in textrm:



                documentclassarticle

                def<#1,#2>$langle$textit#1textrm, textit#2$rangle$

                begindocument
                <e, t>

                <<e,t>,<e,t>>
                enddocument





                share|improve this answer
























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  How about using:



                  documentclassarticle

                  deftype<#1,#2>$langle$textit#1, textit#2$rangle$

                  begindocument
                  type<e, t>
                  enddocument


                  to produce:



                  enter image description here



                  You could also drop the type and just use



                  def<#1,#2>$langle$textit#1, textit#2$rangle$


                  and then have <e,t> in your document.



                  EDIT



                  To allow for nesting you should explicitly typeset the comma in textrm:



                  documentclassarticle

                  def<#1,#2>$langle$textit#1textrm, textit#2$rangle$

                  begindocument
                  <e, t>

                  <<e,t>,<e,t>>
                  enddocument





                  share|improve this answer














                  How about using:



                  documentclassarticle

                  deftype<#1,#2>$langle$textit#1, textit#2$rangle$

                  begindocument
                  type<e, t>
                  enddocument


                  to produce:



                  enter image description here



                  You could also drop the type and just use



                  def<#1,#2>$langle$textit#1, textit#2$rangle$


                  and then have <e,t> in your document.



                  EDIT



                  To allow for nesting you should explicitly typeset the comma in textrm:



                  documentclassarticle

                  def<#1,#2>$langle$textit#1textrm, textit#2$rangle$

                  begindocument
                  <e, t>

                  <<e,t>,<e,t>>
                  enddocument






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 29 mins ago

























                  answered 46 mins ago









                  Andrew

                  28.1k34075




                  28.1k34075



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f456047%2fmake-commas-not-italicized-inside-a-macro-using-textit%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      Long meetings (6-7 hours a day): Being “babysat” by supervisor

                      Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                      Confectionery