在 moderncv 中向个人数据添加超链接时,tex 容量超出范围

在 moderncv 中向个人数据添加超链接时,tex 容量超出范围

我正在尝试添加超链接并更改我的 moderncv 经典模板的个人信息部分(例如主页、电子邮件和地址)的颜色,但遇到了此错误:

Tex capacity exceeded, sorry! [input stack size= 5000]

这是我的 MWE

      \documentclass[11pt,a4paper,sans]{moderncv}        % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')

    % moderncv themes
    \moderncvstyle{classic}                             % style options are 'casual' (default), 'classic', 'oldstyle' and 'banking'
    \moderncvcolor{blue}                               % color options 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'
    %\renewcommand{\familydefault}{\sfdefault}         % to set the default font; use '\sfdefault' for the default sans serif font, '\rmdefault' for the default roman one, or any tex font name
    %\nopagenumbers{}                                  % uncomment to suppress automatic page numbering for CVs longer than one page

    % character encoding
    \usepackage[utf8]{inputenc} 
    \definecolor{Blue}{rgb}{0,0.4,0.6}  
    \usepackage{amssymb} 
    \usepackage{booktabs}
    \setlength\tabcolsep{20pt}
                       % if you are not using xelatex ou lualatex, replace by the encoding you are using
    %\usepackage{CJKutf8}                              % if you need to use CJK to typeset your resume in Chinese, Japanese or Korean

    % adjust the page margins
    \usepackage[scale=0.85]{geometry}
    \usepackage[utf8]{inputenc}
    \usepackage[english]{babel}
     \usepackage{changepage}
     \usepackage{lipsum}
    \usepackage{multicol}
    \usepackage{verbatim}
    \usepackage{microtype}
    \usepackage{setspace}
            \newcommand*{\Skype}{\href{skype:example?add}{example}} 
            \newcommand{\Absender}[1][\normalsize]{\Skype} 
            \newcommand\narrowstyle{\SetTracking{encoding=*}{-50}\lsstyle}
            \newcommand\spacedstyle[1]{\SetTracking{encoding=*}{#1}\lsstyle}
            \newcommand\normalstyle{\SetTracking{encoding=*}{0}\lsstyle}

            % personal data
            \name{example}{example}
            \address{\href{http://example.com}{\color{blue}lablabla,%
            }\makenewline \href{http://example2.com}{ \color{blue}lablabla} }{Tehran,}{Iran}


            \email{[email protected]}                               
            \homepage{\href{www.example.com}{\color{blue}{www.example.com}}}                         
            \extrainfo{Skype:\color{blue} \Absender }                 

           \begin{document}
\end{document}

.....

我应该怎么办?

答案1

您的示例没有输出任何页面。但是,moderncv已经用于\href输出的参数\href。因此您不能\href在此参数内使用。

\documentclass[11pt,a4paper,sans]{moderncv}        % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')

% moderncv themes
\moderncvstyle{classic}                             % style options are 'casual' (default), 'classic', 'oldstyle' and 'banking'
\moderncvcolor{blue}                               % color options 'blue' (default), 'orange', 'green', 'red', 'purple', 'grey' and 'black'
%\renewcommand{\familydefault}{\sfdefault}         % to set the default font; use '\sfdefault' for the default sans serif font, '\rmdefault' for the default roman one, or any tex font name
%\nopagenumbers{}                                  % uncomment to suppress automatic page numbering for CVs longer than one page

% character encoding
\usepackage[utf8]{inputenc} 
\definecolor{Blue}{rgb}{0,0.4,0.6}  
\usepackage{amssymb} 
\usepackage{booktabs}
\setlength\tabcolsep{20pt}
                   % if you are not using xelatex ou lualatex, replace by the encoding you are using
%\usepackage{CJKutf8}                              % if you need to use CJK to typeset your resume in Chinese, Japanese or Korean

% adjust the page margins
\usepackage[scale=0.85]{geometry}
%\usepackage[utf8]{inputenc}% Already loaded above!
\usepackage[english]{babel}
\usepackage{changepage}
\usepackage{lipsum}
\usepackage{multicol}
\usepackage{verbatim}
\usepackage{microtype}
\usepackage{setspace}
\newcommand*{\Skype}{\href{skype:example?add}{example}} 
\newcommand{\Absender}[1][\normalsize]{\Skype} 
\newcommand\narrowstyle{\SetTracking{encoding=*}{-50}\lsstyle}
\newcommand\spacedstyle[1]{\SetTracking{encoding=*}{#1}\lsstyle}
\newcommand\normalstyle{\SetTracking{encoding=*}{0}\lsstyle}

% personal data
\name{example}{example}
\address{\href{http://example.com}{\color{blue}lablabla,%
  }\makenewline \href{http://example2.com}{ \color{blue}lablabla} }{Tehran,}{Iran}

\email{[email protected]}                               
\homepage{www.example.com}% Don't use \href in the argument of \homepage!
\extrainfo{Skype:\color{blue} \Absender }                 

\begin{document}
\makecvtitle
\end{document}

如果您想要链接blue,只需将选项colorlinks和传递urlcolor=bluehyperref

\documentclass[11pt,a4paper,sans]{moderncv}

\moderncvstyle{classic}
\moderncvcolor{blue}

\usepackage[utf8]{inputenc} 
\usepackage[scale=0.85]{geometry}
\usepackage[english]{babel}

\newcommand*{\Skype}{\href{skype:example?add}{example}} 
\newcommand{\Absender}[1][\normalsize]{\Skype} 
\newcommand\narrowstyle{\SetTracking{encoding=*}{-50}\lsstyle}
\newcommand\spacedstyle[1]{\SetTracking{encoding=*}{#1}\lsstyle}
\newcommand\normalstyle{\SetTracking{encoding=*}{0}\lsstyle}

\name{example}{example}
\address{\href{http://example.com}{lablabla,%
  }\makenewline \href{http://example2.com}{lablabla}}{Tehran,}{Iran}

\email{[email protected]}                               
\homepage{www.example.com}
\extrainfo{Skype:\color{blue} \Absender }

\PassOptionsToPackage{colorlinks,urlcolor=blue}{hyperref}

\begin{document}
\makecvtitle
\end{document}

在此处输入图片描述

查看hyperref手动的了解有关可用选项的更多信息。

相关内容