How to Move Contact Details in the ModernCV Oldstyle Template
At a glance
- 1. Find the header layout
Contact commands store your details; the Oldstyle header code determines where those details appear.
- 2. Locate the details block
Inspect the definition of makecvhead in the Oldstyle style file and identify the code that prints contact information.
- 3. Reorder the layout
Move the contact-information block to the position you want, then compile and adjust spacing.
- 4. Keep changes local
Put customizations in your document or a project-local style copy, not in a system-wide TeX installation.
In ModernCV, commands such as \email, \phone, and \address set your contact information. They do not usually determine its position on the page. The oldstyle style selects the header layout, often through a separate header component, so moving the details means changing that layout rather than changing the order of the contact commands.
The header implementation has changed between ModernCV versions. There is no single relocation command that works for every release. The reliable approach is to inspect the oldstyle style file and the header component it selects, find the code that prints the contact details, and move or rearrange that code.
Start with a minimal document
This example shows the standard setup. It compiles with ModernCV installed and produces the style’s default header; it does not itself move the contact details.
\documentclass[11pt,a4paper]{moderncv}
\moderncvstyle{oldstyle}
\moderncvcolor{blue}
\name{Ada}{Lovelace}
\address{12 Example Street}{London}{UK}
\phone[mobile]{+44 20 0000 0000}
\email{ada@example.com}
\homepage{example.com}
\begin{document}
\makecvtitle
\end{document}
The contact commands supply content to \makecvtitle. The oldstyle header code decides how that content is arranged. Reordering \email and \phone in the preamble may change their display order in some versions, but it will not generally move the whole contact block to a different part of the header.
Find the Oldstyle header code
First identify the style file TeX is using. In a terminal, run:
kpsewhich moderncvstyleoldstyle.sty
Open the resulting file to see which header component it selects. In many versions, the style file selects a separate moderncvhead... file, and the definition of \makecvhead or its helper commands is in that component rather than in moderncvstyleoldstyle.sty itself. Follow the selection and search the relevant installed files for \makecvhead and for the code that prints the contact details. Names and structure differ across releases, so check the actual files rather than assuming a particular internal command exists.
If the files are difficult to follow, you can also put \show\makecvhead in a temporary document after loading ModernCV and inspect the resulting definition in the log. This diagnostic can stop for interaction in an ordinary interactive TeX run; use nonstop mode if needed. Remove the debugging command afterward.
Move the details block
Suppose the style assembles the name and contact details in separate blocks. To put the details below the name, arrange the header code so the name is typeset first and the details block follows it, with a paragraph break or suitable vertical space between them. To put them in a separate column, place the two blocks in appropriately sized minipage environments or use the layout structure already present in the style file.
The important change is the position of the block that prints the details—not the values passed to \email or \phone. Preserve the surrounding formatting, font, and color commands from the installed style. A complete replacement of \makecvhead copied from a different ModernCV release can fail because internal commands and arguments may have changed.
For a small, one-off change, you can redefine the relevant header command in your document preamble after loading ModernCV. Copy the definition from your installed version and edit only the placement. If the style puts the layout directly inside \makecvhead, copy and adjust that definition. Use \makeatletter and \makeatother around a redefinition if it contains commands with @ in their names. Compile after each change so errors are easier to trace.
Keep the customization maintainable
Avoid editing the copy of moderncvstyleoldstyle.sty installed for the whole computer: a package update can overwrite the change, and it affects other documents. Prefer a preamble redefinition for a small change. If you need a larger redesign, keep a copy of the relevant style or header file in your project and document which ModernCV version it came from. A local copy can take precedence over the installed one, but it may need updating when you upgrade ModernCV.
Common mistakes
- Changing the contact commands and expecting a new layout. The commands store content; the style code controls placement.
- Copying a header definition from an online example without checking its version. Internal macros differ across releases, and a copied definition may use commands that your installation does not provide.
- Editing the system package file. This makes the change hard to reproduce and vulnerable to updates.
- Adding spacing without moving the block. Extra
\vspacecan create a gap, but it does not reliably relocate the details and may cause awkward page breaks. - Forgetting to compile the document after editing. Check the log for undefined commands and inspect the PDF to confirm that the revised header still fits on the page.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.