使用 xstring 從類別文件中的 authblk 取得主要作者的姓氏

使用 xstring 從類別文件中的 authblk 取得主要作者的姓氏

我想查詢一篇文章的第一作者的姓氏,然後將其放入標題中。我在 \AB@authlist 巨集上使用 \StrBetween 來取得第一個空格和第一個逗號之間的字串部分,這會因為作者標記 ($^1$) 導致奇怪的輸出。正確的最終字元是什麼,以便命令僅返回作者的姓氏?我想從 .cls 檔案傳遞它,儘管我在下面添加了 .tex MWE 來演示該問題。

MWE.cls:

   \NeedsTeXFormat{LaTeX2e}
\ProvidesClass{chkcls}[2020/08/25 v0 class]
\ExecuteOptions{a4paper,10pt}
\ProcessOptions
\LoadClass[10pt,a4paper]{article}
\RequirePackage{amsfonts,amsbsy,authblk,xstring}
\newcommand {\leadauthor} {
\StrBetween[1,1]{\AB@authlist,}{ }{,}\par
}
\endinput

MWE.tex:

\documentclass[10pt]{chkcls}
\usepackage{amsfonts,amsbsy,authblk,xstring}
\begin{document}
\title{A funny title} 
\author[1]{First Author}
  \author[2]{Second author}  
  \author[3]{Third author} 
\affil[1]{[email protected], Germany} 
\affil[2]{[email protected], Spain} 
\affil[3]{[email protected], Norway} 
\maketitle
Some text in the document
\leadauthor
\end{document}

目前結果為:Author101012.0pt12.0pt1

相關內容