How to draw rule from left text edge to right paper edge without overfull?











up vote
2
down vote

favorite












I'm currently using the following instruction to draw a horizontal rule from the left edge of the text body to the right edge of the paper:



rule{paperwidth}{2pt}


This works, but it results in an overfull warning:



Overfull hbox (232.295pt too wide) in paragraph at lines 12--13


The proper way to do this is probably to calculate the actual length, but I don't know how to do this. I read about an addtolength instruction but am not sure what I can add together. Can someone advise?










share|improve this question




















  • 1




    For oneside you can use noindentrlap{rule{dimexpr paperwidth - 1in - oddsidemargin}{2pt}}
    – John Kormylo
    Dec 4 at 15:19










  • Use a TikZ picture.
    – JouleV
    Dec 4 at 15:28










  • @DũngVũ Seems like overkill.
    – Roxy
    Dec 4 at 19:57















up vote
2
down vote

favorite












I'm currently using the following instruction to draw a horizontal rule from the left edge of the text body to the right edge of the paper:



rule{paperwidth}{2pt}


This works, but it results in an overfull warning:



Overfull hbox (232.295pt too wide) in paragraph at lines 12--13


The proper way to do this is probably to calculate the actual length, but I don't know how to do this. I read about an addtolength instruction but am not sure what I can add together. Can someone advise?










share|improve this question




















  • 1




    For oneside you can use noindentrlap{rule{dimexpr paperwidth - 1in - oddsidemargin}{2pt}}
    – John Kormylo
    Dec 4 at 15:19










  • Use a TikZ picture.
    – JouleV
    Dec 4 at 15:28










  • @DũngVũ Seems like overkill.
    – Roxy
    Dec 4 at 19:57













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I'm currently using the following instruction to draw a horizontal rule from the left edge of the text body to the right edge of the paper:



rule{paperwidth}{2pt}


This works, but it results in an overfull warning:



Overfull hbox (232.295pt too wide) in paragraph at lines 12--13


The proper way to do this is probably to calculate the actual length, but I don't know how to do this. I read about an addtolength instruction but am not sure what I can add together. Can someone advise?










share|improve this question















I'm currently using the following instruction to draw a horizontal rule from the left edge of the text body to the right edge of the paper:



rule{paperwidth}{2pt}


This works, but it results in an overfull warning:



Overfull hbox (232.295pt too wide) in paragraph at lines 12--13


The proper way to do this is probably to calculate the actual length, but I don't know how to do this. I read about an addtolength instruction but am not sure what I can add together. Can someone advise?







rules width layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 4 at 16:46









Werner

434k619531639




434k619531639










asked Dec 4 at 15:03









Roxy

3465




3465








  • 1




    For oneside you can use noindentrlap{rule{dimexpr paperwidth - 1in - oddsidemargin}{2pt}}
    – John Kormylo
    Dec 4 at 15:19










  • Use a TikZ picture.
    – JouleV
    Dec 4 at 15:28










  • @DũngVũ Seems like overkill.
    – Roxy
    Dec 4 at 19:57














  • 1




    For oneside you can use noindentrlap{rule{dimexpr paperwidth - 1in - oddsidemargin}{2pt}}
    – John Kormylo
    Dec 4 at 15:19










  • Use a TikZ picture.
    – JouleV
    Dec 4 at 15:28










  • @DũngVũ Seems like overkill.
    – Roxy
    Dec 4 at 19:57








1




1




For oneside you can use noindentrlap{rule{dimexpr paperwidth - 1in - oddsidemargin}{2pt}}
– John Kormylo
Dec 4 at 15:19




For oneside you can use noindentrlap{rule{dimexpr paperwidth - 1in - oddsidemargin}{2pt}}
– John Kormylo
Dec 4 at 15:19












Use a TikZ picture.
– JouleV
Dec 4 at 15:28




Use a TikZ picture.
– JouleV
Dec 4 at 15:28












@DũngVũ Seems like overkill.
– Roxy
Dec 4 at 19:57




@DũngVũ Seems like overkill.
– Roxy
Dec 4 at 19:57










3 Answers
3






active

oldest

votes

















up vote
1
down vote



accepted










Without any package:



documentclass{article}

begin{document}

Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.

noindentmakebox[0pt][l]{rule{paperwidth}{2pt}}par
Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.

end{document}


enter image description here






share|improve this answer




























    up vote
    1
    down vote













    You can also use tikz package.



    documentclass{article}
    usepackage{tikz}
    usepackage{lipsum}
    begin{document}

    lipsum[1]

    noindentbegin{tikzpicture}[remember picture,overlay]
    draw [line width=2pt] (0,0) -- (paperwidth, 0);
    end{tikzpicture}

    lipsum[2]
    end{document}


    enter image description here






    share|improve this answer




























      up vote
      0
      down vote













      Under onside (the default) mode in article, the length from the left side of the text block to the right side of the page is given by



      paperwidth - oddsidemargin - 1in - hoffset
      % ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      % left margin


      To see this, load the layout package and issue layout to see what lengths are at work:



      enter image description here



      However, as long as the length is longer than the above length, it'll stretch all the way to the right side of the page. So, you can just use paperwidth. Here's a macro version that allows some adjustment of the width via an optional argument:



      enter image description here



      documentclass{article}

      newcommand{fullrule}[1][2pt]{%
      parnobreaknoindent
      makebox[0pt][l]{%
      rule[.5ex]{paperwidth}{#1}}par
      }

      usepackage{lipsum}

      begin{document}

      sloppylipsum[1]

      fullrule

      lipsum[2]

      fullrule[.4pt]

      lipsum[3]

      end{document}


      Note that we place the rule inside a zero-width box to avoid any warnings about an overfull hbox.






      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',
        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%2f463160%2fhow-to-draw-rule-from-left-text-edge-to-right-paper-edge-without-overfull%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        1
        down vote



        accepted










        Without any package:



        documentclass{article}

        begin{document}

        Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.

        noindentmakebox[0pt][l]{rule{paperwidth}{2pt}}par
        Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.

        end{document}


        enter image description here






        share|improve this answer

























          up vote
          1
          down vote



          accepted










          Without any package:



          documentclass{article}

          begin{document}

          Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.

          noindentmakebox[0pt][l]{rule{paperwidth}{2pt}}par
          Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.

          end{document}


          enter image description here






          share|improve this answer























            up vote
            1
            down vote



            accepted







            up vote
            1
            down vote



            accepted






            Without any package:



            documentclass{article}

            begin{document}

            Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.

            noindentmakebox[0pt][l]{rule{paperwidth}{2pt}}par
            Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.

            end{document}


            enter image description here






            share|improve this answer












            Without any package:



            documentclass{article}

            begin{document}

            Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.

            noindentmakebox[0pt][l]{rule{paperwidth}{2pt}}par
            Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.

            end{document}


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 4 at 16:06









            Bernard

            164k769192




            164k769192






















                up vote
                1
                down vote













                You can also use tikz package.



                documentclass{article}
                usepackage{tikz}
                usepackage{lipsum}
                begin{document}

                lipsum[1]

                noindentbegin{tikzpicture}[remember picture,overlay]
                draw [line width=2pt] (0,0) -- (paperwidth, 0);
                end{tikzpicture}

                lipsum[2]
                end{document}


                enter image description here






                share|improve this answer

























                  up vote
                  1
                  down vote













                  You can also use tikz package.



                  documentclass{article}
                  usepackage{tikz}
                  usepackage{lipsum}
                  begin{document}

                  lipsum[1]

                  noindentbegin{tikzpicture}[remember picture,overlay]
                  draw [line width=2pt] (0,0) -- (paperwidth, 0);
                  end{tikzpicture}

                  lipsum[2]
                  end{document}


                  enter image description here






                  share|improve this answer























                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    You can also use tikz package.



                    documentclass{article}
                    usepackage{tikz}
                    usepackage{lipsum}
                    begin{document}

                    lipsum[1]

                    noindentbegin{tikzpicture}[remember picture,overlay]
                    draw [line width=2pt] (0,0) -- (paperwidth, 0);
                    end{tikzpicture}

                    lipsum[2]
                    end{document}


                    enter image description here






                    share|improve this answer












                    You can also use tikz package.



                    documentclass{article}
                    usepackage{tikz}
                    usepackage{lipsum}
                    begin{document}

                    lipsum[1]

                    noindentbegin{tikzpicture}[remember picture,overlay]
                    draw [line width=2pt] (0,0) -- (paperwidth, 0);
                    end{tikzpicture}

                    lipsum[2]
                    end{document}


                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 4 at 16:24









                    javadr

                    1,303313




                    1,303313






















                        up vote
                        0
                        down vote













                        Under onside (the default) mode in article, the length from the left side of the text block to the right side of the page is given by



                        paperwidth - oddsidemargin - 1in - hoffset
                        % ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                        % left margin


                        To see this, load the layout package and issue layout to see what lengths are at work:



                        enter image description here



                        However, as long as the length is longer than the above length, it'll stretch all the way to the right side of the page. So, you can just use paperwidth. Here's a macro version that allows some adjustment of the width via an optional argument:



                        enter image description here



                        documentclass{article}

                        newcommand{fullrule}[1][2pt]{%
                        parnobreaknoindent
                        makebox[0pt][l]{%
                        rule[.5ex]{paperwidth}{#1}}par
                        }

                        usepackage{lipsum}

                        begin{document}

                        sloppylipsum[1]

                        fullrule

                        lipsum[2]

                        fullrule[.4pt]

                        lipsum[3]

                        end{document}


                        Note that we place the rule inside a zero-width box to avoid any warnings about an overfull hbox.






                        share|improve this answer

























                          up vote
                          0
                          down vote













                          Under onside (the default) mode in article, the length from the left side of the text block to the right side of the page is given by



                          paperwidth - oddsidemargin - 1in - hoffset
                          % ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          % left margin


                          To see this, load the layout package and issue layout to see what lengths are at work:



                          enter image description here



                          However, as long as the length is longer than the above length, it'll stretch all the way to the right side of the page. So, you can just use paperwidth. Here's a macro version that allows some adjustment of the width via an optional argument:



                          enter image description here



                          documentclass{article}

                          newcommand{fullrule}[1][2pt]{%
                          parnobreaknoindent
                          makebox[0pt][l]{%
                          rule[.5ex]{paperwidth}{#1}}par
                          }

                          usepackage{lipsum}

                          begin{document}

                          sloppylipsum[1]

                          fullrule

                          lipsum[2]

                          fullrule[.4pt]

                          lipsum[3]

                          end{document}


                          Note that we place the rule inside a zero-width box to avoid any warnings about an overfull hbox.






                          share|improve this answer























                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            Under onside (the default) mode in article, the length from the left side of the text block to the right side of the page is given by



                            paperwidth - oddsidemargin - 1in - hoffset
                            % ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                            % left margin


                            To see this, load the layout package and issue layout to see what lengths are at work:



                            enter image description here



                            However, as long as the length is longer than the above length, it'll stretch all the way to the right side of the page. So, you can just use paperwidth. Here's a macro version that allows some adjustment of the width via an optional argument:



                            enter image description here



                            documentclass{article}

                            newcommand{fullrule}[1][2pt]{%
                            parnobreaknoindent
                            makebox[0pt][l]{%
                            rule[.5ex]{paperwidth}{#1}}par
                            }

                            usepackage{lipsum}

                            begin{document}

                            sloppylipsum[1]

                            fullrule

                            lipsum[2]

                            fullrule[.4pt]

                            lipsum[3]

                            end{document}


                            Note that we place the rule inside a zero-width box to avoid any warnings about an overfull hbox.






                            share|improve this answer












                            Under onside (the default) mode in article, the length from the left side of the text block to the right side of the page is given by



                            paperwidth - oddsidemargin - 1in - hoffset
                            % ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                            % left margin


                            To see this, load the layout package and issue layout to see what lengths are at work:



                            enter image description here



                            However, as long as the length is longer than the above length, it'll stretch all the way to the right side of the page. So, you can just use paperwidth. Here's a macro version that allows some adjustment of the width via an optional argument:



                            enter image description here



                            documentclass{article}

                            newcommand{fullrule}[1][2pt]{%
                            parnobreaknoindent
                            makebox[0pt][l]{%
                            rule[.5ex]{paperwidth}{#1}}par
                            }

                            usepackage{lipsum}

                            begin{document}

                            sloppylipsum[1]

                            fullrule

                            lipsum[2]

                            fullrule[.4pt]

                            lipsum[3]

                            end{document}


                            Note that we place the rule inside a zero-width box to avoid any warnings about an overfull hbox.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Dec 4 at 16:44









                            Werner

                            434k619531639




                            434k619531639






























                                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.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • 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%2f463160%2fhow-to-draw-rule-from-left-text-edge-to-right-paper-edge-without-overfull%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 to send String Array data to Server using php in android

                                Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                                Is anime1.com a legal site for watching anime?