7

I'd like to have 3 lines for address with moderncv style. So I've added this lines in my file

\makeatletter
\renewcommand*{\address}[3]{\def\@addressstreet{#1}\def\@addresscity{#2}\def\@addresscountry{#3}}
\makeatother

\address{Street }{town}{Country}

but nothing has changed. Can anybody tell me how can I do?

Andrew Swann
  • 95,762
Hamed
  • 569

2 Answers2

8

moderncv has changed its syntax again so my old answer no longer works for a number of reasons. Anyway things are now much simpler because version 2.0.0 of moderncv now provides a command \makenewline that can be inserted in to the arguments of \address. Thus you can write

\address{street and number}{postcode city\makenewline county\makenewline country}

to place several arguments in the second part.

Sample output

\documentclass{moderncv}

\moderncvstyle{classic}

\name{John}{Doe}

\address{street and number}{postcode city\makenewline
county\makenewline country} 

\begin{document}

\makecvtitle

\end{document}
Andrew Swann
  • 95,762
3

The easiest solution is to simply use multi-line arguments, i.e. \address{Street}{Town\\Country}.

Your definition doesn't work, because \address only stores the information. The actual printing is done by the \maketitle command, which is redefined in the corresponding .sty file, i.e. moderncvthemeclassic.sty.

Thorsten
  • 12,872
  • 2
    Sorry but this doesn't work. I get this error message "!Argument of @firstoftow has an extra" – Hamed Dec 02 '12 at 19:44
  • I would correct here, using multi-line arguments is allowed only for the first one \address{Street\\Town}{Country} – Hamed Oct 01 '15 at 11:27