在 OverleafV1 中,可以使用以下代码moderncv
\homepage{LinkIn.com}{LinkedIn Profile}
这会将网站 ( LinkedIn.com
) 隐藏为一段文本“LinkedIn Profile”。
合并 ShareLatex/OverleafV2 后,双括号会出现错误,只有单括号可以正常工作。
我曾尝试使用\hyperref
并且\url
但文档首先在该语句下开始几行,从而产生了错误。
\usepackage{hyperref}
\homepage{\url{LinkedIn.com}}
\homepage{\hyperref{LinkedIn.com}}
使用这个模板
还有其他方法可以解决这个问题吗?谢谢
编辑:
\homepage{LinkedIn.com}{LinkedIn Profile} %This code will work in OverleafV1
same code will not work in OverleafV2 or ShareLatex but...
\homepage{LinkedIn.com} %This works in OverleafV2 or ShareLatex but as soon as a second bracket is added it doesn't hide the link in the name.
而是将第二个括号放在\firstname{}
pdf 上的文本上。
这样可能更容易理解?
编辑2:
\documentclass[12pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage{lipsum}
\usepackage[scale=0.75]{geometry}
\usepackage[danish]{babel}%Overskrift på indholdsfortegnelse dansk%
%\usepackage{hyperref}
\usepackage{multicol}
\usepackage{graphicx}
%----------------------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------
\firstname{X} % Your first name
\familyname{Y} % Your last name
% All information in this block is optional, comment out any lines you don't need
\title{A}
\extrainfo{B}
\address{C}{D}
\mobile{E}
\email{F}
\homepage{LinkedIn.com}{LinkedIn Profile}
% The first argument is the url for the clickable link, the second argument is the url displayed in the template - this allows special characters to be displayed such as the tilde in this example
\photo[70pt][0.4pt]{billeder/BxY0owY.png}
%----------------------------------------------------------------------------------------
\begin{document}
\makecvtitle % Print the CV title
%----------------------------------------------------------------------------------------
% EDUCATION SECTION
%----------------------------------------------------------------------------------------
\section{Education}
\cventry{2016}{A}{B}{}{}{}
\end{document}
答案1
嗯,在较新版本的moderncv
命令中\homepage
只使用一个参数。您想使用两个。要实现这一点,请在您的序言中添加以下行:
\renewcommand*{\homepage}[2]{\def\@homepage{#1}\def\@homepagetitle{#2}}
因为今天使用了moderncv
添加,所以我定义了一个新命令,例如\http://
\https://
\httpslink
\newcommand*{\httpslink}[2][]{%
\ifthenelse{\equal{#1}{}}%
{\href{https://#2}{#2}}%
{\href{https://#2}{#1}}}
最后,我们必须在命令中修补\makecvhead
以下行
\makenewline\homepagesymbol\httplink{\@homepage}
创建您想要的主页链接:
\patchcmd{\makecvhead}{%search
\makenewline\homepagesymbol\httplink{\@homepage}}{%replace
\ifthenelse{\isundefined{\@homepage}}{}{%
\ifthenelse{\equal{\@homepagetitle}{}}% \homepagetitle could be empty
{\makenewline\homepagesymbol\httpslink{\@homepage}}%
{\makenewline\homepagesymbol\httpslink[\@homepagetitle]{\@homepage}}}%
}{%success
}{%failure
}
请注意,我们必须使用命令\makeatletter
,\makeatother
因为我们@
在上面的代码中......
因此,使用以下可编译的 MWE
\documentclass[11pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage[scale=0.75]{geometry} % Reduce document margins
\usepackage[danish]{babel}%Overskrift på indholdsfortegnelse dansk%
\makeatletter % <=======================================================
\newcommand*{\httpslink}[2][]{%
\ifthenelse{\equal{#1}{}}%
{\href{https://#2}{#2}}%
{\href{https://#2}{#1}}}
\renewcommand*{\homepage}[2]{\def\@homepage{#1}\def\@homepagetitle{#2}}
\patchcmd{\makecvhead}{%search
\makenewline\homepagesymbol\httplink{\@homepage}}{%replace
\ifthenelse{\isundefined{\@homepage}}{}{%
\ifthenelse{\equal{\@homepagetitle}{}}% \homepagetitle could be empty
{\makenewline\homepagesymbol\httpslink{\@homepage}}%
{\makenewline\homepagesymbol\httpslink[\@homepagetitle]{\@homepage}}}%
}{%success
}{%failure
}
\makeatother % <========================================================
%----------------------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------
\firstname{X} % Your first name
\familyname{Y} % Your last name
% All information in this block is optional, comment out any lines you don't need
\title{A}
\extrainfo{B}
\address{C}{D}
\mobile{E}
\email{F}
\homepage{LinkedIn.com}{LinkedIn Profile}
% The first argument is the url for the clickable link, the second argument is the url displayed in the template - this allows special characters to be displayed such as the tilde in this example
\photo[70pt][0.4pt]{example-image}
%\quote{"A witty and playful quotation" - John Smith}
%----------------------------------------------------------------------------------------
\begin{document}
\makecvtitle % Print the CV title
%----------------------------------------------------------------------------------------
% EDUCATION SECTION
%----------------------------------------------------------------------------------------
\section{Education}
\cventry{2016}{A}{B}{}{}{}
\end{document}
你得到你想要的:
答案2
moderncv
有一个特殊命令可以插入指向你的 LinkedIn 个人资料的链接而不显示完整的网址:\social[linkedin]{LinkedIn Profile}
\documentclass[12pt,a4paper,sans]{moderncv}
\moderncvstyle{classic}
\moderncvcolor{blue}
\usepackage{lipsum}
\usepackage[scale=0.75]{geometry}
\usepackage[danish]{babel}%Overskrift på indholdsfortegnelse dansk%
%\usepackage{hyperref}
\usepackage{multicol}
\usepackage{graphicx}
%----------------------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------
\firstname{X} % Your first name
\familyname{Y} % Your last name
% All information in this block is optional, comment out any lines you don't need
\title{A}
\extrainfo{B}
\address{C}{D}
\mobile{E}
\email{F}
\social[linkedin]{LinkedIn Profile}
%\homepage{LinkedIn.com}%{LinkedIn Profile}
% The first argument is the url for the clickable link, the second argument is the url displayed in the template - this allows special characters to be displayed such as the tilde in this example
\photo[70pt][0.4pt]{example-image}
%----------------------------------------------------------------------------------------
\begin{document}
\makecvtitle % Print the CV title
%----------------------------------------------------------------------------------------
% EDUCATION SECTION
%----------------------------------------------------------------------------------------
\section{Education}
\cventry{2016}{A}{B}{}{}{}
\end{document}