使用银行风格屏蔽 moderncv 中的 URL

使用银行风格屏蔽 moderncv 中的 URL

我正在尝试使用 moderncv 制作我的简历,并正在寻找一种方法来掩盖主页命令中丑陋的 URL(就在标题中我的名字下面)。问题已经在这里解决了:标题中的 Moderncv 简写 URL

不幸的是,此修复仅适用于“经典”主题,但我使用的是“银行”主题。上面的链接中给出了示例代码。

答案1

您必须更改要修补的命令的名称。请参阅以下代码行 8 中我的更改:

\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}

结果如下:

在此处输入图片描述

如果版本moderncv发生变化,则可能需要重新编写上述代码……

\listfiles如果我之前添加命令\documentclass{},我会得到以下使用的类、包和版本的列表:

 *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) 

我正在使用当前的 MiKTeX 2.9:pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9 64-bit) (preloaded format=pdflatex 2015.7.19)

请检查您的版本。

相关内容