Set width of algorithm environment (preferably document wide)Set horizontal width on custom listings...

Why was Sir Cadogan fired?

Is it possible to create a QR code using text?

Why was the shrink from 8″ made only to 5.25″ and not smaller (4″ or less)

Avoiding the "not like other girls" trope?

Send out email when Apex Queueable fails and test it

Bullying boss launched a smear campaign and made me unemployable

How to coordinate airplane tickets?

How to travel to Japan while expressing milk?

how do we prove that a sum of two periods is still a period?

How to Prove P(a) → ∀x(P(x) ∨ ¬(x = a)) using Natural Deduction

Why are UK visa biometrics appointments suspended at USCIS Application Support Centers?

How to install cross-compiler on Ubuntu 18.04?

Is it "common practice in Fourier transform spectroscopy to multiply the measured interferogram by an apodizing function"? If so, why?

Was the Stack Exchange "Happy April Fools" page fitting with the '90's code?

Does int main() need a declaration on C++?

How can saying a song's name be a copyright violation?

Could the museum Saturn V's be refitted for one more flight?

How to remove border from elements in the last row?

files created then deleted at every second in tmp directory

What do you call someone who asks many questions?

Getting extremely large arrows with tikzcd

Are British MPs missing the point, with these 'Indicative Votes'?

How do conventional missiles fly?

Why were 5.25" floppy drives cheaper than 8"?



Set width of algorithm environment (preferably document wide)


Set horizontal width on custom listings environmentSet width of a custom environmentIndentation of `then` in algorithms?Set width of a custom environmentAlgorithm code width problemAlgorithm EnvironmentTabbing environment in tabular environment cancels set table widthHow can I make an algorithm environment wider than linewidth or textwidth?Set linespread in algorithm environementshow to set sidebar color widthHow to set algorithm width to avoid overfull hbox problemAdjust width of algorithm floatFormat an algorithm without using algorithm environment













8















Looking for a way to set the width of an algorithm environment, preferably document wide (as opposed to per-algorithm). Thought it should be fairly easy, but couldn't find a particularly good solution.



Found this one here (wrap an algorithm in a minipage in a float, which is relatively okay, but surely there's a simpler way)?



documentclass{article}
usepackage{algorithm}
floatstyle{plain}
newfloat{myalgo}{tbhp}{mya}

newenvironment{Algorithm}[2][tbh]%
{begin{myalgo}[#1]
centering
begin{minipage}{#2}
begin{algorithm}[H]}%
{end{algorithm}
end{minipage}
end{myalgo}}

begin{document}
begin{Algorithm}[t]{10cm}
caption{Does work, though no nice solution.}
end{Algorithm}
end{document}









share|improve this question





























    8















    Looking for a way to set the width of an algorithm environment, preferably document wide (as opposed to per-algorithm). Thought it should be fairly easy, but couldn't find a particularly good solution.



    Found this one here (wrap an algorithm in a minipage in a float, which is relatively okay, but surely there's a simpler way)?



    documentclass{article}
    usepackage{algorithm}
    floatstyle{plain}
    newfloat{myalgo}{tbhp}{mya}

    newenvironment{Algorithm}[2][tbh]%
    {begin{myalgo}[#1]
    centering
    begin{minipage}{#2}
    begin{algorithm}[H]}%
    {end{algorithm}
    end{minipage}
    end{myalgo}}

    begin{document}
    begin{Algorithm}[t]{10cm}
    caption{Does work, though no nice solution.}
    end{Algorithm}
    end{document}









    share|improve this question



























      8












      8








      8


      1






      Looking for a way to set the width of an algorithm environment, preferably document wide (as opposed to per-algorithm). Thought it should be fairly easy, but couldn't find a particularly good solution.



      Found this one here (wrap an algorithm in a minipage in a float, which is relatively okay, but surely there's a simpler way)?



      documentclass{article}
      usepackage{algorithm}
      floatstyle{plain}
      newfloat{myalgo}{tbhp}{mya}

      newenvironment{Algorithm}[2][tbh]%
      {begin{myalgo}[#1]
      centering
      begin{minipage}{#2}
      begin{algorithm}[H]}%
      {end{algorithm}
      end{minipage}
      end{myalgo}}

      begin{document}
      begin{Algorithm}[t]{10cm}
      caption{Does work, though no nice solution.}
      end{Algorithm}
      end{document}









      share|improve this question
















      Looking for a way to set the width of an algorithm environment, preferably document wide (as opposed to per-algorithm). Thought it should be fairly easy, but couldn't find a particularly good solution.



      Found this one here (wrap an algorithm in a minipage in a float, which is relatively okay, but surely there's a simpler way)?



      documentclass{article}
      usepackage{algorithm}
      floatstyle{plain}
      newfloat{myalgo}{tbhp}{mya}

      newenvironment{Algorithm}[2][tbh]%
      {begin{myalgo}[#1]
      centering
      begin{minipage}{#2}
      begin{algorithm}[H]}%
      {end{algorithm}
      end{minipage}
      end{myalgo}}

      begin{document}
      begin{Algorithm}[t]{10cm}
      caption{Does work, though no nice solution.}
      end{Algorithm}
      end{document}






      algorithms width






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 22 '11 at 14:56









      Joseph Wright

      205k23563891




      205k23563891










      asked Dec 21 '10 at 4:00









      badroitbadroit

      3,45373352




      3,45373352






















          2 Answers
          2






          active

          oldest

          votes


















          9














          floatevery{algorithm}{setlengthhsize{10cm}} would limit the algorithm environment to a width of 10cm, but would not center it. (For additional centering one needs to re-define internal macros of the float package which does not sound like an elegant solution to me.)



          So I'm afraid, the solution you have found seems to be quite good and if you would like to have the width setting global you could simply change the definition of Algorithm, e.g.:




          documentclass{article}
          usepackage{algorithm}
          floatstyle{plain}
          newfloat{myalgo}{tbhp}{mya}

          newenvironment{Algorithm}[1][tbh]%
          {begin{myalgo}[#1]
          centering
          begin{minipage}{10cm}
          begin{algorithm}[H]}%
          {end{algorithm}
          end{minipage}
          end{myalgo}}

          begin{document}
          begin{Algorithm}[t]
          caption{Does work, though no nice solution.}
          end{Algorithm}
          end{document}





          share|improve this answer
























          • Thanks! (Just wanted to make sure I wasn't missing something.)

            – badroit
            Dec 21 '10 at 17:04



















          0














          You can include the algorithm in a figure.





          share








          New contributor




          fattah.safa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















            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%2f7484%2fset-width-of-algorithm-environment-preferably-document-wide%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









            9














            floatevery{algorithm}{setlengthhsize{10cm}} would limit the algorithm environment to a width of 10cm, but would not center it. (For additional centering one needs to re-define internal macros of the float package which does not sound like an elegant solution to me.)



            So I'm afraid, the solution you have found seems to be quite good and if you would like to have the width setting global you could simply change the definition of Algorithm, e.g.:




            documentclass{article}
            usepackage{algorithm}
            floatstyle{plain}
            newfloat{myalgo}{tbhp}{mya}

            newenvironment{Algorithm}[1][tbh]%
            {begin{myalgo}[#1]
            centering
            begin{minipage}{10cm}
            begin{algorithm}[H]}%
            {end{algorithm}
            end{minipage}
            end{myalgo}}

            begin{document}
            begin{Algorithm}[t]
            caption{Does work, though no nice solution.}
            end{Algorithm}
            end{document}





            share|improve this answer
























            • Thanks! (Just wanted to make sure I wasn't missing something.)

              – badroit
              Dec 21 '10 at 17:04
















            9














            floatevery{algorithm}{setlengthhsize{10cm}} would limit the algorithm environment to a width of 10cm, but would not center it. (For additional centering one needs to re-define internal macros of the float package which does not sound like an elegant solution to me.)



            So I'm afraid, the solution you have found seems to be quite good and if you would like to have the width setting global you could simply change the definition of Algorithm, e.g.:




            documentclass{article}
            usepackage{algorithm}
            floatstyle{plain}
            newfloat{myalgo}{tbhp}{mya}

            newenvironment{Algorithm}[1][tbh]%
            {begin{myalgo}[#1]
            centering
            begin{minipage}{10cm}
            begin{algorithm}[H]}%
            {end{algorithm}
            end{minipage}
            end{myalgo}}

            begin{document}
            begin{Algorithm}[t]
            caption{Does work, though no nice solution.}
            end{Algorithm}
            end{document}





            share|improve this answer
























            • Thanks! (Just wanted to make sure I wasn't missing something.)

              – badroit
              Dec 21 '10 at 17:04














            9












            9








            9







            floatevery{algorithm}{setlengthhsize{10cm}} would limit the algorithm environment to a width of 10cm, but would not center it. (For additional centering one needs to re-define internal macros of the float package which does not sound like an elegant solution to me.)



            So I'm afraid, the solution you have found seems to be quite good and if you would like to have the width setting global you could simply change the definition of Algorithm, e.g.:




            documentclass{article}
            usepackage{algorithm}
            floatstyle{plain}
            newfloat{myalgo}{tbhp}{mya}

            newenvironment{Algorithm}[1][tbh]%
            {begin{myalgo}[#1]
            centering
            begin{minipage}{10cm}
            begin{algorithm}[H]}%
            {end{algorithm}
            end{minipage}
            end{myalgo}}

            begin{document}
            begin{Algorithm}[t]
            caption{Does work, though no nice solution.}
            end{Algorithm}
            end{document}





            share|improve this answer













            floatevery{algorithm}{setlengthhsize{10cm}} would limit the algorithm environment to a width of 10cm, but would not center it. (For additional centering one needs to re-define internal macros of the float package which does not sound like an elegant solution to me.)



            So I'm afraid, the solution you have found seems to be quite good and if you would like to have the width setting global you could simply change the definition of Algorithm, e.g.:




            documentclass{article}
            usepackage{algorithm}
            floatstyle{plain}
            newfloat{myalgo}{tbhp}{mya}

            newenvironment{Algorithm}[1][tbh]%
            {begin{myalgo}[#1]
            centering
            begin{minipage}{10cm}
            begin{algorithm}[H]}%
            {end{algorithm}
            end{minipage}
            end{myalgo}}

            begin{document}
            begin{Algorithm}[t]
            caption{Does work, though no nice solution.}
            end{Algorithm}
            end{document}






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 21 '10 at 8:06









            Axel SommerfeldtAxel Sommerfeldt

            12.2k22855




            12.2k22855













            • Thanks! (Just wanted to make sure I wasn't missing something.)

              – badroit
              Dec 21 '10 at 17:04



















            • Thanks! (Just wanted to make sure I wasn't missing something.)

              – badroit
              Dec 21 '10 at 17:04

















            Thanks! (Just wanted to make sure I wasn't missing something.)

            – badroit
            Dec 21 '10 at 17:04





            Thanks! (Just wanted to make sure I wasn't missing something.)

            – badroit
            Dec 21 '10 at 17:04











            0














            You can include the algorithm in a figure.





            share








            New contributor




            fattah.safa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.

























              0














              You can include the algorithm in a figure.





              share








              New contributor




              fattah.safa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.























                0












                0








                0







                You can include the algorithm in a figure.





                share








                New contributor




                fattah.safa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.










                You can include the algorithm in a figure.






                share








                New contributor




                fattah.safa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share


                share






                New contributor




                fattah.safa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 3 mins ago









                fattah.safafattah.safa

                1011




                1011




                New contributor




                fattah.safa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                fattah.safa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                fattah.safa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






























                    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%2f7484%2fset-width-of-algorithm-environment-preferably-document-wide%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

                    Why does my Macbook overheat and use so much CPU and energy when on YouTube?Why do so many insist on using...

                    How to prevent page numbers from appearing on glossaries?How to remove a dot and a page number in the...

                    Puerta de Hutt Referencias Enlaces externos Menú de navegación15°58′00″S 5°42′00″O /...