Help with algorithm2e formattingHow to write pseudo code in other languages (Spanish)?Rename “Algorithm” to “Listing”Add the word “Algorithm” before each entry in the List of Algorithmsalgorithm2e and algomargin with negative valueAlgorithm as figure and without italic and bold formatting?Caption spacing using algorithm2eRemove top rule from algorithm packageProcedure name with small caps in algorithm2eNeed help reformatting PowerPoint slide containing latex codeMarking some lines of an algorithm with an asterisk, why it doesn't always work?algorithm2e caption above code with conference style files
Your magic is very sketchy
Why does John Bercow say “unlock” after reading out the results of a vote?
How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?
Irreducibility of a simple polynomial
What would happen if the UK refused to take part in EU Parliamentary elections?
Is there a measurement for the vocal speed of a song?
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
Is there any reason not to eat food that's been dropped on the surface of the moon?
Everything Bob says is false. How does he get people to trust him?
MaTeX, font size, and PlotLegends
What are the ramifications of creating a homebrew world without an Astral Plane?
How to prove that the query oracle is unitary?
Trouble understanding overseas colleagues
What defines a dissertation?
Why did Kant, Hegel, and Adorno leave some words and phrases in the Greek alphabet?
What to do with wrong results in talks?
Personal Teleportation as a Weapon
I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?
How does a character multiclassing into warlock get a focus?
Implement the Thanos sorting algorithm
Select empty space and change color in vector
Efficiently merge handle parallel feature branches in SFDX
The baby cries all morning
Lay out the Carpet
Help with algorithm2e formatting
How to write pseudo code in other languages (Spanish)?Rename “Algorithm” to “Listing”Add the word “Algorithm” before each entry in the List of Algorithmsalgorithm2e and algomargin with negative valueAlgorithm as figure and without italic and bold formatting?Caption spacing using algorithm2eRemove top rule from algorithm packageProcedure name with small caps in algorithm2eNeed help reformatting PowerPoint slide containing latex codeMarking some lines of an algorithm with an asterisk, why it doesn't always work?algorithm2e caption above code with conference style files
recentely I've got into a bit more advanced LaTeX formatting, i.e algorithms. My package of choice is the algorithm2e package, but I'm having some difficulities operating it.
So I've wanted to create an algorithm using the algorithm2e package, but I can't quite wrap my head around how it operates.
Here is my code.
As for packages, all I've used is
usepackageamsmath
usepackage[linesnumbered]algorithm2e
amsmath for mathematical library
and re-set the algorithm2e to enumerate the lines of my algorithm
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
KwIn$X_t-1, u_t. z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw i with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
endalgorithm
Which produces this:
My desired result would be:
So I've got 5 questions.
1) How can I redefine the algorithm2e to print "Algoritmus" instead of Algorithm in place of my caption? *Answered in comments
2) Probably will have similar solution as 1), but is it possible for my algorithm to print end for instead of only end?3) How to place the caption title on the top instead of the bottom of the algorhitm?4) How to add the <hr>
look-a-like line break in the specific parts of algorithm?
5) Is it good practice inside the For
loop to define it as For$k = 1$ to $M$ code..
? Seems a bit artificial to me to add the word to there. Isn't there an inbuilt function for this?
EDIT: Found a solution to question number 3 and 4. Studied the algorithm2e.sty file and found solution.
For those wondering, change the package definition to usepackage[linesnumbered, ruled, vlined]
Produces the following:
The remaining questions however still stand.
formatting algorithms algorithm2e
add a comment |
recentely I've got into a bit more advanced LaTeX formatting, i.e algorithms. My package of choice is the algorithm2e package, but I'm having some difficulities operating it.
So I've wanted to create an algorithm using the algorithm2e package, but I can't quite wrap my head around how it operates.
Here is my code.
As for packages, all I've used is
usepackageamsmath
usepackage[linesnumbered]algorithm2e
amsmath for mathematical library
and re-set the algorithm2e to enumerate the lines of my algorithm
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
KwIn$X_t-1, u_t. z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw i with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
endalgorithm
Which produces this:
My desired result would be:
So I've got 5 questions.
1) How can I redefine the algorithm2e to print "Algoritmus" instead of Algorithm in place of my caption? *Answered in comments
2) Probably will have similar solution as 1), but is it possible for my algorithm to print end for instead of only end?3) How to place the caption title on the top instead of the bottom of the algorhitm?4) How to add the <hr>
look-a-like line break in the specific parts of algorithm?
5) Is it good practice inside the For
loop to define it as For$k = 1$ to $M$ code..
? Seems a bit artificial to me to add the word to there. Isn't there an inbuilt function for this?
EDIT: Found a solution to question number 3 and 4. Studied the algorithm2e.sty file and found solution.
For those wondering, change the package definition to usepackage[linesnumbered, ruled, vlined]
Produces the following:
The remaining questions however still stand.
formatting algorithms algorithm2e
@Naphaneal if i'm not mistaken, that doesn't work with algorithm2e package, but only different ones. At least I did at the very least get an unknown command error. Although I found, that if I change the language options in usepackage, it will change the name of the Algorhitm to Algoritmus automatically. (in this particular case, it was changing it to Slovak).
– Rawrplus
Apr 2 '16 at 20:25
my bad. I overlooked the missing2e
part. I was actually looking for this answer: tex.stackexchange.com/questions/146050/…
– naphaneal
Apr 2 '16 at 20:29
yup as i said, defining the language in the algorithm2e usepackage does the trick :) Although by any chance I presume you don't know how to apply namechange to also the ending of for loop, or?
– Rawrplus
Apr 2 '16 at 20:40
add a comment |
recentely I've got into a bit more advanced LaTeX formatting, i.e algorithms. My package of choice is the algorithm2e package, but I'm having some difficulities operating it.
So I've wanted to create an algorithm using the algorithm2e package, but I can't quite wrap my head around how it operates.
Here is my code.
As for packages, all I've used is
usepackageamsmath
usepackage[linesnumbered]algorithm2e
amsmath for mathematical library
and re-set the algorithm2e to enumerate the lines of my algorithm
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
KwIn$X_t-1, u_t. z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw i with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
endalgorithm
Which produces this:
My desired result would be:
So I've got 5 questions.
1) How can I redefine the algorithm2e to print "Algoritmus" instead of Algorithm in place of my caption? *Answered in comments
2) Probably will have similar solution as 1), but is it possible for my algorithm to print end for instead of only end?3) How to place the caption title on the top instead of the bottom of the algorhitm?4) How to add the <hr>
look-a-like line break in the specific parts of algorithm?
5) Is it good practice inside the For
loop to define it as For$k = 1$ to $M$ code..
? Seems a bit artificial to me to add the word to there. Isn't there an inbuilt function for this?
EDIT: Found a solution to question number 3 and 4. Studied the algorithm2e.sty file and found solution.
For those wondering, change the package definition to usepackage[linesnumbered, ruled, vlined]
Produces the following:
The remaining questions however still stand.
formatting algorithms algorithm2e
recentely I've got into a bit more advanced LaTeX formatting, i.e algorithms. My package of choice is the algorithm2e package, but I'm having some difficulities operating it.
So I've wanted to create an algorithm using the algorithm2e package, but I can't quite wrap my head around how it operates.
Here is my code.
As for packages, all I've used is
usepackageamsmath
usepackage[linesnumbered]algorithm2e
amsmath for mathematical library
and re-set the algorithm2e to enumerate the lines of my algorithm
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
KwIn$X_t-1, u_t. z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw i with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
endalgorithm
Which produces this:
My desired result would be:
So I've got 5 questions.
1) How can I redefine the algorithm2e to print "Algoritmus" instead of Algorithm in place of my caption? *Answered in comments
2) Probably will have similar solution as 1), but is it possible for my algorithm to print end for instead of only end?3) How to place the caption title on the top instead of the bottom of the algorhitm?4) How to add the <hr>
look-a-like line break in the specific parts of algorithm?
5) Is it good practice inside the For
loop to define it as For$k = 1$ to $M$ code..
? Seems a bit artificial to me to add the word to there. Isn't there an inbuilt function for this?
EDIT: Found a solution to question number 3 and 4. Studied the algorithm2e.sty file and found solution.
For those wondering, change the package definition to usepackage[linesnumbered, ruled, vlined]
Produces the following:
The remaining questions however still stand.
formatting algorithms algorithm2e
formatting algorithms algorithm2e
edited Apr 2 '16 at 20:28
Rawrplus
asked Apr 2 '16 at 19:38
RawrplusRawrplus
1286
1286
@Naphaneal if i'm not mistaken, that doesn't work with algorithm2e package, but only different ones. At least I did at the very least get an unknown command error. Although I found, that if I change the language options in usepackage, it will change the name of the Algorhitm to Algoritmus automatically. (in this particular case, it was changing it to Slovak).
– Rawrplus
Apr 2 '16 at 20:25
my bad. I overlooked the missing2e
part. I was actually looking for this answer: tex.stackexchange.com/questions/146050/…
– naphaneal
Apr 2 '16 at 20:29
yup as i said, defining the language in the algorithm2e usepackage does the trick :) Although by any chance I presume you don't know how to apply namechange to also the ending of for loop, or?
– Rawrplus
Apr 2 '16 at 20:40
add a comment |
@Naphaneal if i'm not mistaken, that doesn't work with algorithm2e package, but only different ones. At least I did at the very least get an unknown command error. Although I found, that if I change the language options in usepackage, it will change the name of the Algorhitm to Algoritmus automatically. (in this particular case, it was changing it to Slovak).
– Rawrplus
Apr 2 '16 at 20:25
my bad. I overlooked the missing2e
part. I was actually looking for this answer: tex.stackexchange.com/questions/146050/…
– naphaneal
Apr 2 '16 at 20:29
yup as i said, defining the language in the algorithm2e usepackage does the trick :) Although by any chance I presume you don't know how to apply namechange to also the ending of for loop, or?
– Rawrplus
Apr 2 '16 at 20:40
@Naphaneal if i'm not mistaken, that doesn't work with algorithm2e package, but only different ones. At least I did at the very least get an unknown command error. Although I found, that if I change the language options in usepackage, it will change the name of the Algorhitm to Algoritmus automatically. (in this particular case, it was changing it to Slovak).
– Rawrplus
Apr 2 '16 at 20:25
@Naphaneal if i'm not mistaken, that doesn't work with algorithm2e package, but only different ones. At least I did at the very least get an unknown command error. Although I found, that if I change the language options in usepackage, it will change the name of the Algorhitm to Algoritmus automatically. (in this particular case, it was changing it to Slovak).
– Rawrplus
Apr 2 '16 at 20:25
my bad. I overlooked the missing
2e
part. I was actually looking for this answer: tex.stackexchange.com/questions/146050/…– naphaneal
Apr 2 '16 at 20:29
my bad. I overlooked the missing
2e
part. I was actually looking for this answer: tex.stackexchange.com/questions/146050/…– naphaneal
Apr 2 '16 at 20:29
yup as i said, defining the language in the algorithm2e usepackage does the trick :) Although by any chance I presume you don't know how to apply namechange to also the ending of for loop, or?
– Rawrplus
Apr 2 '16 at 20:40
yup as i said, defining the language in the algorithm2e usepackage does the trick :) Although by any chance I presume you don't know how to apply namechange to also the ending of for loop, or?
– Rawrplus
Apr 2 '16 at 20:40
add a comment |
2 Answers
2
active
oldest
votes
Supposing your document is in German , loading babel
with german
set via document class does the trick. To replace end
with endfor
, overwrite the definition of For
with SetKwFor
:
documentclass[german] article
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagebabel usepackage[linesnumbered, ruled, vlined]algorithm2e
SetKwForForfordoendfor for%
begindocument
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
KwIn$X_t-1, u_t · z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw $ i $ with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
endalgorithm
enddocument
add a comment |
Well sadly, nobody really answered and by time it took everybody to do so, I managed to find answers to majority of my questions already.
So to go over them 1 by 1.
To set the algorithm name (caption) to be displayed on top, to add lines inbetween blocks and to change name of Algorithm to Algoritmus, you have to edit the settings in your usepackage
declaration.
I would strongly recommend downloading and studying the "algorithm2e.sty" file, it's wonderfully documented there and you will pretty much find answers to all your questions.
So we edited the declaration to following: usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Obviously, you will set the language option to your own personal preference.
On top of that, you can edit the original algorithm2e.sty file to change the localisation definitions/declarations to your personal liking, if you don't like the default options.
As for changing the definition of end to print end for instead, this was a tricky one and I've spent hours searching for this, but inside the documentation I found the SetKw command.
In this particular case, we changed it to SetKwForForfordoend~for
I can't answer my last question, whether it's good practice to manually add to to the for condition, somebody will have to answer that for me.
Here is the final code
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
SetKwForForfordoend~for
KwIn$X_t-1, u_t. z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw i with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
labelalg:alg1
endalgorithm
Package definition is as mentioned usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Will produce the following
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%2f302162%2fhelp-with-algorithm2e-formatting%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Supposing your document is in German , loading babel
with german
set via document class does the trick. To replace end
with endfor
, overwrite the definition of For
with SetKwFor
:
documentclass[german] article
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagebabel usepackage[linesnumbered, ruled, vlined]algorithm2e
SetKwForForfordoendfor for%
begindocument
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
KwIn$X_t-1, u_t · z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw $ i $ with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
endalgorithm
enddocument
add a comment |
Supposing your document is in German , loading babel
with german
set via document class does the trick. To replace end
with endfor
, overwrite the definition of For
with SetKwFor
:
documentclass[german] article
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagebabel usepackage[linesnumbered, ruled, vlined]algorithm2e
SetKwForForfordoendfor for%
begindocument
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
KwIn$X_t-1, u_t · z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw $ i $ with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
endalgorithm
enddocument
add a comment |
Supposing your document is in German , loading babel
with german
set via document class does the trick. To replace end
with endfor
, overwrite the definition of For
with SetKwFor
:
documentclass[german] article
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagebabel usepackage[linesnumbered, ruled, vlined]algorithm2e
SetKwForForfordoendfor for%
begindocument
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
KwIn$X_t-1, u_t · z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw $ i $ with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
endalgorithm
enddocument
Supposing your document is in German , loading babel
with german
set via document class does the trick. To replace end
with endfor
, overwrite the definition of For
with SetKwFor
:
documentclass[german] article
usepackage[utf8]inputenc
usepackage[T1]fontenc
usepackagebabel usepackage[linesnumbered, ruled, vlined]algorithm2e
SetKwForForfordoendfor for%
begindocument
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
KwIn$X_t-1, u_t · z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw $ i $ with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
endalgorithm
enddocument
edited 4 mins ago
answered Apr 2 '16 at 21:00
BernardBernard
174k776206
174k776206
add a comment |
add a comment |
Well sadly, nobody really answered and by time it took everybody to do so, I managed to find answers to majority of my questions already.
So to go over them 1 by 1.
To set the algorithm name (caption) to be displayed on top, to add lines inbetween blocks and to change name of Algorithm to Algoritmus, you have to edit the settings in your usepackage
declaration.
I would strongly recommend downloading and studying the "algorithm2e.sty" file, it's wonderfully documented there and you will pretty much find answers to all your questions.
So we edited the declaration to following: usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Obviously, you will set the language option to your own personal preference.
On top of that, you can edit the original algorithm2e.sty file to change the localisation definitions/declarations to your personal liking, if you don't like the default options.
As for changing the definition of end to print end for instead, this was a tricky one and I've spent hours searching for this, but inside the documentation I found the SetKw command.
In this particular case, we changed it to SetKwForForfordoend~for
I can't answer my last question, whether it's good practice to manually add to to the for condition, somebody will have to answer that for me.
Here is the final code
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
SetKwForForfordoend~for
KwIn$X_t-1, u_t. z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw i with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
labelalg:alg1
endalgorithm
Package definition is as mentioned usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Will produce the following
add a comment |
Well sadly, nobody really answered and by time it took everybody to do so, I managed to find answers to majority of my questions already.
So to go over them 1 by 1.
To set the algorithm name (caption) to be displayed on top, to add lines inbetween blocks and to change name of Algorithm to Algoritmus, you have to edit the settings in your usepackage
declaration.
I would strongly recommend downloading and studying the "algorithm2e.sty" file, it's wonderfully documented there and you will pretty much find answers to all your questions.
So we edited the declaration to following: usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Obviously, you will set the language option to your own personal preference.
On top of that, you can edit the original algorithm2e.sty file to change the localisation definitions/declarations to your personal liking, if you don't like the default options.
As for changing the definition of end to print end for instead, this was a tricky one and I've spent hours searching for this, but inside the documentation I found the SetKw command.
In this particular case, we changed it to SetKwForForfordoend~for
I can't answer my last question, whether it's good practice to manually add to to the for condition, somebody will have to answer that for me.
Here is the final code
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
SetKwForForfordoend~for
KwIn$X_t-1, u_t. z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw i with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
labelalg:alg1
endalgorithm
Package definition is as mentioned usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Will produce the following
add a comment |
Well sadly, nobody really answered and by time it took everybody to do so, I managed to find answers to majority of my questions already.
So to go over them 1 by 1.
To set the algorithm name (caption) to be displayed on top, to add lines inbetween blocks and to change name of Algorithm to Algoritmus, you have to edit the settings in your usepackage
declaration.
I would strongly recommend downloading and studying the "algorithm2e.sty" file, it's wonderfully documented there and you will pretty much find answers to all your questions.
So we edited the declaration to following: usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Obviously, you will set the language option to your own personal preference.
On top of that, you can edit the original algorithm2e.sty file to change the localisation definitions/declarations to your personal liking, if you don't like the default options.
As for changing the definition of end to print end for instead, this was a tricky one and I've spent hours searching for this, but inside the documentation I found the SetKw command.
In this particular case, we changed it to SetKwForForfordoend~for
I can't answer my last question, whether it's good practice to manually add to to the for condition, somebody will have to answer that for me.
Here is the final code
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
SetKwForForfordoend~for
KwIn$X_t-1, u_t. z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw i with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
labelalg:alg1
endalgorithm
Package definition is as mentioned usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Will produce the following
Well sadly, nobody really answered and by time it took everybody to do so, I managed to find answers to majority of my questions already.
So to go over them 1 by 1.
To set the algorithm name (caption) to be displayed on top, to add lines inbetween blocks and to change name of Algorithm to Algoritmus, you have to edit the settings in your usepackage
declaration.
I would strongly recommend downloading and studying the "algorithm2e.sty" file, it's wonderfully documented there and you will pretty much find answers to all your questions.
So we edited the declaration to following: usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Obviously, you will set the language option to your own personal preference.
On top of that, you can edit the original algorithm2e.sty file to change the localisation definitions/declarations to your personal liking, if you don't like the default options.
As for changing the definition of end to print end for instead, this was a tricky one and I've spent hours searching for this, but inside the documentation I found the SetKw command.
In this particular case, we changed it to SetKwForForfordoend~for
I can't answer my last question, whether it's good practice to manually add to to the for condition, somebody will have to answer that for me.
Here is the final code
SetAlgoNoLine
beginalgorithm[H]
DontPrintSemicolon
SetKwForForfordoend~for
KwIn$X_t-1, u_t. z_t$
KwOut$X_t$
$overlineX_t = X_t = 0$;
For$k = 1$ to $M$
$x^[k]_t = sample_motion_model(u_t, x^[k]_t-1)$;
$w^[k]_t = measurement_model(z_t, x^[k]_t, m_t-1)$;
$m^[k]_t = updated_occupancy_grid(z_t, x^[k]_t, m^[k]_t-1)$;
$overlineX_t = overlineX_t + langle x_x^[m], w_t^[m] rangle $;
For $k = 1$ to $M$
draw i with probability $approx w_t^[i]$;
add $langle x_x^[m], w_t^[m] rangle$ to $X_t$;
Return $X_t$
captionFastSLAM
labelalg:alg1
endalgorithm
Package definition is as mentioned usepackage[linesnumbered, ruled, vlined, slovak]algorithm2e
Will produce the following
edited Apr 2 '16 at 21:04
answered Apr 2 '16 at 20:59
RawrplusRawrplus
1286
1286
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.
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%2f302162%2fhelp-with-algorithm2e-formatting%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
@Naphaneal if i'm not mistaken, that doesn't work with algorithm2e package, but only different ones. At least I did at the very least get an unknown command error. Although I found, that if I change the language options in usepackage, it will change the name of the Algorhitm to Algoritmus automatically. (in this particular case, it was changing it to Slovak).
– Rawrplus
Apr 2 '16 at 20:25
my bad. I overlooked the missing
2e
part. I was actually looking for this answer: tex.stackexchange.com/questions/146050/…– naphaneal
Apr 2 '16 at 20:29
yup as i said, defining the language in the algorithm2e usepackage does the trick :) Although by any chance I presume you don't know how to apply namechange to also the ending of for loop, or?
– Rawrplus
Apr 2 '16 at 20:40