Go to page:

Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

ModernCVClassIssues

Categories: CV, moderncv, example
<< | Page list | >>

How to Correct a Few Flaws in the LyX Output Using the moderncv Class

How to Correct a Few Flaws in the LyX Output Using the moderncv Class

As of LyX version 1.5.2, LyX has a couple of problems generating correct PDF output for the popular moderncv document class [CTAN]. The first issue discussed below is easily fixed by a workaround; the second requires hacking the style file. These are both minor edits, but they correct noticeable flaws that affect the impression the CV will make.

Formatting the header of the CV

Two minor issues related to the formatting of the CV header (name/title and address area). Both require hacking the style file, but are very easy.

Expanding the area in the upper right to accommodate more stuff

If you don't intend to put a photo in the upper right (as here: http://tug.ctan.org/macros/latex/contrib/moderncv/examples/template_classic_green.pdf), it's nice to use more of the white space at the top to include a web address or other information.

For example, a long place name would get wrapped a lot using the standard style file, as shown here. The same thing would happen if you used a web address in this area.

A simple change to one line of the style file (moderncvthemeclassic.sty) fixes this. You'll need to make a copy of the style file and edit it. Preserve the old one in its original location in your TeX distribution to avoid complications. You can put the edited style file in the same directory as the TeX file that you'll run pdflatex on, and pdflatex will find it there without additional instruction. The TeX file is your CV file; you can make one that looks good in LyX -- except for these issues -- and export the LaTeX from LyX to edit. (NOTE: You can edit the style file where it resides and LyX will use it, which is a solution that allows all PDF generation from LyX. However, I prefer the external processing. If you update the moderncv LaTeX package, it might overwrite your edits.)

Start by changing the name of the style file that you'll edit to something like moderncvthemeclassichack.sty. Then edit the TeX file for the CV to indicate that it will use your edited style file. Around line 15 there should be a line that reads something like this:

\moderncvtheme[blue, roman]{classic}

Using our example, you'll change it to this:

\moderncvtheme[blue, roman]{classichack}

The name of the edited style file should correspond to "moderncvtheme" plus whatever is in the curly brackets.

The edit to the style file will be on or around line 122, a line that reads like this:

\begin{minipage}[b]{.225\textwidth}%

Change it to this:

\begin{minipage}[c]{.5\textwidth}%

in order to add more space to the section on the right. Our example here. Notice that the name/title of the CV gets pushed around as well, and may not be satisfactory. A good fix requires one more edit to the style file (next).

Vertically centering the name/title

On or around line 112 will be a line that reads like this:

\begin{minipage}[b]{.525\textwidth}%

Change it to this (same as above):

\begin{minipage}[c]{.5\textwidth}%

Our example here. This may not be entirely correct tinkering for the minipages (e.g., pdflatex generates an error about overflow), but it works. You get the idea if you need to tinker with it some more.

How you generate the PDF from the TeX file and the edited style file will depend on your operating system. For Windows, it's as simple as having both files in the same directory, navigating to that directory from a command prompt, and typing:

pdflatex filename.tex

Once the run completes, press the Up arrow and run the same command another three times in a row (you might only need 2, but do 3 for good measure). The PDF (and three files you don't necessarily need to keep) will be created in the same directory.

Note: One may have to run the command "texhash" from the command line after editing the style file in order to have LyX find the newly named file.

Contributors

David Hewitt, Andreas Karlsson (ERT hack for #1), Liviu Andronic, Paul Rubin (explanation for #1), JPaul Rinehimer (hacks to the style file for #2)

CV, moderncv, example

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2014-02-04 04:04 CET