How to change the font style (not the size but the style) of algorithimc packageHow do I change the standard...
Character is called by their first initial. How do I write it?
Does the Intel 8086 CPU have user mode and kernel mode?
Word for showing a small part of something briefly to hint to its existence or beauty without fully uncovering it
How can I prevent corporations from growing their own workforce?
Is a fighting a fallen friend with the help of a redeemed villain story too much for one book
Why are all my history books dividing Chinese history after the Han dynasty?
Is there a reason why I should not use the HaveIBeenPwned API to warn users about exposed passwords?
Why didn't Britain or any other European power colonise Abyssinia/Ethiopia before 1936?
What is "I bet" in German?
Expansion with *.txt in the shell doesn't work if no .txt file exists
How to avoid unconsciously copying the style of my favorite writer?
The Sword in the Stone
Trapped in an ocean Temple in Minecraft?
Can the 2019 UA Artificer's Returning Weapon and Radiant Weapon infusions stack on the same weapon?
Can two figures have the same area, perimeter, and same number of segments have different shape?
Request for a Latin phrase as motto "God is highest/supreme"
Giant space birds hatching out of planets; short story
How to deal with a player who makes bad characters and kills them?
How to handle a player that cannot be convinced his actions are a problem for both GM and party
Explain why watch 'jobs' does not work but watch 'ps' work?
Is it normal practice to screen share with a client?
Did the IBM PC use the 8088's NMI line?
At what rate does the volume (velocity) of a note decay?
What is AM-CM inequality?
How to change the font style (not the size but the style) of algorithimc package
How do I change the standard “math font”?Change font size in arabtex packageAll ttfamily font change font sizeUnderbar changing the style of font but bar not, why?Font Size and Font StyleHow to change font style of all algorithm/algpseudocode keywords?Change font size with fontspec packageChange texttt font-sizeWho changed my Chinese character?How recognize and change to unknown font?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I would like to change the font of the algorithm package. It's currently using serif and I would like to try either sans serif or typewritter font. I have tried to use the following code (which I adapted from this link) by simply using the ttdefault
at line 5 but it does not work. How can I achieve my aim?
documentclass{article}
usepackage{algpseudocode,algorithm}
makeatletter
algrenewcommandALG@beginalgorithmic{ttdefault}
makeatother
begin{document}
begin{algorithm}
caption{Euclid’s algorithm}label{euclid}
begin{algorithmic}[1]
Procedure{Euclid}{$a,b$}Comment{The g.c.d. of $a$ and $b$}
State $r gets a bmod b$
While{$r not= 0$}Comment{We have the answer if $r$ is 0}
State $a gets b$
State $b gets r$
State $r gets a bmod b$
EndWhilelabel{euclidendwhile}
State textbf{return} $b$Comment{The gcd is $b$}
EndProcedure
end{algorithmic}
end{algorithm}
end{document}
fonts algorithms typewriter sans-serif
add a comment |
I would like to change the font of the algorithm package. It's currently using serif and I would like to try either sans serif or typewritter font. I have tried to use the following code (which I adapted from this link) by simply using the ttdefault
at line 5 but it does not work. How can I achieve my aim?
documentclass{article}
usepackage{algpseudocode,algorithm}
makeatletter
algrenewcommandALG@beginalgorithmic{ttdefault}
makeatother
begin{document}
begin{algorithm}
caption{Euclid’s algorithm}label{euclid}
begin{algorithmic}[1]
Procedure{Euclid}{$a,b$}Comment{The g.c.d. of $a$ and $b$}
State $r gets a bmod b$
While{$r not= 0$}Comment{We have the answer if $r$ is 0}
State $a gets b$
State $b gets r$
State $r gets a bmod b$
EndWhilelabel{euclidendwhile}
State textbf{return} $b$Comment{The gcd is $b$}
EndProcedure
end{algorithmic}
end{algorithm}
end{document}
fonts algorithms typewriter sans-serif
There are several packages for algorithms, and I believe they all use bold for keywords. There are very few typewriter fonts available with a matching bold, so you would most likely lose that.
– barbara beeton
9 hours ago
Hello Barbara the aim is to convert the font family witouth loosing the bold for the keyword. Look at the answer of Zarko, he provided the right solution to my problem.
– S12000
9 hours ago
Whilettfamily
as suggested by @Zarko is certainly a good solution in most ways, I've just checked thecmtt
fonts available in TeX Live. Someone has providedcmbtt
fonts in several sizes, but only from Metafont source, so they will be bitmap fonts, an won't scale well. I'd be very happy to be shown to be wrong. (I once had to provide a bold version ofcmtt
, and the only way I could do it well was to create a lighter version of the originalcmtt
and then a bolder version; that was in the days when bitmap fonts were still the standard.
– barbara beeton
8 hours ago
OK I see. In fact in my case I am using xelatex with UbuntuMono as a typewritter font and it works very fine (no scaling issues).
– S12000
7 hours ago
UbuntuMono sounds like it's designed for such things, I'm glad it works. (Since no specific font was indicated in the question, I just assumed CM.)
– barbara beeton
7 hours ago
add a comment |
I would like to change the font of the algorithm package. It's currently using serif and I would like to try either sans serif or typewritter font. I have tried to use the following code (which I adapted from this link) by simply using the ttdefault
at line 5 but it does not work. How can I achieve my aim?
documentclass{article}
usepackage{algpseudocode,algorithm}
makeatletter
algrenewcommandALG@beginalgorithmic{ttdefault}
makeatother
begin{document}
begin{algorithm}
caption{Euclid’s algorithm}label{euclid}
begin{algorithmic}[1]
Procedure{Euclid}{$a,b$}Comment{The g.c.d. of $a$ and $b$}
State $r gets a bmod b$
While{$r not= 0$}Comment{We have the answer if $r$ is 0}
State $a gets b$
State $b gets r$
State $r gets a bmod b$
EndWhilelabel{euclidendwhile}
State textbf{return} $b$Comment{The gcd is $b$}
EndProcedure
end{algorithmic}
end{algorithm}
end{document}
fonts algorithms typewriter sans-serif
I would like to change the font of the algorithm package. It's currently using serif and I would like to try either sans serif or typewritter font. I have tried to use the following code (which I adapted from this link) by simply using the ttdefault
at line 5 but it does not work. How can I achieve my aim?
documentclass{article}
usepackage{algpseudocode,algorithm}
makeatletter
algrenewcommandALG@beginalgorithmic{ttdefault}
makeatother
begin{document}
begin{algorithm}
caption{Euclid’s algorithm}label{euclid}
begin{algorithmic}[1]
Procedure{Euclid}{$a,b$}Comment{The g.c.d. of $a$ and $b$}
State $r gets a bmod b$
While{$r not= 0$}Comment{We have the answer if $r$ is 0}
State $a gets b$
State $b gets r$
State $r gets a bmod b$
EndWhilelabel{euclidendwhile}
State textbf{return} $b$Comment{The gcd is $b$}
EndProcedure
end{algorithmic}
end{algorithm}
end{document}
fonts algorithms typewriter sans-serif
fonts algorithms typewriter sans-serif
asked 10 hours ago
S12000S12000
6847 silver badges24 bronze badges
6847 silver badges24 bronze badges
There are several packages for algorithms, and I believe they all use bold for keywords. There are very few typewriter fonts available with a matching bold, so you would most likely lose that.
– barbara beeton
9 hours ago
Hello Barbara the aim is to convert the font family witouth loosing the bold for the keyword. Look at the answer of Zarko, he provided the right solution to my problem.
– S12000
9 hours ago
Whilettfamily
as suggested by @Zarko is certainly a good solution in most ways, I've just checked thecmtt
fonts available in TeX Live. Someone has providedcmbtt
fonts in several sizes, but only from Metafont source, so they will be bitmap fonts, an won't scale well. I'd be very happy to be shown to be wrong. (I once had to provide a bold version ofcmtt
, and the only way I could do it well was to create a lighter version of the originalcmtt
and then a bolder version; that was in the days when bitmap fonts were still the standard.
– barbara beeton
8 hours ago
OK I see. In fact in my case I am using xelatex with UbuntuMono as a typewritter font and it works very fine (no scaling issues).
– S12000
7 hours ago
UbuntuMono sounds like it's designed for such things, I'm glad it works. (Since no specific font was indicated in the question, I just assumed CM.)
– barbara beeton
7 hours ago
add a comment |
There are several packages for algorithms, and I believe they all use bold for keywords. There are very few typewriter fonts available with a matching bold, so you would most likely lose that.
– barbara beeton
9 hours ago
Hello Barbara the aim is to convert the font family witouth loosing the bold for the keyword. Look at the answer of Zarko, he provided the right solution to my problem.
– S12000
9 hours ago
Whilettfamily
as suggested by @Zarko is certainly a good solution in most ways, I've just checked thecmtt
fonts available in TeX Live. Someone has providedcmbtt
fonts in several sizes, but only from Metafont source, so they will be bitmap fonts, an won't scale well. I'd be very happy to be shown to be wrong. (I once had to provide a bold version ofcmtt
, and the only way I could do it well was to create a lighter version of the originalcmtt
and then a bolder version; that was in the days when bitmap fonts were still the standard.
– barbara beeton
8 hours ago
OK I see. In fact in my case I am using xelatex with UbuntuMono as a typewritter font and it works very fine (no scaling issues).
– S12000
7 hours ago
UbuntuMono sounds like it's designed for such things, I'm glad it works. (Since no specific font was indicated in the question, I just assumed CM.)
– barbara beeton
7 hours ago
There are several packages for algorithms, and I believe they all use bold for keywords. There are very few typewriter fonts available with a matching bold, so you would most likely lose that.
– barbara beeton
9 hours ago
There are several packages for algorithms, and I believe they all use bold for keywords. There are very few typewriter fonts available with a matching bold, so you would most likely lose that.
– barbara beeton
9 hours ago
Hello Barbara the aim is to convert the font family witouth loosing the bold for the keyword. Look at the answer of Zarko, he provided the right solution to my problem.
– S12000
9 hours ago
Hello Barbara the aim is to convert the font family witouth loosing the bold for the keyword. Look at the answer of Zarko, he provided the right solution to my problem.
– S12000
9 hours ago
While
ttfamily
as suggested by @Zarko is certainly a good solution in most ways, I've just checked the cmtt
fonts available in TeX Live. Someone has provided cmbtt
fonts in several sizes, but only from Metafont source, so they will be bitmap fonts, an won't scale well. I'd be very happy to be shown to be wrong. (I once had to provide a bold version of cmtt
, and the only way I could do it well was to create a lighter version of the original cmtt
and then a bolder version; that was in the days when bitmap fonts were still the standard.– barbara beeton
8 hours ago
While
ttfamily
as suggested by @Zarko is certainly a good solution in most ways, I've just checked the cmtt
fonts available in TeX Live. Someone has provided cmbtt
fonts in several sizes, but only from Metafont source, so they will be bitmap fonts, an won't scale well. I'd be very happy to be shown to be wrong. (I once had to provide a bold version of cmtt
, and the only way I could do it well was to create a lighter version of the original cmtt
and then a bolder version; that was in the days when bitmap fonts were still the standard.– barbara beeton
8 hours ago
OK I see. In fact in my case I am using xelatex with UbuntuMono as a typewritter font and it works very fine (no scaling issues).
– S12000
7 hours ago
OK I see. In fact in my case I am using xelatex with UbuntuMono as a typewritter font and it works very fine (no scaling issues).
– S12000
7 hours ago
UbuntuMono sounds like it's designed for such things, I'm glad it works. (Since no specific font was indicated in the question, I just assumed CM.)
– barbara beeton
7 hours ago
UbuntuMono sounds like it's designed for such things, I'm glad it works. (Since no specific font was indicated in the question, I just assumed CM.)
– barbara beeton
7 hours ago
add a comment |
1 Answer
1
active
oldest
votes
If I'm not wrong, you should just use usepackage{algpseudocode}
because it seems to re-implement algorithms
and it's the one that defines things like State, etc.
There doesn't appear to be a single, simple way to change the font (maybe you should consider a different code package?).
The keywords in the code are defined in the package like this:
algnewcommandalgorithmicfunction{textbf{function}}
and you can change that to
algrenewcommandalgorithmicfunction{texttt{function}}
You can make similar changes to some of the other keywords. This won't change the other text though, like "Euclid" and the text in the comments. You can change some of this by wrapping algorithm
in a group with a font declaration.
documentclass{article}
usepackage{algpseudocode}
algrenewcommandalgorithmicprocedure{texttt{procedure}}
begin{document}
{tt
begin{algorithmic}
Procedure{Euclid}{a,b}
State $ABC$ ABC Comment{this is a test}
EndProcedure
end{algorithmic}
}
end{document}
But this still won't change the font for the math part. To change that font, either don't put it in math, or look at a package like mathastext
that redefines the math fonts.
2
instead TeXtt
you should use LaTeX commandttfamily
:-)
– Zarko
9 hours ago
Hello Zarko you are right if I replace ttdefault by ttfamily it works like a charm. I would use as a accepted answer. Could you please put your comment as answer?
– S12000
9 hours ago
Hello Ethan, thanks a lot for all the explanations I understand more the background of the package now. However, I think the solution of Zarko is more simple.
– S12000
9 hours ago
add a 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%2f501739%2fhow-to-change-the-font-style-not-the-size-but-the-style-of-algorithimc-package%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
If I'm not wrong, you should just use usepackage{algpseudocode}
because it seems to re-implement algorithms
and it's the one that defines things like State, etc.
There doesn't appear to be a single, simple way to change the font (maybe you should consider a different code package?).
The keywords in the code are defined in the package like this:
algnewcommandalgorithmicfunction{textbf{function}}
and you can change that to
algrenewcommandalgorithmicfunction{texttt{function}}
You can make similar changes to some of the other keywords. This won't change the other text though, like "Euclid" and the text in the comments. You can change some of this by wrapping algorithm
in a group with a font declaration.
documentclass{article}
usepackage{algpseudocode}
algrenewcommandalgorithmicprocedure{texttt{procedure}}
begin{document}
{tt
begin{algorithmic}
Procedure{Euclid}{a,b}
State $ABC$ ABC Comment{this is a test}
EndProcedure
end{algorithmic}
}
end{document}
But this still won't change the font for the math part. To change that font, either don't put it in math, or look at a package like mathastext
that redefines the math fonts.
2
instead TeXtt
you should use LaTeX commandttfamily
:-)
– Zarko
9 hours ago
Hello Zarko you are right if I replace ttdefault by ttfamily it works like a charm. I would use as a accepted answer. Could you please put your comment as answer?
– S12000
9 hours ago
Hello Ethan, thanks a lot for all the explanations I understand more the background of the package now. However, I think the solution of Zarko is more simple.
– S12000
9 hours ago
add a comment |
If I'm not wrong, you should just use usepackage{algpseudocode}
because it seems to re-implement algorithms
and it's the one that defines things like State, etc.
There doesn't appear to be a single, simple way to change the font (maybe you should consider a different code package?).
The keywords in the code are defined in the package like this:
algnewcommandalgorithmicfunction{textbf{function}}
and you can change that to
algrenewcommandalgorithmicfunction{texttt{function}}
You can make similar changes to some of the other keywords. This won't change the other text though, like "Euclid" and the text in the comments. You can change some of this by wrapping algorithm
in a group with a font declaration.
documentclass{article}
usepackage{algpseudocode}
algrenewcommandalgorithmicprocedure{texttt{procedure}}
begin{document}
{tt
begin{algorithmic}
Procedure{Euclid}{a,b}
State $ABC$ ABC Comment{this is a test}
EndProcedure
end{algorithmic}
}
end{document}
But this still won't change the font for the math part. To change that font, either don't put it in math, or look at a package like mathastext
that redefines the math fonts.
2
instead TeXtt
you should use LaTeX commandttfamily
:-)
– Zarko
9 hours ago
Hello Zarko you are right if I replace ttdefault by ttfamily it works like a charm. I would use as a accepted answer. Could you please put your comment as answer?
– S12000
9 hours ago
Hello Ethan, thanks a lot for all the explanations I understand more the background of the package now. However, I think the solution of Zarko is more simple.
– S12000
9 hours ago
add a comment |
If I'm not wrong, you should just use usepackage{algpseudocode}
because it seems to re-implement algorithms
and it's the one that defines things like State, etc.
There doesn't appear to be a single, simple way to change the font (maybe you should consider a different code package?).
The keywords in the code are defined in the package like this:
algnewcommandalgorithmicfunction{textbf{function}}
and you can change that to
algrenewcommandalgorithmicfunction{texttt{function}}
You can make similar changes to some of the other keywords. This won't change the other text though, like "Euclid" and the text in the comments. You can change some of this by wrapping algorithm
in a group with a font declaration.
documentclass{article}
usepackage{algpseudocode}
algrenewcommandalgorithmicprocedure{texttt{procedure}}
begin{document}
{tt
begin{algorithmic}
Procedure{Euclid}{a,b}
State $ABC$ ABC Comment{this is a test}
EndProcedure
end{algorithmic}
}
end{document}
But this still won't change the font for the math part. To change that font, either don't put it in math, or look at a package like mathastext
that redefines the math fonts.
If I'm not wrong, you should just use usepackage{algpseudocode}
because it seems to re-implement algorithms
and it's the one that defines things like State, etc.
There doesn't appear to be a single, simple way to change the font (maybe you should consider a different code package?).
The keywords in the code are defined in the package like this:
algnewcommandalgorithmicfunction{textbf{function}}
and you can change that to
algrenewcommandalgorithmicfunction{texttt{function}}
You can make similar changes to some of the other keywords. This won't change the other text though, like "Euclid" and the text in the comments. You can change some of this by wrapping algorithm
in a group with a font declaration.
documentclass{article}
usepackage{algpseudocode}
algrenewcommandalgorithmicprocedure{texttt{procedure}}
begin{document}
{tt
begin{algorithmic}
Procedure{Euclid}{a,b}
State $ABC$ ABC Comment{this is a test}
EndProcedure
end{algorithmic}
}
end{document}
But this still won't change the font for the math part. To change that font, either don't put it in math, or look at a package like mathastext
that redefines the math fonts.
answered 9 hours ago
Ethan DuckworthEthan Duckworth
926 bronze badges
926 bronze badges
2
instead TeXtt
you should use LaTeX commandttfamily
:-)
– Zarko
9 hours ago
Hello Zarko you are right if I replace ttdefault by ttfamily it works like a charm. I would use as a accepted answer. Could you please put your comment as answer?
– S12000
9 hours ago
Hello Ethan, thanks a lot for all the explanations I understand more the background of the package now. However, I think the solution of Zarko is more simple.
– S12000
9 hours ago
add a comment |
2
instead TeXtt
you should use LaTeX commandttfamily
:-)
– Zarko
9 hours ago
Hello Zarko you are right if I replace ttdefault by ttfamily it works like a charm. I would use as a accepted answer. Could you please put your comment as answer?
– S12000
9 hours ago
Hello Ethan, thanks a lot for all the explanations I understand more the background of the package now. However, I think the solution of Zarko is more simple.
– S12000
9 hours ago
2
2
instead TeX
tt
you should use LaTeX command ttfamily
:-)– Zarko
9 hours ago
instead TeX
tt
you should use LaTeX command ttfamily
:-)– Zarko
9 hours ago
Hello Zarko you are right if I replace ttdefault by ttfamily it works like a charm. I would use as a accepted answer. Could you please put your comment as answer?
– S12000
9 hours ago
Hello Zarko you are right if I replace ttdefault by ttfamily it works like a charm. I would use as a accepted answer. Could you please put your comment as answer?
– S12000
9 hours ago
Hello Ethan, thanks a lot for all the explanations I understand more the background of the package now. However, I think the solution of Zarko is more simple.
– S12000
9 hours ago
Hello Ethan, thanks a lot for all the explanations I understand more the background of the package now. However, I think the solution of Zarko is more simple.
– S12000
9 hours ago
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.
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%2f501739%2fhow-to-change-the-font-style-not-the-size-but-the-style-of-algorithimc-package%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
There are several packages for algorithms, and I believe they all use bold for keywords. There are very few typewriter fonts available with a matching bold, so you would most likely lose that.
– barbara beeton
9 hours ago
Hello Barbara the aim is to convert the font family witouth loosing the bold for the keyword. Look at the answer of Zarko, he provided the right solution to my problem.
– S12000
9 hours ago
While
ttfamily
as suggested by @Zarko is certainly a good solution in most ways, I've just checked thecmtt
fonts available in TeX Live. Someone has providedcmbtt
fonts in several sizes, but only from Metafont source, so they will be bitmap fonts, an won't scale well. I'd be very happy to be shown to be wrong. (I once had to provide a bold version ofcmtt
, and the only way I could do it well was to create a lighter version of the originalcmtt
and then a bolder version; that was in the days when bitmap fonts were still the standard.– barbara beeton
8 hours ago
OK I see. In fact in my case I am using xelatex with UbuntuMono as a typewritter font and it works very fine (no scaling issues).
– S12000
7 hours ago
UbuntuMono sounds like it's designed for such things, I'm glad it works. (Since no specific font was indicated in the question, I just assumed CM.)
– barbara beeton
7 hours ago