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

What is the opposite of 'gravitas'?

What's a natural way to say that someone works somewhere (for a job)?

Was the picture area of a CRT a parallelogram (instead of a true rectangle)?

Why are on-board computers allowed to change controls without notifying the pilots?

How can I replace every global instance of "x[2]" with "x_2"

Mapping a list into a phase plot

Is it okay / does it make sense for another player to join a running game of Munchkin?

Can I Retrieve Email Addresses from BCC?

Select empty space and change color in vector

How do I define a right arrow with bar in LaTeX?

Curses work by shouting - How to avoid collateral damage?

Applicability of Single Responsibility Principle

What's the purpose of "true" in bash "if sudo true; then"

Is there any reason not to eat food that's been dropped on the surface of the moon?

Minimal reference content

how to analyze "是其于主也至忠矣"

apt-get update is failing in debian

How can I use the arrow sign in my bash prompt?

Using parameter substitution on a Bash array

Why "be dealt cards" rather than "be dealing cards"?

Best way to store options for panels

Do I need a multiple entry visa for a trip UK -> Sweden -> UK?

How was Earth single-handedly capable of creating 3 of the 4 gods of chaos?

How does residential electricity work?



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













2















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:



fielded result



My desired result would be:



desired



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:



edited



The remaining questions however still stand.










share|improve this question
























  • @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
















2















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:



fielded result



My desired result would be:



desired



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:



edited



The remaining questions however still stand.










share|improve this question
























  • @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














2












2








2


1






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:



fielded result



My desired result would be:



desired



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:



edited



The remaining questions however still stand.










share|improve this question
















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:



fielded result



My desired result would be:



desired



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:



edited



The remaining questions however still stand.







formatting algorithms algorithm2e






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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


















  • @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

















@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











2 Answers
2






active

oldest

votes


















1














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


enter image description here






share|improve this answer
































    1














    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



    answer






    share|improve this answer
























      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
      );



      );













      draft saved

      draft discarded


















      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









      1














      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


      enter image description here






      share|improve this answer





























        1














        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


        enter image description here






        share|improve this answer



























          1












          1








          1







          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


          enter image description here






          share|improve this answer















          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


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 13 mins ago

























          answered Apr 2 '16 at 21:00









          BernardBernard

          174k776207




          174k776207





















              1














              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



              answer






              share|improve this answer





























                1














                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



                answer






                share|improve this answer



























                  1












                  1








                  1







                  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



                  answer






                  share|improve this answer















                  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



                  answer







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Apr 2 '16 at 21:04

























                  answered Apr 2 '16 at 20:59









                  RawrplusRawrplus

                  1286




                  1286



























                      draft saved

                      draft discarded
















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      How should I use the fbox command correctly to avoid producing a Bad Box message?How to put a long piece of text in a box?How to specify height and width of fboxIs there an arrayrulecolor-like command to change the rule color of fbox?What is the command to highlight bad boxes in pdf?Why does fbox sometimes place the box *over* the graphic image?how to put the text in the boxHow to create command for a box where text inside the box can automatically adjust?how can I make an fbox like command with certain color, shape and width of border?how to use fbox in align modeFbox increase the spacing between the box and it content (inner margin)how to change the box height of an equationWhat is the use of the hbox in a newcommand command?

                      Doxepinum Nexus interni Notae | Tabula navigationis3158DB01142WHOa682390"Structural Analysis of the Histamine H1 Receptor""Transdermal and Topical Drug Administration in the Treatment of Pain""Antidepressants as antipruritic agents: A review"

                      inputenc: Unicode character … not set up for use with LaTeX The Next CEO of Stack OverflowEntering Unicode characters in LaTeXHow to solve the `Package inputenc Error: Unicode char not set up for use with LaTeX` problem?solve “Unicode char is not set up for use with LaTeX” without special handling of every new interesting UTF-8 characterPackage inputenc Error: Unicode character ² (U+B2)(inputenc) not set up for use with LaTeX. acroI2C[I²C]package inputenc error unicode char (u + 190) not set up for use with latexPackage inputenc Error: Unicode char u8:′ not set up for use with LaTeX. 3′inputenc Error: Unicode char u8: not set up for use with LaTeX with G-BriefPackage Inputenc Error: Unicode char u8: not set up for use with LaTeXPackage inputenc Error: Unicode char ́ (U+301)(inputenc) not set up for use with LaTeX. includePackage inputenc Error: Unicode char ̂ (U+302)(inputenc) not set up for use with LaTeX. … $widehatleft (OA,AA' right )$Package inputenc Error: Unicode char â„¡ (U+2121)(inputenc) not set up for use with LaTeX. printbibliography[heading=bibintoc]Package inputenc Error: Unicode char − (U+2212)(inputenc) not set up for use with LaTeXPackage inputenc Error: Unicode character α (U+3B1) not set up for use with LaTeXPackage inputenc Error: Unicode characterError: ! Package inputenc Error: Unicode char ⊘ (U+2298)(inputenc) not set up for use with LaTeX