How to Change the Title Width in moderncv Classic
At a glance
- 1. Choose the width
Decide whether you want to wrap only the title text or change the whole header text area.
- 2. Set a title box
Put the title in a parbox with the width you want; this controls where it wraps.
- 3. Compile and adjust
Change the width value and check the result with your chosen font, page size, and photo.
In the classic style, the width available for the title is normally determined by moderncv’s title layout. There is no general \titlewidth command that controls just the title text. A simple way to set its wrapping width is to put the title in a box of a chosen width.
The example below gives the title a width of 65% of the text area. It wraps onto another line if it needs more room; change 0.65 to suit your layout.
Set the width of the title text
Use \parbox inside \title:
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\name{Ada}{Lovelace}
\title{\parbox[t]{0.65\textwidth}{\centering Mathematician and writer with a longer professional title}}
\begin{document}
\makecvtitle
\end{document}
This is a complete example using the moderncv class and its built-in classic style. The \parbox[t]{...}{...} creates a text box with the specified width; [t] aligns the top of that box with surrounding material. The style still applies its normal title font and color. Because the \parbox establishes its own paragraph formatting, put \centering inside it to retain the classic style’s centered title. If you want the title aligned differently inside the box, use a declaration such as \raggedright instead:
\title{\parbox[t]{0.65\textwidth}{\raggedright
Mathematician and writer with a longer professional title}}
A narrower box does not shrink the font: it makes the text wrap sooner. A wider box gives the title more room before it wraps. If you want a particular line break regardless of the available width, insert \\ in the title text instead.
If you mean the whole header width
Sometimes “title width” means the width of the entire block containing your name, title, and contact details. That is different from the width of the title text alone. In the classic layout, a photo can reduce the room available to the text block. Try reducing the photo’s width or removing the photo if you need more room:
\photo[50pt][0.4pt]{portrait}
The first optional value sets the photo width. The precise appearance also depends on the moderncv version and document layout. There is no single public length that reliably changes only the complete header block across all versions. If you need a custom header layout, inspect the \makecvtitle definition in the version of moderncv installed on your system before patching it.
Common mistakes
- Looking for
\titlewidth: moderncv does not define a general command with that name for the classic title. The\parboxapproach works directly with the title text. - Expecting the font to resize: changing the box width affects line wrapping, not the title font size. Use a font-size change only if the title itself should be smaller.
- Changing
\textwidthglobally: altering the document’s text width affects the CV body as well as the heading. Use a box when only the title should change. - Using a width that exceeds the available header area: the box may overlap a photo or extend into the margin. Test the output with the actual photo and paper size you plan to use.
For a title that must fit on one line, choose a sufficiently wide box or shorten the text; LaTeX will not automatically scale the title font to make it fit.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.