4

I'm looking to change the width of the \title environment in the moderncv template.

As it is now, the maximum width of the title under my name goes all the way to the "address"/information box on the right.

1
  • 2
    Can you show a minimal example?
    – egreg
    Commented Oct 10, 2013 at 20:32

2 Answers 2

4

The "header" (or title) under the classic moderncv style is comprised of three components: name, details, picture

enter image description here

Each are set in a box, but the width of the name box is calculated to fit exactly within the remaining text block if no other width is specified. So, unfortunately, there's no easy way to specify the gap between these boxes. Some options exist though:

  1. Insert some phantom space to the left of the widest entry in the details box;
  2. The following patch (with the aid of etoolbox) of \makecvtitle allows you to specify a length \namedetailsgap. Add this to your moderncv preamble:

    \usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
    \patchcmd{\makecvtitle}% <cmd>
      {\textwidth}% <search>
      {\textwidth-\namedetailsgap}% <replace>
      {}{}% <success><failure>
    \newlength{\namedetailsgap}\setlength{\namedetailsgap}{50pt}% Specify gap
    

    For example, the above patch changes this:

    enter image description here

    into this:

    enter image description here

    (For better line-spacing of multi-line titles, use \title{<title>\endgraf}.)

  3. Set the \title using \parbox[b]{\linewidth-<len>}{<title>} where you specify the length <len>. For example, output similar to the above is obtained via

    \title{\parbox[b]{\linewidth-50pt}{<title>}}
    

    (No need for \endgraf or \par here, since \parbox does this automatically.)

  4. Manually fiddle around with the length \makecvtitlenamewidth. As stated in the example template.tex,

    ...for the classic style, if you want to force the width allocated to your name and avoid line breaks. Be careful though, the length is normally calculated to avoid any overlap with your personal info; use this at your own typographical risks...

    The default is 0pt, which implies an automatic calculation of the required width to fit within the remainder of \textwidth after the details and picture boxes have been set.

1
  • The 4th solution works perfectly for me.
    – fstevens
    Commented Oct 20, 2014 at 14:23
1

Ah! I just found a way to limit the size of it in the ugly way.

Just take the line which is broades in the address/information field and write

\phantom{....}

in front of it. This "pushes" the title to the left. :-)

So my broadest field in the address field is \extrainfo, so I just put...

\extrainfo{\phantom{....}The extra information on me that was the broadest line in the information part}

...until I was happy with the subtitle lenght.

1
  • 1
    I'm not sure your solution is the best. Please show us a MWE.
    – Mensch
    Commented Oct 12, 2013 at 14:37

You must log in to answer this question.

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