[Tex/LaTex] In ModernCV, how to define a command in the cls style file to allow lines with right-aligned word.

horizontal alignmentmoderncv

I am using ModernCV for my CV. I want to achieve something like the following example (please note that the address "align2@rightMargin.com" is aligned to the right margin):

Example

Please note the last word is not necessarily an email address but any other word. In the example above what I used is the \hspace command, so I have to estimate the hspace manually everytime I change length of the sentence. I notice \raggedleft may be the right command, but I don't know how to make a command like \cvline in the ModernCV cls file to achieve the above example. Any help will be highly appreciated.

Best Answer

You can use \hfill rather than \hspace and it should work.