+ Real page_weighting = robust_scm2double (book_->paper_->c_variable ("page-spacing-weight"), 10);
+ int min_p_count = min_page_count (lines, page_h, ragged_all, ragged_last);
+ bool auto_first = to_boolean (book_->paper_->c_variable ("auto-first-page-number"));
+
+ /* If [START, END] does not contain an intermediate
+ breakpoint, we may need to consider solutions that result in a bad turn.
+ In this case, we won't abort if the min_page_count is too big */
+ if (start < end - 1 && min_p_count > 2)
+ return Break_node ();
+
+ /* if PAGE-NUMBER is odd, we are starting on a right hand page. That is, we
+ have the options
+ PAGE-NUMBER odd:
+ - even number of pages + a blank page
+ - odd number of pages
+ PAGE-NUMBER even:
+ - odd number of pages + a blank page
+ - even number of pages
+
+ No matter which case PAGE-NUMBER falls into, we take the second choice if
+ min_p_count has that evenness. (For example, if PAGE-NUMBER is even and
+ min_p_count is even, we don't even consider the blank page option). */
+
+ Spacing_result result;
+ if (start == 0 && auto_first)
+ {
+ if (min_p_count % 2)
+ result = space_systems_on_n_or_one_more_pages (lines, min_p_count, page_h, 0, ragged_all, ragged_last);
+ else
+ result = space_systems_on_n_pages (lines, min_p_count, page_h, ragged_all, ragged_last);
+ }
+ else if (page_number % 2 == min_p_count % 2)
+ result = space_systems_on_n_pages (lines, min_p_count, page_h, ragged_all, ragged_last);
+ else
+ result = space_systems_on_n_or_one_more_pages (lines, min_p_count, page_h, blank_force, ragged_all, ragged_last);