How to vertically center a piece of text on a page? The 2019 Stack Overflow Developer Survey...

"Riffle" two strings

How to deal with fear of taking dependencies

How to reverse every other sublist of a list?

Evaluating number of iteration with a certain map with While

Lethal sonic weapons

JSON.serialize: is it possible to suppress null values of a map?

Why is it "Tumoren" and not "Tumore"?

On the insanity of kings as an argument against Monarchy

"To split hairs" vs "To be pedantic"

Why do UK politicians seemingly ignore opinion polls on Brexit?

Carnot-Caratheodory metric

What tool would a Roman-age civilisation use to reduce/breakup silver and other metals?

Monty Hall variation

Inversion Puzzle

Poison Arrows Piercing damage reduced to 0, do you still get poisoned?

What function has this graph?

Access elements in std::string where positon of string is greater than its size

How can I fix this gap between bookcases I made?

Limit the amount of RAM Mathematica may access?

Did USCIS resume its biometric service for UK visa?

Where does the "burst of radiance" from Holy Weapon originate?

Can't find the latex code for the ⍎ (down tack jot) symbol

What does "rabbited" mean/imply in this sentence?

What is the meaning of Triage in Cybersec world?



How to vertically center a piece of text on a page?



The 2019 Stack Overflow Developer Survey Results Are InHow to vertically center content in ConTeXt?Non-vertically-centered TikZ matrix of nodes cell contentVertical alignment of text within a table cellHow to typeset a vbox to a grid in plain TeX?How can I change the layout of a page (plain TeX)?How to align baselines of picture text and body text?Plain Tex: Get cell in table to span multiple rows, and contents to be centeredPlain TeX: Line up some text boxesHow to align vertically by right border?How to properly change page offsets?Can `showlists` display the page number at the bottom?












2















I've been searching how to center a piece of text vertically on a page, since I wanted to create a cover for my reports with the Title centered both vertically and horizontally. I first tried the following code:



vfil
centerline{Title}
vfil

ejectend


But this isn't centered vertically. So I found
this answer, and so I added leavevmode to the beginning of the file. And it worked! I also tried putting instead indentat the beginning of the original. And it also worked!



So my question is: Why do you need to start a paragraph or "leave vertical mode" before the first vfil in order for the glue to work in centering the text veertically on the page? It all seems very odd, indeed.










share|improve this question


















  • 2





    Because glue is discardable at a page break. p112 of The TeXBook explains the mechanism.

    – Thruston
    Jan 21 at 17:28






  • 1





    You can also use null or hbox{} or... many other options. The reason/idea of discarding glue at the top of a page is similar to discarding glue at the start of a line: after a line/page break, you don't want “leftover” glue from the previous line/page to affect the current one.

    – ShreevatsaR
    Jan 21 at 18:46













  • Note vspace* vs. vspace.

    – John Kormylo
    Jan 22 at 0:04













  • Didn't get that, John Kormylo.

    – tigre200
    Jan 23 at 21:22
















2















I've been searching how to center a piece of text vertically on a page, since I wanted to create a cover for my reports with the Title centered both vertically and horizontally. I first tried the following code:



vfil
centerline{Title}
vfil

ejectend


But this isn't centered vertically. So I found
this answer, and so I added leavevmode to the beginning of the file. And it worked! I also tried putting instead indentat the beginning of the original. And it also worked!



So my question is: Why do you need to start a paragraph or "leave vertical mode" before the first vfil in order for the glue to work in centering the text veertically on the page? It all seems very odd, indeed.










share|improve this question


















  • 2





    Because glue is discardable at a page break. p112 of The TeXBook explains the mechanism.

    – Thruston
    Jan 21 at 17:28






  • 1





    You can also use null or hbox{} or... many other options. The reason/idea of discarding glue at the top of a page is similar to discarding glue at the start of a line: after a line/page break, you don't want “leftover” glue from the previous line/page to affect the current one.

    – ShreevatsaR
    Jan 21 at 18:46













  • Note vspace* vs. vspace.

    – John Kormylo
    Jan 22 at 0:04













  • Didn't get that, John Kormylo.

    – tigre200
    Jan 23 at 21:22














2












2








2


1






I've been searching how to center a piece of text vertically on a page, since I wanted to create a cover for my reports with the Title centered both vertically and horizontally. I first tried the following code:



vfil
centerline{Title}
vfil

ejectend


But this isn't centered vertically. So I found
this answer, and so I added leavevmode to the beginning of the file. And it worked! I also tried putting instead indentat the beginning of the original. And it also worked!



So my question is: Why do you need to start a paragraph or "leave vertical mode" before the first vfil in order for the glue to work in centering the text veertically on the page? It all seems very odd, indeed.










share|improve this question














I've been searching how to center a piece of text vertically on a page, since I wanted to create a cover for my reports with the Title centered both vertically and horizontally. I first tried the following code:



vfil
centerline{Title}
vfil

ejectend


But this isn't centered vertically. So I found
this answer, and so I added leavevmode to the beginning of the file. And it worked! I also tried putting instead indentat the beginning of the original. And it also worked!



So my question is: Why do you need to start a paragraph or "leave vertical mode" before the first vfil in order for the glue to work in centering the text veertically on the page? It all seems very odd, indeed.







plain-tex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 21 at 17:12









tigre200tigre200

214




214








  • 2





    Because glue is discardable at a page break. p112 of The TeXBook explains the mechanism.

    – Thruston
    Jan 21 at 17:28






  • 1





    You can also use null or hbox{} or... many other options. The reason/idea of discarding glue at the top of a page is similar to discarding glue at the start of a line: after a line/page break, you don't want “leftover” glue from the previous line/page to affect the current one.

    – ShreevatsaR
    Jan 21 at 18:46













  • Note vspace* vs. vspace.

    – John Kormylo
    Jan 22 at 0:04













  • Didn't get that, John Kormylo.

    – tigre200
    Jan 23 at 21:22














  • 2





    Because glue is discardable at a page break. p112 of The TeXBook explains the mechanism.

    – Thruston
    Jan 21 at 17:28






  • 1





    You can also use null or hbox{} or... many other options. The reason/idea of discarding glue at the top of a page is similar to discarding glue at the start of a line: after a line/page break, you don't want “leftover” glue from the previous line/page to affect the current one.

    – ShreevatsaR
    Jan 21 at 18:46













  • Note vspace* vs. vspace.

    – John Kormylo
    Jan 22 at 0:04













  • Didn't get that, John Kormylo.

    – tigre200
    Jan 23 at 21:22








2




2





Because glue is discardable at a page break. p112 of The TeXBook explains the mechanism.

– Thruston
Jan 21 at 17:28





Because glue is discardable at a page break. p112 of The TeXBook explains the mechanism.

– Thruston
Jan 21 at 17:28




1




1





You can also use null or hbox{} or... many other options. The reason/idea of discarding glue at the top of a page is similar to discarding glue at the start of a line: after a line/page break, you don't want “leftover” glue from the previous line/page to affect the current one.

– ShreevatsaR
Jan 21 at 18:46







You can also use null or hbox{} or... many other options. The reason/idea of discarding glue at the top of a page is similar to discarding glue at the start of a line: after a line/page break, you don't want “leftover” glue from the previous line/page to affect the current one.

– ShreevatsaR
Jan 21 at 18:46















Note vspace* vs. vspace.

– John Kormylo
Jan 22 at 0:04







Note vspace* vs. vspace.

– John Kormylo
Jan 22 at 0:04















Didn't get that, John Kormylo.

– tigre200
Jan 23 at 21:22





Didn't get that, John Kormylo.

– tigre200
Jan 23 at 21:22










1 Answer
1






active

oldest

votes


















1














As mentioned in the comments TeX ignores glue at the end or top of a
page as it does ignore glue at the end or start of a line.



But plain TeX knows some commands for glue that does not vanish; you do not need to enter a special command like leavevmode. For glue
at the top of a page topglue is used instead of topskip. (And there is hglue and vglue as non-discarding variants of hskip and vskip.)



For your problem this topglue provides a solution. As bye contains vfill, i.e., glue with specification 0pt plus 1fill, input



topglue 0pt plus 1fill
centerline{Titel}
bye





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%2f471163%2fhow-to-vertically-center-a-piece-of-text-on-a-page%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    As mentioned in the comments TeX ignores glue at the end or top of a
    page as it does ignore glue at the end or start of a line.



    But plain TeX knows some commands for glue that does not vanish; you do not need to enter a special command like leavevmode. For glue
    at the top of a page topglue is used instead of topskip. (And there is hglue and vglue as non-discarding variants of hskip and vskip.)



    For your problem this topglue provides a solution. As bye contains vfill, i.e., glue with specification 0pt plus 1fill, input



    topglue 0pt plus 1fill
    centerline{Titel}
    bye





    share|improve this answer




























      1














      As mentioned in the comments TeX ignores glue at the end or top of a
      page as it does ignore glue at the end or start of a line.



      But plain TeX knows some commands for glue that does not vanish; you do not need to enter a special command like leavevmode. For glue
      at the top of a page topglue is used instead of topskip. (And there is hglue and vglue as non-discarding variants of hskip and vskip.)



      For your problem this topglue provides a solution. As bye contains vfill, i.e., glue with specification 0pt plus 1fill, input



      topglue 0pt plus 1fill
      centerline{Titel}
      bye





      share|improve this answer


























        1












        1








        1







        As mentioned in the comments TeX ignores glue at the end or top of a
        page as it does ignore glue at the end or start of a line.



        But plain TeX knows some commands for glue that does not vanish; you do not need to enter a special command like leavevmode. For glue
        at the top of a page topglue is used instead of topskip. (And there is hglue and vglue as non-discarding variants of hskip and vskip.)



        For your problem this topglue provides a solution. As bye contains vfill, i.e., glue with specification 0pt plus 1fill, input



        topglue 0pt plus 1fill
        centerline{Titel}
        bye





        share|improve this answer













        As mentioned in the comments TeX ignores glue at the end or top of a
        page as it does ignore glue at the end or start of a line.



        But plain TeX knows some commands for glue that does not vanish; you do not need to enter a special command like leavevmode. For glue
        at the top of a page topglue is used instead of topskip. (And there is hglue and vglue as non-discarding variants of hskip and vskip.)



        For your problem this topglue provides a solution. As bye contains vfill, i.e., glue with specification 0pt plus 1fill, input



        topglue 0pt plus 1fill
        centerline{Titel}
        bye






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 hours ago









        Udo WermuthUdo Wermuth

        830511




        830511






























            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%2f471163%2fhow-to-vertically-center-a-piece-of-text-on-a-page%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

            IEEEtran - How to include ORCID in TeX/PDF with PdfLatexIs there a standard way to include ORCID in TeX /...

            Cicindela nigrior Przypisy | Menu nawigacyjneCicindela varians unicolorManual for the Identification of the...

            Glossaries-extra: Adding glossaries package to “Clas­sicTh­e­sis” template by Dr. André Miede v. 4.6 ...