我正在使用authblk.sty
和xkeyval.sty
。我正在使用每个作者的链接。我需要执行键值代码link={http://people/u/78814}
。但我不知道如何控制authblk.sty
每个作者链接的文件并执行keyvalue
链接选项。
当前编码:
\author[aff={1,2}]{\href{http://people/u/186791}{Luca Pasquini}}
\author[aff={3}]{\href{http://people/u/78814}{Hongying Hou}}
\author[aff={2}]{\href{http://people/u/128850}{Philippe Knauth}}
当前编码应更改为:
\author[aff={1,2},link={http://people/u/186791}]{Luca Pasquini}
\author[aff={3},link={http://people/u/78814}]{Hongying Hou}
\author[aff={2},link={http://people/u/128850}]{Philippe Knauth}
梅威瑟:
\documentclass{article}
\usepackage{authblk}
\usepackage{xkeyval}
\usepackage{etoolbox}%
\usepackage{xparse}%
\usepackage{hyperref}
\makeatletter
\def\@maketitle{%
\null
\vbox to \textheight{\vbox to \textheight{\vspace*{12pc}%\vfill%
\hbox to 10pc{\hfill%
\begin{minipage}[b]{10pc}
{\@correspondence\par}%
\vskip 6pt%
{\@presentaddress}%
\end{minipage}}}
\hspace*{11pc}
\vbox to \textheight{\vspace*{-44pc}%
\hbox to 10pc{\hfill%
\begin{minipage}[b]{31pc}
\let \footnote \thanks
{\raggedright\fontsize{18pt}{20pt}\selectfont\@title \par}%
\vskip 1.5em%
{\large
\begin{tabular}[t]{l}%
\raggedright\@author
\end{tabular}\par}%
\end{minipage}}}}%
\par
\vskip 8.5em}
\def\@correspondence{}
\def\correspondence#1{%
\gdef\@correspondence{\textbf{\textit{*Correspondence:}}\newline%
\raggedright #1\FrontKVMacroEmail%
}}
\def\@presentaddress{}
\def\presentaddress#1{%
\gdef\@presentaddress{\textbf{\textit{$\dagger$presentaddress:}}\newline%
\raggedright #1}}
\define@key{authorinfo}{aff}{%
\def\FrontKVMacroAff{#1}%
}%
\define@key{authorinfo}{coraddress}{%
\def\FrontKVMacroCorAddress{#1}%
}%
\define@key{authorinfo}{email}{%
\def\FrontKVMacroEmail{#1}%
}%
\define@key{authorinfo}{presentaddress}{%
\def\FrontKVMacroPresentAddress{#1}%
}%
\let\OriginalAuthor\author
\RenewDocumentCommand{\author}{+O{}+m}{%
\setkeys{authorinfo}{#1}%
\ifdef{\FrontKVMacroAff}{%
\OriginalAuthor[\FrontKVMacroAff]{#2}%
}{%
\OriginalAuthor{#2}%
}%
\ifdef{\FrontKVMacroCorAddress}{%
\correspondence{\FrontKVMacroCorAddress}%
}{%
}
\ifdef{\FrontKVMacroPresentAddress}{%
\presentaddress{\FrontKVMacroPresentAddress}%
}{%
}%
\undef\FrontKVMacroAff%
}% End of RenewDocumentCommand.
\makeatother
\begin{document}
\title{Hormonal crosstalk for root development}
\author[aff={1}]{Maria Luisa Di Vona}
\author{Emanuela Sgreccia}
\author[aff={1,2},coraddress={Richard, Dipartimento di Scienze e
Tecnologie Chimiche, Universita di Roma Tor Vergata, Via della
Ricerca Scientifica 1, 00133 Roma,
Italia},email={[email protected]}]{Riccardo Narducci}
\author[aff={1,2}]{\href{http://people/u/186791}{Luca Pasquini}}
\author[aff={3}]{\href{http://people/u/78814}{Hongying Hou}}
\author[aff={2}]{\href{http://people/u/128850}{Philippe Knauth}}
\affil[1]{Integrative Cell Biology Laboratory, School of Biological and Biomedical Sciences, The Bio physical Sciences Institute, Durham University, Durham, UK}
\maketitle
\end{document}
如何执行用户定义的键值命令link={link text}
。请指教
答案1
首先,我删除并更改了定义中的\null
第二个宽度,这样就不会出现空白页,并适合右边距。如果您不喜欢这些更改,请将其改回。minipage
\maketitle
然后,为了实现你想要的,我定义了link
关键
\define@key{authorinfo}{link}{%
\def\FrontKVMacroLink{#1}%
}%
并将命令代码更改\author
为
\RenewDocumentCommand{\author}{+O{}+m}{%
\setkeys{authorinfo}{#1}%
\ifdef{\FrontKVMacroAff}{%
\ifdef{\FrontKVMacroLink}{%
\OriginalAuthor[\FrontKVMacroAff]{\href{\FrontKVMacroLink}{#2}}%
}{%
\OriginalAuthor[\FrontKVMacroAff]{#2}%
}%
}{%
\ifdef{\FrontKVMacroLink}{%
\OriginalAuthor{\href{\FrontKVMacroLink}{#2}}%
}{%
\OriginalAuthor{#2}%
}%
}%
\ifdef{\FrontKVMacroCorAddress}{%
\correspondence{\FrontKVMacroCorAddress}%
}{%
}
\ifdef{\FrontKVMacroPresentAddress}{%
\presentaddress{\FrontKVMacroPresentAddress}%
}{%
}%
\undef\FrontKVMacroAff%
}% End of RenewDocumentCommand.
完整代码:
\documentclass{article}
\usepackage{authblk}
\usepackage{xkeyval}
\usepackage{etoolbox}%
\usepackage{xparse}%
\usepackage{hyperref}
\makeatletter
\def\@maketitle{%
\vbox to \textheight{\vbox to \textheight{\vspace*{12pc}%\vfill%
\hbox to 10pc{\hfill%
\begin{minipage}[b]{10pc}
{\@correspondence\par}%
\vskip 6pt%
{\@presentaddress}%
\end{minipage}}}
\hspace*{11pc}
\vbox to \textheight{\vspace*{-44pc}%
\hbox to 10pc{\hfill%
\begin{minipage}[b]{25pc}
\let \footnote \thanks
{\raggedright\fontsize{18pt}{20pt}\selectfont\@title \par}%
\vskip 1.5em%
{\large
\begin{tabular}[t]{l}%
\raggedright\@author
\end{tabular}\par}%
\end{minipage}}}}%
\par
\vskip 8.5em}
\def\@correspondence{}
\def\correspondence#1{%
\gdef\@correspondence{\textbf{\textit{*Correspondence:}}\newline%
\raggedright #1\FrontKVMacroEmail%
}}
\def\@presentaddress{}
\def\presentaddress#1{%
\gdef\@presentaddress{\textbf{\textit{$\dagger$presentaddress:}}\newline%
\raggedright #1}}
\define@key{authorinfo}{aff}{%
\def\FrontKVMacroAff{#1}%
}%
\define@key{authorinfo}{coraddress}{%
\def\FrontKVMacroCorAddress{#1}%
}%
\define@key{authorinfo}{email}{%
\def\FrontKVMacroEmail{#1}%
}%
\define@key{authorinfo}{presentaddress}{%
\def\FrontKVMacroPresentAddress{#1}%
}%
\define@key{authorinfo}{link}{%
\def\FrontKVMacroLink{#1}%
}%
\let\OriginalAuthor\author
\RenewDocumentCommand{\author}{+O{}+m}{%
\setkeys{authorinfo}{#1}%
\ifdef{\FrontKVMacroAff}{%
\ifdef{\FrontKVMacroLink}{%
\OriginalAuthor[\FrontKVMacroAff]{\href{\FrontKVMacroLink}{#2}}%
}{%
\OriginalAuthor[\FrontKVMacroAff]{#2}%
}%
}{%
\ifdef{\FrontKVMacroLink}{%
\OriginalAuthor{\href{\FrontKVMacroLink}{#2}}%
}{%
\OriginalAuthor{#2}%
}%
}%
\ifdef{\FrontKVMacroCorAddress}{%
\correspondence{\FrontKVMacroCorAddress}%
}{%
}
\ifdef{\FrontKVMacroPresentAddress}{%
\presentaddress{\FrontKVMacroPresentAddress}%
}{%
}%
\undef\FrontKVMacroAff%
}% End of RenewDocumentCommand.
\makeatother
\begin{document}
\title{Hormonal crosstalk for root development}
\author[aff={1}]{Maria Luisa Di Vona}
\author{Emanuela Sgreccia}
\author[aff={1,2},coraddress={Richard, Dipartimento di Scienze e
Tecnologie Chimiche, Universita di Roma Tor Vergata, Via della
Ricerca Scientifica 1, 00133 Roma,
Italia},email={[email protected]}]{Riccardo Narducci}
\author[aff={1,2},link={http://people/u/186791}]{Luca Pasquini}
\author[aff={3},link={http://people/u/78814}]{Hongying Hou}
\author[aff={2},link={http://people/u/128850}]{Philippe Knauth}
\affil[1]{Integrative Cell Biology Laboratory, School of Biological and Biomedical Sciences, The Bio physical Sciences Institute, Durham University, Durham, UK}
\maketitle
\end{document}
输出: