自定义标签值数字和带有字母的数字

自定义标签值数字和带有字母的数字

我想打印隶属关系number onlynumber with alphabetic characters。请在下面找到 MWE。

\documentclass{article}
\usepackage{hyperref}
\makeatletter
\newcounter{subaff}
\setcounter{subaff}{0}
\renewcommand\thesubaff{\@alph\c@subaff}
\newcommand{\subaff}[1]{\addtocounter{Label}{0}#1}
\newcounter{Label}
\setcounter{Label}{0}
\def\Affiliation#1{\refstepcounter{Label}
\gdef\@Affiliation{%
\def\iand{\refstepcounter{Label}\ignorespaces\item[\hfill${}^{\theLabel}$\ignorespaces]\label{aff\theLabel}\ignorespaces}%
\def\tempand{\refstepcounter{Label}\refstepcounter{subaff}\ignorespaces\item[\hfill${}^{\theLabel\thesubaff}$\ignorespaces]\label{aff\theLabel}\addtocounter{Label}{-1}\ignorespaces}%
\let\and=\iand%
\let\suband=\tempand
\topsep.7mm\trivlist\item[\hfill${}^{\theLabel}$\ignorespaces]\item[]\hskip-6pt\label{aff\theLabel}#1\endtrivlist}}
%%%Make Title
\def\@maketitle{%
\newpage
\null
\begin{center}%
\let \footnote \thanks
{\LARGE \@title \par}%
\vskip 1.5em%
{\large
\lineskip .5em%
\begin{tabular}[t]{c}%
\@author
\end{tabular}\par}%
{\@Affiliation}
\end{center}%
\par
}
\makeatother
\begin{document}

\title{Cross-Links check}
\author{A. Aab\ref{1}\and P. Abreu\ref{4}\and M. Aglietta\ref{6}\and E. J. Ahn\ref{2}}

\Affiliation{
1st Affiliation without alphabetic-characters like $^1$, Rome, Italy
\and
2th Affiliation without alphabetic-characters like $^2$, Rome, Italy
\subaff{
\suband{
3rd Affiliation with alphabetic-characters like ${}^{3{\rm a}}$, Rome, Italy}
\suband{
3rd Affiliation with alphabetic-characters like ${}^{3{\rm b}}$, Rome, Italy}
}
\and
4th Affiliation without alphabetic-characters like $^4$, Rome, Italy
\and
5th Affiliation without alphabetic-characters like $^5$, Rome, Italy}
\maketitle
How do get the affiliations labels in author references??? If \verb|\ref{4}| should be display \verb|^{3b}| like that...
\end{document}

如何获取作者参考文献中的所属标签???如果\ref{4}应该^{3b}这样显示...如何实现?

答案1

如果您只是想在页脚中设置从属关系,则可以使用以下命令劫持脚注:

在此处输入图片描述

\documentclass{article}

%\usepackage{hyperref}

\makeatletter
\newcommand{\affiliation}[1]{{%
  \renewcommand{\thefootnote}{#1}%
  \footnotemark[0]}}
\newcommand{\affiliationtext}[2]{{%
  \renewcommand{\thempfn}{#1}%
  \footnotetext[0]{#2}}}
\makeatother

\title{My title}
\author{A~Author\affiliation{1} \and
        B~Author\affiliation{2a} \and 
        C~Author\affiliation{2b} \and 
        D~Author\affiliation{3}}

\begin{document}
\maketitle

\affiliationtext{1}{First affiliation}
\affiliationtext{2a}{Second sub-affiliation}
\affiliationtext{2b}{Second sub-affiliation}
\affiliationtext{3}{Third affiliation}

\end{document}

您还可以使用参考:

\documentclass{article}

%\usepackage{hyperref}

\makeatletter
\newcommand{\affiliation}[1]{{%
  \renewcommand{\thefootnote}{\ref{#1}}%
  \footnotemark[0]}}
\newcommand{\affiliationtext}[3]{{%
  \renewcommand{\@currentlabel}{#2}\label{#1}%
  \renewcommand{\thempfn}{#2}%
  \footnotetext[0]{#3}}}
\makeatother

\title{My title}
\author{A~Author\affiliation{first} \and
        B~Author\affiliation{second} \and 
        C~Author\affiliation{third} \and 
        D~Author\affiliation{fourth}}

\begin{document}
\maketitle

\affiliationtext{first}{1}{First affiliation}
\affiliationtext{second}{2a}{Second sub-affiliation}
\affiliationtext{third}{2b}{Second sub-affiliation}
\affiliationtext{fourth}{3}{Third affiliation}

\end{document}

使用三个参数\affiliationtext{<label>}{<ref>}{<text>}有助于提供代码方面的上下文。

相关内容