Use text font for punctuations in xelatex with unicode-math
Suppose I have the following declarations in the preamble
usepackage[utf8]{inputenc}
usepackage{unicode-math}
setmathfont{My Best Math Font}
setmainfont{My Best Font}
and then some texts like so in the document:
$X, Y$ vs. $X$, $Y$
the commas within math and non-math environments will be different.
Is there anyway to make the math environment to use My Best Font
for punctuations?
Thanks!
fonts xetex fontspec punctuation unicode-math
add a comment |
Suppose I have the following declarations in the preamble
usepackage[utf8]{inputenc}
usepackage{unicode-math}
setmathfont{My Best Math Font}
setmainfont{My Best Font}
and then some texts like so in the document:
$X, Y$ vs. $X$, $Y$
the commas within math and non-math environments will be different.
Is there anyway to make the math environment to use My Best Font
for punctuations?
Thanks!
fonts xetex fontspec punctuation unicode-math
Personally I don't think you should do that. Assume that your main font is Helvetica and your math font is Computer Modern Serif. It is easy to see the difference then. Doing like so will make your document inconsistent.
– JouleV
Mar 11 at 12:51
@JouleV Essentially I don't have the math font for the text font I'm using, but they are really very close. So I just want the punctuations to match better.
– QcH
Mar 11 at 12:57
add a comment |
Suppose I have the following declarations in the preamble
usepackage[utf8]{inputenc}
usepackage{unicode-math}
setmathfont{My Best Math Font}
setmainfont{My Best Font}
and then some texts like so in the document:
$X, Y$ vs. $X$, $Y$
the commas within math and non-math environments will be different.
Is there anyway to make the math environment to use My Best Font
for punctuations?
Thanks!
fonts xetex fontspec punctuation unicode-math
Suppose I have the following declarations in the preamble
usepackage[utf8]{inputenc}
usepackage{unicode-math}
setmathfont{My Best Math Font}
setmainfont{My Best Font}
and then some texts like so in the document:
$X, Y$ vs. $X$, $Y$
the commas within math and non-math environments will be different.
Is there anyway to make the math environment to use My Best Font
for punctuations?
Thanks!
fonts xetex fontspec punctuation unicode-math
fonts xetex fontspec punctuation unicode-math
asked Mar 11 at 12:45
QcHQcH
1053
1053
Personally I don't think you should do that. Assume that your main font is Helvetica and your math font is Computer Modern Serif. It is easy to see the difference then. Doing like so will make your document inconsistent.
– JouleV
Mar 11 at 12:51
@JouleV Essentially I don't have the math font for the text font I'm using, but they are really very close. So I just want the punctuations to match better.
– QcH
Mar 11 at 12:57
add a comment |
Personally I don't think you should do that. Assume that your main font is Helvetica and your math font is Computer Modern Serif. It is easy to see the difference then. Doing like so will make your document inconsistent.
– JouleV
Mar 11 at 12:51
@JouleV Essentially I don't have the math font for the text font I'm using, but they are really very close. So I just want the punctuations to match better.
– QcH
Mar 11 at 12:57
Personally I don't think you should do that. Assume that your main font is Helvetica and your math font is Computer Modern Serif. It is easy to see the difference then. Doing like so will make your document inconsistent.
– JouleV
Mar 11 at 12:51
Personally I don't think you should do that. Assume that your main font is Helvetica and your math font is Computer Modern Serif. It is easy to see the difference then. Doing like so will make your document inconsistent.
– JouleV
Mar 11 at 12:51
@JouleV Essentially I don't have the math font for the text font I'm using, but they are really very close. So I just want the punctuations to match better.
– QcH
Mar 11 at 12:57
@JouleV Essentially I don't have the math font for the text font I'm using, but they are really very close. So I just want the punctuations to match better.
– QcH
Mar 11 at 12:57
add a comment |
1 Answer
1
active
oldest
votes
You can use the range option to exchange chars.
documentclass{article}
usepackage{unicode-math}
setmathfont{Fira Math}
setmainfont{TeX Gyre Termes}
begin{document}
$X, Y $ X, Y
%should go in the preamble, in the body only for the example
setmathfont[range={44}]{TeX Gyre Termes}
setmathfont[range=int]{Fira Math}
$X, Y $ X, Y
end{document}
Thanks a lot! It seems like the solution only works when the text font I use also supports unicode math. But it's not the case (which is the reason why I have to use a different font). Is there any work around?
– QcH
Mar 11 at 13:27
1
What do you mean? TeX Gyre Termes in my example is normal text font.
– Ulrike Fischer
Mar 11 at 13:31
My bad. For some reason, when I do ``` setmathfont[ Extension={.otf}, range={44}, Path=./Stix2/ ]{STIX2Text-Regular} ``` it doesn't use the font from Stix2 but from the default math font I set.
– QcH
Mar 11 at 16:01
Now I understand. I had another setmainfont later on, which is only for version=bold, but somehow it undoes the effect of this range setting. If I load otf fonts from local folder using setmathfont, is it possible to have different versions for bold/etc. along with the range setting like above? I mimic the syntax of setmainfont but xelatex always complains that font cannot be found.
– QcH
Mar 11 at 16:25
If you have new question, don't do it in the comment. Ask a new question. And show a real minimal example.
– Ulrike Fischer
Mar 11 at 16:27
|
show 1 more comment
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
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478887%2fuse-text-font-for-punctuations-in-xelatex-with-unicode-math%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use the range option to exchange chars.
documentclass{article}
usepackage{unicode-math}
setmathfont{Fira Math}
setmainfont{TeX Gyre Termes}
begin{document}
$X, Y $ X, Y
%should go in the preamble, in the body only for the example
setmathfont[range={44}]{TeX Gyre Termes}
setmathfont[range=int]{Fira Math}
$X, Y $ X, Y
end{document}
Thanks a lot! It seems like the solution only works when the text font I use also supports unicode math. But it's not the case (which is the reason why I have to use a different font). Is there any work around?
– QcH
Mar 11 at 13:27
1
What do you mean? TeX Gyre Termes in my example is normal text font.
– Ulrike Fischer
Mar 11 at 13:31
My bad. For some reason, when I do ``` setmathfont[ Extension={.otf}, range={44}, Path=./Stix2/ ]{STIX2Text-Regular} ``` it doesn't use the font from Stix2 but from the default math font I set.
– QcH
Mar 11 at 16:01
Now I understand. I had another setmainfont later on, which is only for version=bold, but somehow it undoes the effect of this range setting. If I load otf fonts from local folder using setmathfont, is it possible to have different versions for bold/etc. along with the range setting like above? I mimic the syntax of setmainfont but xelatex always complains that font cannot be found.
– QcH
Mar 11 at 16:25
If you have new question, don't do it in the comment. Ask a new question. And show a real minimal example.
– Ulrike Fischer
Mar 11 at 16:27
|
show 1 more comment
You can use the range option to exchange chars.
documentclass{article}
usepackage{unicode-math}
setmathfont{Fira Math}
setmainfont{TeX Gyre Termes}
begin{document}
$X, Y $ X, Y
%should go in the preamble, in the body only for the example
setmathfont[range={44}]{TeX Gyre Termes}
setmathfont[range=int]{Fira Math}
$X, Y $ X, Y
end{document}
Thanks a lot! It seems like the solution only works when the text font I use also supports unicode math. But it's not the case (which is the reason why I have to use a different font). Is there any work around?
– QcH
Mar 11 at 13:27
1
What do you mean? TeX Gyre Termes in my example is normal text font.
– Ulrike Fischer
Mar 11 at 13:31
My bad. For some reason, when I do ``` setmathfont[ Extension={.otf}, range={44}, Path=./Stix2/ ]{STIX2Text-Regular} ``` it doesn't use the font from Stix2 but from the default math font I set.
– QcH
Mar 11 at 16:01
Now I understand. I had another setmainfont later on, which is only for version=bold, but somehow it undoes the effect of this range setting. If I load otf fonts from local folder using setmathfont, is it possible to have different versions for bold/etc. along with the range setting like above? I mimic the syntax of setmainfont but xelatex always complains that font cannot be found.
– QcH
Mar 11 at 16:25
If you have new question, don't do it in the comment. Ask a new question. And show a real minimal example.
– Ulrike Fischer
Mar 11 at 16:27
|
show 1 more comment
You can use the range option to exchange chars.
documentclass{article}
usepackage{unicode-math}
setmathfont{Fira Math}
setmainfont{TeX Gyre Termes}
begin{document}
$X, Y $ X, Y
%should go in the preamble, in the body only for the example
setmathfont[range={44}]{TeX Gyre Termes}
setmathfont[range=int]{Fira Math}
$X, Y $ X, Y
end{document}
You can use the range option to exchange chars.
documentclass{article}
usepackage{unicode-math}
setmathfont{Fira Math}
setmainfont{TeX Gyre Termes}
begin{document}
$X, Y $ X, Y
%should go in the preamble, in the body only for the example
setmathfont[range={44}]{TeX Gyre Termes}
setmathfont[range=int]{Fira Math}
$X, Y $ X, Y
end{document}
answered Mar 11 at 13:04
Ulrike FischerUlrike Fischer
196k8302689
196k8302689
Thanks a lot! It seems like the solution only works when the text font I use also supports unicode math. But it's not the case (which is the reason why I have to use a different font). Is there any work around?
– QcH
Mar 11 at 13:27
1
What do you mean? TeX Gyre Termes in my example is normal text font.
– Ulrike Fischer
Mar 11 at 13:31
My bad. For some reason, when I do ``` setmathfont[ Extension={.otf}, range={44}, Path=./Stix2/ ]{STIX2Text-Regular} ``` it doesn't use the font from Stix2 but from the default math font I set.
– QcH
Mar 11 at 16:01
Now I understand. I had another setmainfont later on, which is only for version=bold, but somehow it undoes the effect of this range setting. If I load otf fonts from local folder using setmathfont, is it possible to have different versions for bold/etc. along with the range setting like above? I mimic the syntax of setmainfont but xelatex always complains that font cannot be found.
– QcH
Mar 11 at 16:25
If you have new question, don't do it in the comment. Ask a new question. And show a real minimal example.
– Ulrike Fischer
Mar 11 at 16:27
|
show 1 more comment
Thanks a lot! It seems like the solution only works when the text font I use also supports unicode math. But it's not the case (which is the reason why I have to use a different font). Is there any work around?
– QcH
Mar 11 at 13:27
1
What do you mean? TeX Gyre Termes in my example is normal text font.
– Ulrike Fischer
Mar 11 at 13:31
My bad. For some reason, when I do ``` setmathfont[ Extension={.otf}, range={44}, Path=./Stix2/ ]{STIX2Text-Regular} ``` it doesn't use the font from Stix2 but from the default math font I set.
– QcH
Mar 11 at 16:01
Now I understand. I had another setmainfont later on, which is only for version=bold, but somehow it undoes the effect of this range setting. If I load otf fonts from local folder using setmathfont, is it possible to have different versions for bold/etc. along with the range setting like above? I mimic the syntax of setmainfont but xelatex always complains that font cannot be found.
– QcH
Mar 11 at 16:25
If you have new question, don't do it in the comment. Ask a new question. And show a real minimal example.
– Ulrike Fischer
Mar 11 at 16:27
Thanks a lot! It seems like the solution only works when the text font I use also supports unicode math. But it's not the case (which is the reason why I have to use a different font). Is there any work around?
– QcH
Mar 11 at 13:27
Thanks a lot! It seems like the solution only works when the text font I use also supports unicode math. But it's not the case (which is the reason why I have to use a different font). Is there any work around?
– QcH
Mar 11 at 13:27
1
1
What do you mean? TeX Gyre Termes in my example is normal text font.
– Ulrike Fischer
Mar 11 at 13:31
What do you mean? TeX Gyre Termes in my example is normal text font.
– Ulrike Fischer
Mar 11 at 13:31
My bad. For some reason, when I do ``` setmathfont[ Extension={.otf}, range={44}, Path=./Stix2/ ]{STIX2Text-Regular} ``` it doesn't use the font from Stix2 but from the default math font I set.
– QcH
Mar 11 at 16:01
My bad. For some reason, when I do ``` setmathfont[ Extension={.otf}, range={44}, Path=./Stix2/ ]{STIX2Text-Regular} ``` it doesn't use the font from Stix2 but from the default math font I set.
– QcH
Mar 11 at 16:01
Now I understand. I had another setmainfont later on, which is only for version=bold, but somehow it undoes the effect of this range setting. If I load otf fonts from local folder using setmathfont, is it possible to have different versions for bold/etc. along with the range setting like above? I mimic the syntax of setmainfont but xelatex always complains that font cannot be found.
– QcH
Mar 11 at 16:25
Now I understand. I had another setmainfont later on, which is only for version=bold, but somehow it undoes the effect of this range setting. If I load otf fonts from local folder using setmathfont, is it possible to have different versions for bold/etc. along with the range setting like above? I mimic the syntax of setmainfont but xelatex always complains that font cannot be found.
– QcH
Mar 11 at 16:25
If you have new question, don't do it in the comment. Ask a new question. And show a real minimal example.
– Ulrike Fischer
Mar 11 at 16:27
If you have new question, don't do it in the comment. Ask a new question. And show a real minimal example.
– Ulrike Fischer
Mar 11 at 16:27
|
show 1 more comment
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.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f478887%2fuse-text-font-for-punctuations-in-xelatex-with-unicode-math%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
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
Personally I don't think you should do that. Assume that your main font is Helvetica and your math font is Computer Modern Serif. It is easy to see the difference then. Doing like so will make your document inconsistent.
– JouleV
Mar 11 at 12:51
@JouleV Essentially I don't have the math font for the text font I'm using, but they are really very close. So I just want the punctuations to match better.
– QcH
Mar 11 at 12:57