Make commas not italicized inside a macro using textit
Clash 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:
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:
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:
italic
add a comment |Â
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:
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:
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:
italic
1
it seems logically wrong to use the text face here, fortextit
will pick up tje current text style eg bold, you seem to be just useing the deprecatedtimes
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
add a comment |Â
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:
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:
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:
italic
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:
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:
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:
italic
italic
edited 45 mins ago
asked 1 hour ago
Jigsaw
1136
1136
1
it seems logically wrong to use the text face here, fortextit
will pick up tje current text style eg bold, you seem to be just useing the deprecatedtimes
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
add a comment |Â
1
it seems logically wrong to use the text face here, fortextit
will pick up tje current text style eg bold, you seem to be just useing the deprecatedtimes
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
add a comment |Â
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
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
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
add a comment |Â
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:
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
add a comment |Â
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
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
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
add a comment |Â
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
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
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
add a comment |Â
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
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
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
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
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
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
edited 15 mins ago
answered 29 mins ago
egreg
690k8518383086
690k8518383086
add a comment |Â
add a comment |Â
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:
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
add a comment |Â
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:
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
add a comment |Â
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:
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
How about using:
documentclassarticle
deftype<#1,#2>$langle$textit#1, textit#2$rangle$
begindocument
type<e, t>
enddocument
to produce:
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
edited 29 mins ago
answered 46 mins ago
Andrew
28.1k34075
28.1k34075
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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 deprecatedtimes
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