How to change the font style (not the size but the style) of algorithimc packageHow 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?
Assuring luggage isn't lost with short layover
Why isn't there a ";" after "do" in sh loops?
Why are all my history books dividing Chinese history after the Han dynasty?
Trapped in an ocean Temple in Minecraft?
How can I stop myself from micromanaging other PCs' actions?
Did the IBM PC use the 8088's NMI line?
Why did so many MPs not vote in Meaningful Vote 3?
How can I create a pattern of parallel lines that are increasing in distance in Photoshop / Illustrator?
How to handle a player that cannot be convinced his actions are a problem for both GM and party
What is the lowest-speed bogey a jet fighter can intercept/escort?
Piece-drop Mate #2
What do I do when a student working in my lab "ghosts" me?
Is it normal practice to screen share with a client?
Commercial jet accompanied by small plane near Seattle
When going by a train from Paris to Düsseldorf (Thalys), can I hop off in Köln and then hop on again?
What's the difference between 2a and 10a charging options?
Unethical behavior : should I report it?
Can two figures have the same area, perimeter, and same number of segments have different shape?
Integral of the integral using NIntegrate
Writing a clean implementation of Rock, Paper, Scissors game in c++
Is my employer paying me fairly? Going from 1099 to W2
Inadvertently nuked my disk permission structure - why?
Is a fighting a fallen friend with the help of a redeemed villain story too much for one book
How acidic does a mixture have to be for milk to curdle?
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?
documentclassarticle
usepackagealgpseudocode,algorithm
makeatletter
algrenewcommandALG@beginalgorithmicttdefault
makeatother
begindocument
beginalgorithm
captionEuclid’s algorithmlabeleuclid
beginalgorithmic[1]
ProcedureEuclid$a,b$CommentThe g.c.d. of $a$ and $b$
State $r gets a bmod b$
While$r not= 0$CommentWe have the answer if $r$ is 0
State $a gets b$
State $b gets r$
State $r gets a bmod b$
EndWhilelabeleuclidendwhile
State textbfreturn $b$CommentThe gcd is $b$
EndProcedure
endalgorithmic
endalgorithm
enddocument
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?
documentclassarticle
usepackagealgpseudocode,algorithm
makeatletter
algrenewcommandALG@beginalgorithmicttdefault
makeatother
begindocument
beginalgorithm
captionEuclid’s algorithmlabeleuclid
beginalgorithmic[1]
ProcedureEuclid$a,b$CommentThe g.c.d. of $a$ and $b$
State $r gets a bmod b$
While$r not= 0$CommentWe have the answer if $r$ is 0
State $a gets b$
State $b gets r$
State $r gets a bmod b$
EndWhilelabeleuclidendwhile
State textbfreturn $b$CommentThe gcd is $b$
EndProcedure
endalgorithmic
endalgorithm
enddocument
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
8 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
8 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
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
6 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
6 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?
documentclassarticle
usepackagealgpseudocode,algorithm
makeatletter
algrenewcommandALG@beginalgorithmicttdefault
makeatother
begindocument
beginalgorithm
captionEuclid’s algorithmlabeleuclid
beginalgorithmic[1]
ProcedureEuclid$a,b$CommentThe g.c.d. of $a$ and $b$
State $r gets a bmod b$
While$r not= 0$CommentWe have the answer if $r$ is 0
State $a gets b$
State $b gets r$
State $r gets a bmod b$
EndWhilelabeleuclidendwhile
State textbfreturn $b$CommentThe gcd is $b$
EndProcedure
endalgorithmic
endalgorithm
enddocument
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?
documentclassarticle
usepackagealgpseudocode,algorithm
makeatletter
algrenewcommandALG@beginalgorithmicttdefault
makeatother
begindocument
beginalgorithm
captionEuclid’s algorithmlabeleuclid
beginalgorithmic[1]
ProcedureEuclid$a,b$CommentThe g.c.d. of $a$ and $b$
State $r gets a bmod b$
While$r not= 0$CommentWe have the answer if $r$ is 0
State $a gets b$
State $b gets r$
State $r gets a bmod b$
EndWhilelabeleuclidendwhile
State textbfreturn $b$CommentThe gcd is $b$
EndProcedure
endalgorithmic
endalgorithm
enddocument
fonts algorithms typewriter sans-serif
fonts algorithms typewriter sans-serif
asked 9 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
8 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
8 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
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
6 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
6 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
8 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
8 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
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
6 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
6 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
8 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
8 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
8 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
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
7 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
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
6 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
6 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
6 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
6 hours ago
add a comment |
1 Answer
1
active
oldest
votes
If I'm not wrong, you should just use usepackagealgpseudocode
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:
algnewcommandalgorithmicfunctiontextbffunction
and you can change that to
algrenewcommandalgorithmicfunctiontextttfunction
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.
documentclassarticle
usepackagealgpseudocode
algrenewcommandalgorithmicproceduretextttprocedure
begindocument
tt
beginalgorithmic
ProcedureEuclida,b
State $ABC$ ABC Commentthis is a test
EndProcedure
endalgorithmic
enddocument
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
8 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
8 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
8 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 usepackagealgpseudocode
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:
algnewcommandalgorithmicfunctiontextbffunction
and you can change that to
algrenewcommandalgorithmicfunctiontextttfunction
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.
documentclassarticle
usepackagealgpseudocode
algrenewcommandalgorithmicproceduretextttprocedure
begindocument
tt
beginalgorithmic
ProcedureEuclida,b
State $ABC$ ABC Commentthis is a test
EndProcedure
endalgorithmic
enddocument
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
8 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
8 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
8 hours ago
add a comment |
If I'm not wrong, you should just use usepackagealgpseudocode
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:
algnewcommandalgorithmicfunctiontextbffunction
and you can change that to
algrenewcommandalgorithmicfunctiontextttfunction
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.
documentclassarticle
usepackagealgpseudocode
algrenewcommandalgorithmicproceduretextttprocedure
begindocument
tt
beginalgorithmic
ProcedureEuclida,b
State $ABC$ ABC Commentthis is a test
EndProcedure
endalgorithmic
enddocument
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
8 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
8 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
8 hours ago
add a comment |
If I'm not wrong, you should just use usepackagealgpseudocode
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:
algnewcommandalgorithmicfunctiontextbffunction
and you can change that to
algrenewcommandalgorithmicfunctiontextttfunction
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.
documentclassarticle
usepackagealgpseudocode
algrenewcommandalgorithmicproceduretextttprocedure
begindocument
tt
beginalgorithmic
ProcedureEuclida,b
State $ABC$ ABC Commentthis is a test
EndProcedure
endalgorithmic
enddocument
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 usepackagealgpseudocode
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:
algnewcommandalgorithmicfunctiontextbffunction
and you can change that to
algrenewcommandalgorithmicfunctiontextttfunction
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.
documentclassarticle
usepackagealgpseudocode
algrenewcommandalgorithmicproceduretextttprocedure
begindocument
tt
beginalgorithmic
ProcedureEuclida,b
State $ABC$ ABC Commentthis is a test
EndProcedure
endalgorithmic
enddocument
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 8 hours ago
Ethan DuckworthEthan Duckworth
926 bronze badges
926 bronze badges
2
instead TeXtt
you should use LaTeX commandttfamily
:-)
– Zarko
8 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
8 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
8 hours ago
add a comment |
2
instead TeXtt
you should use LaTeX commandttfamily
:-)
– Zarko
8 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
8 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
8 hours ago
2
2
instead TeX
tt
you should use LaTeX command ttfamily
:-)– Zarko
8 hours ago
instead TeX
tt
you should use LaTeX command ttfamily
:-)– Zarko
8 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
8 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
8 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
8 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
8 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
8 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
8 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
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
6 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
6 hours ago