font families side by side
up vote
0
down vote
favorite
for sure nothing that not has been answered already but i can't find it.
How to get roman and sansserif fonts in one document?
I need the LATEX Roman while my document is sans serif.
documentclass[11pt]{article}
usepackage{fontspec}
setromanfont{Times-Roman}
setmonofont{FiraMono-Regular.otf}
setmainfont{FiraSans}[
Ligatures=TeX,
Path = /Users/novski/Library/Fonts/,
BoldFont = *-Regular,
BoldItalicFont = *-Italic,
ItalicFont = *-Italic,
UprightFont = *-UltraLight,
]
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt} \ [4mm]
Large{textsc{this Document is Typset with}} \ [3mm]
textrm{ Huge{LaTeX{}} }\ [1mm]
noindentrule{textwidth}{1pt}\
vspace*{fill}
end{center}
end{document}

fonts fontspec
add a comment |
up vote
0
down vote
favorite
for sure nothing that not has been answered already but i can't find it.
How to get roman and sansserif fonts in one document?
I need the LATEX Roman while my document is sans serif.
documentclass[11pt]{article}
usepackage{fontspec}
setromanfont{Times-Roman}
setmonofont{FiraMono-Regular.otf}
setmainfont{FiraSans}[
Ligatures=TeX,
Path = /Users/novski/Library/Fonts/,
BoldFont = *-Regular,
BoldItalicFont = *-Italic,
ItalicFont = *-Italic,
UprightFont = *-UltraLight,
]
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt} \ [4mm]
Large{textsc{this Document is Typset with}} \ [3mm]
textrm{ Huge{LaTeX{}} }\ [1mm]
noindentrule{textwidth}{1pt}\
vspace*{fill}
end{center}
end{document}

fonts fontspec
I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
– novski
Sep 19 at 19:04
{setmainfont{Times-Roman}LaTeX}?
– TeXnician
Sep 19 at 19:26
This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
– novski
Sep 20 at 4:49
Becausesetromanfontis the outdated equivalent ofsetmainfontand you override your roman font by making Fira Sans the main font. Alternatively you can donewfontfamilymyfont{Times-Roman}in the preamble and do{myfontLaTeX}.
– TeXnician
Sep 20 at 6:02
doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
– novski
Sep 20 at 6:04
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
for sure nothing that not has been answered already but i can't find it.
How to get roman and sansserif fonts in one document?
I need the LATEX Roman while my document is sans serif.
documentclass[11pt]{article}
usepackage{fontspec}
setromanfont{Times-Roman}
setmonofont{FiraMono-Regular.otf}
setmainfont{FiraSans}[
Ligatures=TeX,
Path = /Users/novski/Library/Fonts/,
BoldFont = *-Regular,
BoldItalicFont = *-Italic,
ItalicFont = *-Italic,
UprightFont = *-UltraLight,
]
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt} \ [4mm]
Large{textsc{this Document is Typset with}} \ [3mm]
textrm{ Huge{LaTeX{}} }\ [1mm]
noindentrule{textwidth}{1pt}\
vspace*{fill}
end{center}
end{document}

fonts fontspec
for sure nothing that not has been answered already but i can't find it.
How to get roman and sansserif fonts in one document?
I need the LATEX Roman while my document is sans serif.
documentclass[11pt]{article}
usepackage{fontspec}
setromanfont{Times-Roman}
setmonofont{FiraMono-Regular.otf}
setmainfont{FiraSans}[
Ligatures=TeX,
Path = /Users/novski/Library/Fonts/,
BoldFont = *-Regular,
BoldItalicFont = *-Italic,
ItalicFont = *-Italic,
UprightFont = *-UltraLight,
]
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt} \ [4mm]
Large{textsc{this Document is Typset with}} \ [3mm]
textrm{ Huge{LaTeX{}} }\ [1mm]
noindentrule{textwidth}{1pt}\
vspace*{fill}
end{center}
end{document}

fonts fontspec
fonts fontspec
asked Sep 19 at 17:02
novski
48039
48039
I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
– novski
Sep 19 at 19:04
{setmainfont{Times-Roman}LaTeX}?
– TeXnician
Sep 19 at 19:26
This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
– novski
Sep 20 at 4:49
Becausesetromanfontis the outdated equivalent ofsetmainfontand you override your roman font by making Fira Sans the main font. Alternatively you can donewfontfamilymyfont{Times-Roman}in the preamble and do{myfontLaTeX}.
– TeXnician
Sep 20 at 6:02
doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
– novski
Sep 20 at 6:04
add a comment |
I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
– novski
Sep 19 at 19:04
{setmainfont{Times-Roman}LaTeX}?
– TeXnician
Sep 19 at 19:26
This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
– novski
Sep 20 at 4:49
Becausesetromanfontis the outdated equivalent ofsetmainfontand you override your roman font by making Fira Sans the main font. Alternatively you can donewfontfamilymyfont{Times-Roman}in the preamble and do{myfontLaTeX}.
– TeXnician
Sep 20 at 6:02
doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
– novski
Sep 20 at 6:04
I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
– novski
Sep 19 at 19:04
I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
– novski
Sep 19 at 19:04
{setmainfont{Times-Roman}LaTeX}?– TeXnician
Sep 19 at 19:26
{setmainfont{Times-Roman}LaTeX}?– TeXnician
Sep 19 at 19:26
This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
– novski
Sep 20 at 4:49
This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
– novski
Sep 20 at 4:49
Because
setromanfont is the outdated equivalent of setmainfont and you override your roman font by making Fira Sans the main font. Alternatively you can do newfontfamilymyfont{Times-Roman} in the preamble and do {myfontLaTeX}.– TeXnician
Sep 20 at 6:02
Because
setromanfont is the outdated equivalent of setmainfont and you override your roman font by making Fira Sans the main font. Alternatively you can do newfontfamilymyfont{Times-Roman} in the preamble and do {myfontLaTeX}.– TeXnician
Sep 20 at 6:02
doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
– novski
Sep 20 at 6:04
doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
– novski
Sep 20 at 6:04
add a comment |
3 Answers
3
active
oldest
votes
up vote
5
down vote
accepted
Okay, so let's start with a few problems in your code:
- You set
setromanfontandsetmainfontwhere the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman. - You use size commands like
Hugeas if they were commands with arguments. Either use them properly in groups ({Huge Test}) or useDeclareTextFontCommand{textHuge}{Huge}and thentextHuge{Text}. - Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.
Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.
Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.
For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.

documentclass[11pt]{article}
usepackage{fontspec}
setmainfont{Fira Sans}
setsansfont{Libertinus Serif}
setmonofont{Fira Mono}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largetextsc{This Document is typeset with}par}
{HugesffamilyLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
add a comment |
up vote
2
down vote
One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).
You can then declare the new commands
newcommandseriffamily{libertine}
DeclareTextFontCommandtextserif{seriffamily}
Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.
+1, unfortunately the OP does not like the solution (see here).
– TeXnician
Sep 21 at 7:14
@TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's whatseriffamilyandtextseriflet you do! Besides, you can always declare the family yourself withnewfontfamilyor use a documented package interface.
– Davislor
Sep 21 at 18:17
I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
– TeXnician
Sep 21 at 19:55
@TeXnician If the OP wants that, the right approach might be to stick a bunch ofsffamilyandrmfamilycommands all over the place.
– Davislor
Sep 21 at 20:03
That's what I suggested in my answer ;)
– TeXnician
Sep 21 at 20:43
|
show 1 more comment
up vote
1
down vote
I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.
To achieve this, you redefine the command from where you want to apply it:
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}
You can as easily revert this back to normal by doing:
letLaTeXmyLaTeX
after the LaTeX you need to typeset occurs.
so the following:
% .... %
vspace*{2mm}
letmyLaTeXLaTeX % <- Copy LaTeX here
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
{Largemdseriestextsc{The logo with Computer Modern:}par}
{HugeLaTeXpar}
letLaTeXmyLaTeX % <- Revert changes
{Largemdseriestextsc{The logo with default font:}par}
{HugeLaTeXpar}
vspace*{2mm}
% .... %
Will produce something like this:

Explanation
- The
letmyLaTeXLaTeXcommand will copyLaTeXintomyLaTeX, we do this to avoid overwriting the commandLaTeXin the next step. Think of it as "let this be the same as that"
defLaTeX{...}redefines theLaTeXcommand sequence with whatever is entered inside the brackets{...}(know as a group).
{fontfamily{cmr}rmfamilyselectfontmyLaTeX}sets the fontcmron what follows, in our case, the previouslylet(or copied) command sequencemyLaTeX. Note: I've specifically setrmfamilyhere to avoid warnings of undefined shapes in some fonts.
This can also be done with some of TeX and friends in the same way.
For the entire document
If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:
documentclass[11pt]{article}
usepackage[light, default]{sourcesanspro} % <- Using this sans serif
usepackage[T1]{fontenc}
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largemdseriestextsc{This Document is typeset with}par}
{HugeLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.
Result
To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:

And here is how it will look once you force the font for LaTeX:

Other options
If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:
For Typewriter fonts, try pcr (Courier), which looks like this:

For Sans Serif fonts, try phv (Helvet), which looks like this:

For Serif fonts, you can also try ppl (Palatino), which looks like this:

Further reading
- How to typeset every TeX related logo
- The difference between local and global scope
- Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
Okay, so let's start with a few problems in your code:
- You set
setromanfontandsetmainfontwhere the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman. - You use size commands like
Hugeas if they were commands with arguments. Either use them properly in groups ({Huge Test}) or useDeclareTextFontCommand{textHuge}{Huge}and thentextHuge{Text}. - Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.
Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.
Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.
For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.

documentclass[11pt]{article}
usepackage{fontspec}
setmainfont{Fira Sans}
setsansfont{Libertinus Serif}
setmonofont{Fira Mono}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largetextsc{This Document is typeset with}par}
{HugesffamilyLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
add a comment |
up vote
5
down vote
accepted
Okay, so let's start with a few problems in your code:
- You set
setromanfontandsetmainfontwhere the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman. - You use size commands like
Hugeas if they were commands with arguments. Either use them properly in groups ({Huge Test}) or useDeclareTextFontCommand{textHuge}{Huge}and thentextHuge{Text}. - Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.
Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.
Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.
For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.

documentclass[11pt]{article}
usepackage{fontspec}
setmainfont{Fira Sans}
setsansfont{Libertinus Serif}
setmonofont{Fira Mono}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largetextsc{This Document is typeset with}par}
{HugesffamilyLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
Okay, so let's start with a few problems in your code:
- You set
setromanfontandsetmainfontwhere the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman. - You use size commands like
Hugeas if they were commands with arguments. Either use them properly in groups ({Huge Test}) or useDeclareTextFontCommand{textHuge}{Huge}and thentextHuge{Text}. - Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.
Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.
Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.
For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.

documentclass[11pt]{article}
usepackage{fontspec}
setmainfont{Fira Sans}
setsansfont{Libertinus Serif}
setmonofont{Fira Mono}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largetextsc{This Document is typeset with}par}
{HugesffamilyLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
Okay, so let's start with a few problems in your code:
- You set
setromanfontandsetmainfontwhere the former is an outdated synonym for the latter. So basically Fira Sans overwrites Times Roman. - You use size commands like
Hugeas if they were commands with arguments. Either use them properly in groups ({Huge Test}) or useDeclareTextFontCommand{textHuge}{Huge}and thentextHuge{Text}. - Should you ever have more than one line in one of these lines with changed font size consider adding a paragraph break, so that the inter-line-spacing adjusts.
Regarding your problem: You decided to typeset your document in sans serif font. That's fine, but as you use it as main font you might want to disregard the command names and simply use your roman font family as "sans font" as you swapped meanings either way.
Then you are able to use textsf or sffamily on your example and it will work. Btw: LaTeX might not look good in fonts other than Computer/Latin Modern because of kerning issues, so if you really want to emphasize the "Typeset with LaTeX" aspect you might want to adjust the kerning to your font.
For illustration purposes, I have used the Fira fonts included in TeX Live (removed your paths) and Libertinus Serif which is also part of TeX Live.

documentclass[11pt]{article}
usepackage{fontspec}
setmainfont{Fira Sans}
setsansfont{Libertinus Serif}
setmonofont{Fira Mono}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largetextsc{This Document is typeset with}par}
{HugesffamilyLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
edited Sep 20 at 6:24
answered Sep 20 at 6:17
TeXnician
23.9k62984
23.9k62984
add a comment |
add a comment |
up vote
2
down vote
One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).
You can then declare the new commands
newcommandseriffamily{libertine}
DeclareTextFontCommandtextserif{seriffamily}
Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.
+1, unfortunately the OP does not like the solution (see here).
– TeXnician
Sep 21 at 7:14
@TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's whatseriffamilyandtextseriflet you do! Besides, you can always declare the family yourself withnewfontfamilyor use a documented package interface.
– Davislor
Sep 21 at 18:17
I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
– TeXnician
Sep 21 at 19:55
@TeXnician If the OP wants that, the right approach might be to stick a bunch ofsffamilyandrmfamilycommands all over the place.
– Davislor
Sep 21 at 20:03
That's what I suggested in my answer ;)
– TeXnician
Sep 21 at 20:43
|
show 1 more comment
up vote
2
down vote
One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).
You can then declare the new commands
newcommandseriffamily{libertine}
DeclareTextFontCommandtextserif{seriffamily}
Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.
+1, unfortunately the OP does not like the solution (see here).
– TeXnician
Sep 21 at 7:14
@TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's whatseriffamilyandtextseriflet you do! Besides, you can always declare the family yourself withnewfontfamilyor use a documented package interface.
– Davislor
Sep 21 at 18:17
I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
– TeXnician
Sep 21 at 19:55
@TeXnician If the OP wants that, the right approach might be to stick a bunch ofsffamilyandrmfamilycommands all over the place.
– Davislor
Sep 21 at 20:03
That's what I suggested in my answer ;)
– TeXnician
Sep 21 at 20:43
|
show 1 more comment
up vote
2
down vote
up vote
2
down vote
One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).
You can then declare the new commands
newcommandseriffamily{libertine}
DeclareTextFontCommandtextserif{seriffamily}
Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.
One thing you could do is to load your serif font as a named font family, say libertine, which most font packages support, then set your sans serif font as your main font (In many packages, this is the [sfdefault] package option).
You can then declare the new commands
newcommandseriffamily{libertine}
DeclareTextFontCommandtextserif{seriffamily}
Thus allows you to write seriffamily in place of rmfamily and textserif{...} in place of textrm{...}.
answered Sep 20 at 20:21
Davislor
4,272821
4,272821
+1, unfortunately the OP does not like the solution (see here).
– TeXnician
Sep 21 at 7:14
@TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's whatseriffamilyandtextseriflet you do! Besides, you can always declare the family yourself withnewfontfamilyor use a documented package interface.
– Davislor
Sep 21 at 18:17
I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
– TeXnician
Sep 21 at 19:55
@TeXnician If the OP wants that, the right approach might be to stick a bunch ofsffamilyandrmfamilycommands all over the place.
– Davislor
Sep 21 at 20:03
That's what I suggested in my answer ;)
– TeXnician
Sep 21 at 20:43
|
show 1 more comment
+1, unfortunately the OP does not like the solution (see here).
– TeXnician
Sep 21 at 7:14
@TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's whatseriffamilyandtextseriflet you do! Besides, you can always declare the family yourself withnewfontfamilyor use a documented package interface.
– Davislor
Sep 21 at 18:17
I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
– TeXnician
Sep 21 at 19:55
@TeXnician If the OP wants that, the right approach might be to stick a bunch ofsffamilyandrmfamilycommands all over the place.
– Davislor
Sep 21 at 20:03
That's what I suggested in my answer ;)
– TeXnician
Sep 21 at 20:43
+1, unfortunately the OP does not like the solution (see here).
– TeXnician
Sep 21 at 7:14
+1, unfortunately the OP does not like the solution (see here).
– TeXnician
Sep 21 at 7:14
@TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's what
seriffamily and textserif let you do! Besides, you can always declare the family yourself with newfontfamily or use a documented package interface.– Davislor
Sep 21 at 18:17
@TeXnician I think the objection is that it makes it hard to change the font, because it depends on a family name. But that's what
seriffamily and textserif let you do! Besides, you can always declare the family yourself with newfontfamily or use a documented package interface.– Davislor
Sep 21 at 18:17
I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
– TeXnician
Sep 21 at 19:55
I think the objection was that it is not possible to simply copy the code to another document irrespective of possible settings in the preamble. But as I said, I second your solution (that's why I wrote +1) and leave it to the OP what he wants to do.
– TeXnician
Sep 21 at 19:55
@TeXnician If the OP wants that, the right approach might be to stick a bunch of
sffamily and rmfamily commands all over the place.– Davislor
Sep 21 at 20:03
@TeXnician If the OP wants that, the right approach might be to stick a bunch of
sffamily and rmfamily commands all over the place.– Davislor
Sep 21 at 20:03
That's what I suggested in my answer ;)
– TeXnician
Sep 21 at 20:43
That's what I suggested in my answer ;)
– TeXnician
Sep 21 at 20:43
|
show 1 more comment
up vote
1
down vote
I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.
To achieve this, you redefine the command from where you want to apply it:
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}
You can as easily revert this back to normal by doing:
letLaTeXmyLaTeX
after the LaTeX you need to typeset occurs.
so the following:
% .... %
vspace*{2mm}
letmyLaTeXLaTeX % <- Copy LaTeX here
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
{Largemdseriestextsc{The logo with Computer Modern:}par}
{HugeLaTeXpar}
letLaTeXmyLaTeX % <- Revert changes
{Largemdseriestextsc{The logo with default font:}par}
{HugeLaTeXpar}
vspace*{2mm}
% .... %
Will produce something like this:

Explanation
- The
letmyLaTeXLaTeXcommand will copyLaTeXintomyLaTeX, we do this to avoid overwriting the commandLaTeXin the next step. Think of it as "let this be the same as that"
defLaTeX{...}redefines theLaTeXcommand sequence with whatever is entered inside the brackets{...}(know as a group).
{fontfamily{cmr}rmfamilyselectfontmyLaTeX}sets the fontcmron what follows, in our case, the previouslylet(or copied) command sequencemyLaTeX. Note: I've specifically setrmfamilyhere to avoid warnings of undefined shapes in some fonts.
This can also be done with some of TeX and friends in the same way.
For the entire document
If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:
documentclass[11pt]{article}
usepackage[light, default]{sourcesanspro} % <- Using this sans serif
usepackage[T1]{fontenc}
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largemdseriestextsc{This Document is typeset with}par}
{HugeLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.
Result
To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:

And here is how it will look once you force the font for LaTeX:

Other options
If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:
For Typewriter fonts, try pcr (Courier), which looks like this:

For Sans Serif fonts, try phv (Helvet), which looks like this:

For Serif fonts, you can also try ppl (Palatino), which looks like this:

Further reading
- How to typeset every TeX related logo
- The difference between local and global scope
- Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)
add a comment |
up vote
1
down vote
I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.
To achieve this, you redefine the command from where you want to apply it:
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}
You can as easily revert this back to normal by doing:
letLaTeXmyLaTeX
after the LaTeX you need to typeset occurs.
so the following:
% .... %
vspace*{2mm}
letmyLaTeXLaTeX % <- Copy LaTeX here
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
{Largemdseriestextsc{The logo with Computer Modern:}par}
{HugeLaTeXpar}
letLaTeXmyLaTeX % <- Revert changes
{Largemdseriestextsc{The logo with default font:}par}
{HugeLaTeXpar}
vspace*{2mm}
% .... %
Will produce something like this:

Explanation
- The
letmyLaTeXLaTeXcommand will copyLaTeXintomyLaTeX, we do this to avoid overwriting the commandLaTeXin the next step. Think of it as "let this be the same as that"
defLaTeX{...}redefines theLaTeXcommand sequence with whatever is entered inside the brackets{...}(know as a group).
{fontfamily{cmr}rmfamilyselectfontmyLaTeX}sets the fontcmron what follows, in our case, the previouslylet(or copied) command sequencemyLaTeX. Note: I've specifically setrmfamilyhere to avoid warnings of undefined shapes in some fonts.
This can also be done with some of TeX and friends in the same way.
For the entire document
If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:
documentclass[11pt]{article}
usepackage[light, default]{sourcesanspro} % <- Using this sans serif
usepackage[T1]{fontenc}
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largemdseriestextsc{This Document is typeset with}par}
{HugeLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.
Result
To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:

And here is how it will look once you force the font for LaTeX:

Other options
If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:
For Typewriter fonts, try pcr (Courier), which looks like this:

For Sans Serif fonts, try phv (Helvet), which looks like this:

For Serif fonts, you can also try ppl (Palatino), which looks like this:

Further reading
- How to typeset every TeX related logo
- The difference between local and global scope
- Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)
add a comment |
up vote
1
down vote
up vote
1
down vote
I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.
To achieve this, you redefine the command from where you want to apply it:
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}
You can as easily revert this back to normal by doing:
letLaTeXmyLaTeX
after the LaTeX you need to typeset occurs.
so the following:
% .... %
vspace*{2mm}
letmyLaTeXLaTeX % <- Copy LaTeX here
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
{Largemdseriestextsc{The logo with Computer Modern:}par}
{HugeLaTeXpar}
letLaTeXmyLaTeX % <- Revert changes
{Largemdseriestextsc{The logo with default font:}par}
{HugeLaTeXpar}
vspace*{2mm}
% .... %
Will produce something like this:

Explanation
- The
letmyLaTeXLaTeXcommand will copyLaTeXintomyLaTeX, we do this to avoid overwriting the commandLaTeXin the next step. Think of it as "let this be the same as that"
defLaTeX{...}redefines theLaTeXcommand sequence with whatever is entered inside the brackets{...}(know as a group).
{fontfamily{cmr}rmfamilyselectfontmyLaTeX}sets the fontcmron what follows, in our case, the previouslylet(or copied) command sequencemyLaTeX. Note: I've specifically setrmfamilyhere to avoid warnings of undefined shapes in some fonts.
This can also be done with some of TeX and friends in the same way.
For the entire document
If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:
documentclass[11pt]{article}
usepackage[light, default]{sourcesanspro} % <- Using this sans serif
usepackage[T1]{fontenc}
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largemdseriestextsc{This Document is typeset with}par}
{HugeLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.
Result
To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:

And here is how it will look once you force the font for LaTeX:

Other options
If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:
For Typewriter fonts, try pcr (Courier), which looks like this:

For Sans Serif fonts, try phv (Helvet), which looks like this:

For Serif fonts, you can also try ppl (Palatino), which looks like this:

Further reading
- How to typeset every TeX related logo
- The difference between local and global scope
- Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)
I'm a bit late to the party, but if you just want to make sure the LaTeX command expands correctly without kerning adjustments (which you can do with the metafont package), you can force the command to use the Computer Modern font family.
To achieve this, you redefine the command from where you want to apply it:
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX}
You can as easily revert this back to normal by doing:
letLaTeXmyLaTeX
after the LaTeX you need to typeset occurs.
so the following:
% .... %
vspace*{2mm}
letmyLaTeXLaTeX % <- Copy LaTeX here
defLaTeX{fontfamily{cmr}rmfamilyselectfontmyLaTeX} % <- Redefine here
{Largemdseriestextsc{The logo with Computer Modern:}par}
{HugeLaTeXpar}
letLaTeXmyLaTeX % <- Revert changes
{Largemdseriestextsc{The logo with default font:}par}
{HugeLaTeXpar}
vspace*{2mm}
% .... %
Will produce something like this:

Explanation
- The
letmyLaTeXLaTeXcommand will copyLaTeXintomyLaTeX, we do this to avoid overwriting the commandLaTeXin the next step. Think of it as "let this be the same as that"
defLaTeX{...}redefines theLaTeXcommand sequence with whatever is entered inside the brackets{...}(know as a group).
{fontfamily{cmr}rmfamilyselectfontmyLaTeX}sets the fontcmron what follows, in our case, the previouslylet(or copied) command sequencemyLaTeX. Note: I've specifically setrmfamilyhere to avoid warnings of undefined shapes in some fonts.
This can also be done with some of TeX and friends in the same way.
For the entire document
If you want to use this for every macro, you can put the definition in the preamble of your main *.tex file, as in the MWE below:
documentclass[11pt]{article}
usepackage[light, default]{sourcesanspro} % <- Using this sans serif
usepackage[T1]{fontenc}
letmyLaTeXLaTeX
defLaTeX{fontfamily{cmr}rmfamilyselectfontmy@LaTeX}
begin{document}
thispagestyle{empty}
begin{center}
vspace*{fill}
noindentrule{textwidth}{1pt}par
vspace*{2mm}
{Largemdseriestextsc{This Document is typeset with}par}
{HugeLaTeXpar}
vspace*{2mm}
noindentrule{textwidth}{1pt}par
vspace*{fill}
end{center}
end{document}
I generally recommend doing this over making inline changes to fonts. And since LaTeX traditionally is typeset with roman font, I think it should be eaten as intended. Even so, I've added a few options further down.
Result
To illustrate how this works, I use the Source Sans Pro font family as the document font (like I did in the example above). This font does not expand LaTeX well (in my opinion), as shown below:

And here is how it will look once you force the font for LaTeX:

Other options
If you want to use the same font type for consistency, you can use a font that LaTeX expands well with:
For Typewriter fonts, try pcr (Courier), which looks like this:

For Sans Serif fonts, try phv (Helvet), which looks like this:

For Serif fonts, you can also try ppl (Palatino), which looks like this:

Further reading
- How to typeset every TeX related logo
- The difference between local and global scope
- Changing the font of specific words or paragraphs (LaTeX), (XeLaTeX & LuaTeX)
answered 3 hours ago
Ole Anders
326112
326112
add a comment |
add a 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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f451572%2ffont-families-side-by-side%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
I should have mentioned that i have a full document that i like to be set in sans serif. This is the last page of that document...
– novski
Sep 19 at 19:04
{setmainfont{Times-Roman}LaTeX}?– TeXnician
Sep 19 at 19:26
This works. Can you explain why the font set by 'setromanfont{Times-Roman}' can not be called? To set the main font seams to me as a workaround but not a solution. I wold expect to call the special font and leave the main font for the document untouched...
– novski
Sep 20 at 4:49
Because
setromanfontis the outdated equivalent ofsetmainfontand you override your roman font by making Fira Sans the main font. Alternatively you can donewfontfamilymyfont{Times-Roman}in the preamble and do{myfontLaTeX}.– TeXnician
Sep 20 at 6:02
doesn't that mean that i can not exchange this part of text because its depending on a self declared fontname 'myfont' that somebody else needs to declare first? Is it possible to make that exchangeable?
– novski
Sep 20 at 6:04