How to Prevent Orphaned cventry Titles at Page Breaks in ModernCV: LaTeX Commands Explained

Use \needspace{5\baselineskip} immediately before each \cventry block to check for available vertical space and force a page break if the title would separate from its bullet list, keeping entries intact across page boundaries.

When compiling a professional CV using the ModernCV Banking template, LaTeX may split \cventry headers from their associated descriptions at page boundaries, creating unsightly orphaned titles. The MadsLorentzen/ai-job-search repository solves this pagination issue by implementing specific spacing commands from the needspace package that ensure each entry remains visually cohesive.

Understanding the Orphaned Title Problem in ModernCV

The \cventry command in ModernCV renders job and education entries with a title line followed by descriptive bullet lists. When an entry falls near the bottom of a page, LaTeX's default breaking algorithm can separate the title from its content, leaving the header isolated on one page while the details continue on the next. This breaks the visual hierarchy and reduces readability for ATS systems and human reviewers alike.

The LaTeX Commands That Fix Page Breaks

Two specific commands control pagination behavior to prevent orphaned titles.

\needspace{5\baselineskip} — The Primary Prevention Command

The \needspace command, provided by the standard needspace package (already loaded by ModernCV), checks whether 5 × the current line height remains available on the current page. If insufficient space exists, LaTeX inserts a page break before the following material, ensuring the entire \cventry block moves to the next page as a unit.

Place this command immediately before each \cventry entry within the itemize environment.

\enlargethispage{2-3\baselineskip} — The Emergency Adjustment

When the final page of your CV ends with a stray title that cannot fit with its content, \enlargethispage grows the current page by the specified amount (typically 2–3 baselines) to accommodate the trailing block. This command acts as a surgical fix for specific overflow scenarios after a series of entries.

Implementation Guide for the Banking Template

According to the repository's CLAUDE.md documentation and the master template structure in cv/main_example.tex, implement these commands as follows:

\section{Professional Experience}
\vspace{3pt}
\begin{itemize}

% --- Most Recent Role ---
\needspace{5\baselineskip}% Prevent orphaned title
\item{\cventry{[YYYY--Present]}{[Job Title]}{[Company]}{[City, Country]}{}{\vspace{1pt}
  \begin{itemize}
    \item Achievement 1
    \item Achievement 2
  \end{itemize}}}

\vspace{3pt}

% --- Previous Role ---
\needspace{5\baselineskip}% Prevent orphaned title
\item{\cventry{[YYYY--YYYY]}{[Job Title]}{[Company]}{[City, Country]}{}{\vspace{1pt}
  \begin{itemize}
    \item Achievement 1
    \item Achievement 2
  \end{itemize}}}

\end{itemize}

For trailing blocks that persistently overflow, add the following after your final entry list:

\enlargethispage{2\baselineskip}

This pattern ensures your CV maintains exactly two pages while preserving entry integrity.

Summary

  • \needspace{5\baselineskip} checks for five lines of available space before each \cventry, forcing a page break if the entry would split across pages.
  • \enlargethispage{2-3\baselineskip} optionally extends the final page to accommodate entries that would otherwise orphan at the end of the document.
  • These commands reside in the needspace package, which ModernCV loads automatically, requiring no additional dependencies.
  • The repository documents this fix in CLAUDE.md and demonstrates the structure in cv/main_example.tex.

Frequently Asked Questions

What causes orphaned titles in ModernCV?

LaTeX's default page breaking algorithm prioritizes filling pages over keeping logical content blocks together. When a \cventry title appears near the bottom of a page without sufficient remaining space for its bullet list, the compiler splits the entry, leaving the title isolated on the preceding page.

How much space should I reserve with \needspace?

The repository recommends 5 baselines (5\baselineskip) as this accommodates the title line, the nested itemize environment, and approximately two bullet points. This ensures the title travels with its primary content to the next page.

Can I use these commands with other CV templates?

Yes. While the ai-job-search repository targets the ModernCV Banking template, \needspace and \enlargethispage work with any LaTeX document class. These commands are particularly valuable for any template using nested list structures or sectional entries that must remain visually contiguous.

Where are these commands documented in the repository?

The \needspace pattern appears in the "Verification Checklist" section of CLAUDE.md, while the structural context for \cventry entries is visible in cv/main_example.tex. The repository guidelines specify applying these commands when tailoring the CV for specific roles to maintain professional pagination.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →