1

I am trying to make my CV with moderncv, and am looking for a way to mask an ugly url in the homepage command (right under my name in the title). The problem has been solved already here: Moderncv shorthand URL in header.

Unfortunately the fix only works with the "classic" theme, but I am using the "banking" theme. There is example code given in the link above.

1 Answer 1

1

You have to change the name of the command to be patched. See in the following code line 8 for my changings:

\documentclass{moderncv}

\moderncvstyle{banking} % banking classic <=========================
\moderncvcolor{blue}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\makehead}% <cmd> % <========================================
  {\httplink{\@homepage}}% <search>
  {{\ifx\@homepage@shorthand\relax
     \httplink{\@homepage}% Used \homepage{<URL>}
   \else
     \httplink[\@homepage@shorthand]{\@homepage}% Used \homepage[<desc>]{<URL>}
   \fi}}% <replace>
  {}{}% <succes><failure>

\RenewDocumentCommand{\homepage}{o m}{%
  \let\@homepage@shorthand\relax%
  \providecommand\@homepage{#2}%
  \IfNoValueF{#1}{\def\@homepage@shorthand{#1}}%
}
\makeatother

\firstname{John}
\lastname{Doe}

\homepage[shorthand]{long link that I'd like to mask}

\begin{document}

\maketitle

\end{document}

with the result:

enter image description here

If the version of moderncv is changing it could be that the code above has to be reworked ...

If I add command \listfiles before \documentclass{} I get the following list of used class and packages and versions:

 *File List*
moderncv.cls    2015/07/28 v2.0.0 modern curriculum vitae and letter document class
  size11.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
etoolbox.sty    2015/08/02 v2.2a e-TeX tools for LaTeX (JAW)
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
  xcolor.sty    2007/01/21 v2.11 LaTeX color extensions (UK)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
colortbl.sty    2012/02/13 v1.0a Color table columns (DPC)
   array.sty    2014/10/28 v2.4c Tabular extension package (FMi)
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
 lmodern.sty    2009/10/30 v1.6 Latin Modern Fonts
     url.sty    2013/09/16  ver 3.4  Verb mode for urls, etc.
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2014/10/28 v1.0p Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg    2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
fancyhdr.sty    
tweaklist.sty    
    calc.sty    2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
  xparse.sty    2015/11/04 v6224 L3 Experimental document command parser
   expl3.sty    2015/11/04 v6224 L3 programming layer (loader) 
expl3-code.tex    2015/11/04 v6224 L3 programming layer 
l3unicode-data.def    2015/07/20 v5676 L3 Unicode data
l3pdfmode.def    2015/09/10 v5983 L3 Experimental driver: PDF mode
microtype.sty    2013/05/23 v2.5a Micro-typographical refinements (RS)
microtype-pdftex.def    2013/05/23 v2.5a Definitions specific to pdftex (RS)
microtype.cfg    2013/05/23 v2.5a microtype main configuration file (RS)
moderncvcollection.sty    2015/07/28 v2.0.0 moderncv collections
moderncvcompatibility.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter compatibility patches
moderncvstylebanking.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter style scheme: banking
tgpagella.sty    2009/09/27 v1.2 TeX Gyre Pagella as default roman family
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
moderncviconsawesome.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter icons: awesome
fontawesome.sty    2015/07/30 v4.4.0 font awesome icons
fontawesomesymbols-generic.tex
fontawesomesymbols-pdftex.tex
moderncvheadiii.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter header variant: 3
moderncvbodyiii.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter body variant: 3
   t1qpl.fd    2009/09/25 v1.2 font definition file for T1/qpl
ufontawesometwo.fd    2015/07/30 Font definitions for U/fontawesometwo.
moderncvcolorblue.sty    2015/07/28 v2.0.0 modern curriculum vitae and letter color scheme: blue
hyperref.sty    2012/11/06 v6.83m Hypertext links for LaTeX
hobsub-hyperref.sty    2012/04/25 v1.12 Bundle oberdiek, subset hyperref (HO)
hobsub-generic.sty    2012/04/25 v1.12 Bundle oberdiek, subset generic (HO)
  hobsub.sty    2012/04/25 v1.12 Construct package bundles (HO)
  ifvtex.sty    2010/03/01 v1.5 Detect VTeX and its facilities (HO)
 intcalc.sty    2007/09/27 v1.1 Expandable calculations with integers (HO)
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
pdfescape.sty    2011/11/25 v1.13 Implements pdfTeX's escape features (HO)
bigintcalc.sty    2012/04/08 v1.3 Expandable calculations on big integers (HO)
  bitset.sty    2011/01/30 v1.1 Handle bit-vector datatype (HO)
uniquecounter.sty    2011/01/30 v1.2 Provide unlimited unique counter (HO)
letltxmacro.sty    2010/09/02 v1.4 Let assignment for LaTeX macros (HO)
 hopatch.sty    2011/06/24 v1.1 Wrapper for package hooks (HO)
xcolor-patch.sty    2011/01/30 xcolor patch
atveryend.sty    2011/06/30 v1.8 Hooks at the very end of document (HO)
atbegshi.sty    2011/10/05 v1.16 At begin shipout hook (HO)
refcount.sty    2011/10/16 v3.4 Data extraction from label references (HO)
 hycolor.sty    2011/01/30 v1.7 Color options for hyperref/bookmark (HO)
 auxhook.sty    2011/03/04 v1.3 Hooks for auxiliary files (HO)
  pd1enc.def    2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO)
hyperref.cfg    2002/06/06 v1.2 hyperref configuration of TeXLive
   puenc.def    2012/11/06 v6.83m Hyperref: PDF Unicode definition (HO)
 hpdftex.def    2012/11/06 v6.83m Hyperref driver for pdfTeX
rerunfilecheck.sty    2011/04/15 v1.7 Rerun checks for auxiliary files (HO)
supp-pdf.mkii
  mt-ppl.cfg    2005/11/16 v1.6 microtype config. file: Palatino (RS)
 nameref.sty    2012/10/27 v2.43 Cross-referencing by name of section
gettitlestring.sty    2010/12/03 v1.4 Cleanup title references (HO) 

I'm using current MiKTeX 2.9: pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2015.7.19)

Please check your version.

2
  • Thanks so much for your help, but unfortunately it did not work. I tried copy-pasting your code into an empty document and compiling but was unable to reproduce your result. Instead it returns the error "missing \begin{document}. {}{fehler}". Perhaps we just have different versions of moderncv, as you said.
    – Lachy
    Nov 29, 2015 at 3:37
  • Yeah that might be the problem, I don't use MiKTeX. I just checked the version and it's pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian). Unfortunately I don't understand enough about TeX or Linux to know what the consequences of that are...
    – Lachy
    Nov 29, 2015 at 19:06

You must log in to answer this question.

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