0

I am creating my resume in Latex. I am having some space left at the bottom of my page after section 1 ends and when I start section 2 after it, it starts from new page rather than utilizing the space at the bottom. As we know, resume has to be as compact as possible and I need to fill up all the space that have on the page. How do I do that?

So far what I tried:

\begin{samepage}
section 1
section 2
\begin{samepage}

This would ensure that section 1 and section 2 are on same page. Assuming sections 1 and section 2 are small enough to fit in one page, latex will try to squeeze them in one page.

This is sort of a workaround. But as my resume starts to grow big, I want to automate this process. I can't manually make an estimate, where to put these \samepage blocks.

btw, I also tried

\nopagebreak

It doesn't work for me.

Any constructive suggestions are welcome. Thanks.

imnothere
  • 14,215
Bob
  • 21
  • 1
    Welcome. // Please post a complete document next time, which compiles when copied. // To fill pages while keeping the code short, it‘s a good idea to use package blindtext or lipsum from ctan. Thank you – MS-SPO Aug 07 '23 at 05:06
  • 1
    @MS-SPO Thank you for the suggestion, will do so. – Bob Aug 07 '23 at 21:39

1 Answers1

1

I solved my question by adding samepage declaration in the beginning and the end of the document, rather than choosing sections and making combinations. It seems, if I do so, Latex automatically tries to squeeze everything on a page, as much as it can.

\begin{document}
    \begin{samepage}
    .
    .
    document sections & content goes here
    .
    .
\end{samepage}

\end{document}

Bob
  • 21
  • 1
    This is the first time I see this. I have to test it to find out. But you have typo, the second one should be \end{samepage} I've used samepage before but found it causing some problems, so have not used it for long time myself. I prefer to use \begin{minipage} to keep things on same page and use it only for small items that want to be on same page. – Nasser Aug 07 '23 at 08:36
  • @Nasser you are right. I made a typo. I have corrected it. I will try out your suggestion with minipage. Thank you. – Bob Aug 07 '23 at 21:42