1

How can I control automatically the minimum number of lines(5 lines) in last page when it ends with reference list?

\documentclass{article}

\begin{document}

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  This text should
contain all letters of the alphabet and it should be written in of the
original language.There is no need for special content, but the length of
words should match the language.

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  This text should
contain all letters of the alphabet and it should be written in of the
original language.There is no need for special content, but the length of
words should match the language.

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  This text should
contain all letters of the alphabet and it should be written in of the
original language.There is no need for special content, but the length of
words should match the language.

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  This text should
contain all letters of the alphabet and it should be written in of the
original language.There is no need for special content, but the length of
words should match the language.

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  This text should
contain all letters of the alphabet and it should be written in of the
original language.There is no need for special content, but the length of
words should match the language.

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  This text should
contain all letters of the alphabet and it should be written in of the
original language.There is no need for special content, but the length of
words should match the language.

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  This text should
contain all letters of the alphabet and it should be written in of the
original language.There is no need for special content, but the length of
words should match the language.

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  This text should
contain all letters of the alphabet and it should be written in of the
original language.There is no need for special content, but the length of
words should match the language.

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  This text should
contain all letters of the alphabet and it should be written in of the
original language.There is no need for special content, but the length of
words should match the language.

Hello, here is some text without a meaning.  This text should show what 
a printed text will look like at this place.  If you read this text, 
you will get no information.  Really?  Is there no information?  Is there 
a difference between this text and some nonsense like not at all!  A 
blind text like this gives you information about the selected font, how 
the letters are written and an impression of the look.  

\begin{thebibliography}{}

\bibitem{01} Blankenship, B. (1998). Baker roll 1924: Eastern Band of Cherokee Indians of North Carolina. Cherokee, NC: Cherokee Roots.

\bibitem{02} Kempe, C. H., \& Helfer, R. E. (1980). The battered child (5th ed.). Chicago, IL: University of Chicago Press.

\bibitem{03} World Bank (2004). Gender and development in the Middle East and North Africa: women in the public sphere. Washington, DC: Author.

\bibitem{04} Duncan, G. J., \& Brooks-Gunn, J. (Eds.). (1997). Consequences of growing up poor. New York, NY: Russell Sage Foundation.

\bibitem{05} Ickes, W. (Ed.). (1998). Empathic accuracy. New York, NY: Guilford Press.

\end{thebibliography}

\end{document}
3
  • 1
    Off-topic: Don't leave the mandatory argument of the thebibliography environment blank. Instead, specify a single-digit number (say, 9) if the bibliography has fewer than 10 entries, a two-digit number (say, 99) if the bibliography has more than 9 but fewer than 100 entries, etc.
    – Mico
    Apr 23, 2020 at 6:03
  • Maximizing (or, minimizing, as the case may be) your objective function -- "control automatically the minimum number of lines(5 lines) in last page" of the document -- can not be done in general. The page layout problem does feature a very large number of potentially free parameters. The key word, though, is "potentially": The paper size, the height and width of the text block, the text and math font in use, the font size, the distance between lines of text, the average inter-word distance, and many other parameters may be determined by your publisher -- and thus may not yours to fiddle with.
    – Mico
    Apr 23, 2020 at 6:13
  • Without claim that this a solution, nor that this will help in any situation, consider allow some paragraph glue. For example, with \parskip 1sp plus 12ex minus 1sp in the preamble will be make very hard break the references at any point, but at the cost of a big gap at the end of normal text, whilst using the parskip package defaults, or some like \parskip 1ex plus 3ex minus .9ex will avoid that last gap (at the cost of allow some spaces between paragraphs) but allow a orphan reference in some situations, but probably the result will be better in many cases.
    – Fran
    Apr 23, 2020 at 9:35

2 Answers 2

1

You can test if the end of the second item is near of the end of page, and break the page if this is true:

\ifdim\pagetotal > 460pt  \newpage \fi 

This generally will work as expected with less or more text, but if you add exactly only 12-14 lines, \pagetotal will be about 530pt or so (that is, near of \pagegoal of 550pt). Then LaTeX could decide that there a optimal break between 1st and 2nd references without reset before \pagetotal to 0.0pt.

I don't know now how to solve this correctly, but a poor man solution for this MWE could be a nested conditional to make the page break when the third item is near (but not very near) of the \pagegoal:

\ifdim \dimexpr\pagetotal+7\baselineskip  > \pagegoal  
   \ifdim \dimexpr\pagetotal+2\baselineskip  > \pagegoal
      \else \newpage 
   \fi
\fi 
0

Let us avoid the aesthetic aspect of tables and assume you want to scale an image to fit the rest of the page.

The 2\lineskip is a guess on my part. Removing it makes the image too large, but without the \vfill there is a small gap below the image.

\documentclass{article}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{showframe}

\begin{document}

\lipsum[1-3]

\vfill{\centering
\includegraphics[width=\textwidth, height={\dimexpr \pagegoal-\pagetotal-2\lineskip}, 
  keepaspectratio]{example-image}
\par}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .