如何修改此代码来写入作者的所属机构?

如何修改此代码来写入作者的所属机构?

我已经成功地根据此代码为即将召开的会议创建了一份摘要文档,该文档可供使用这里但有人能告诉我我应该修改什么才能产生作者隶属关系吗?非常感谢。

\documentclass[11pt,a4paper]{article}

\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blindtext}

\setlength{\parindent}{0cm} % Default is 15pt.

\usepackage[titles]{tocloft}

\newcommand{\listabstractname}{List of Abstracts}
\newlistof[section]{abstracts}{abs}{\listabstractname}

\newenvironment{abstracts}[1]{%
\refstepcounter{abstracts}%
\small%
\begin{center}%
  \textbf{#1}%
\end{center}%
\quotation%
\addcontentsline{abs}{abstracts}{#1}%
}{%
\endquotation%
\clearpage%
}

\newcommand\abstractauthor[1]{\authortoabs{#1}\printabstractauthor{#1}}

\newcommand{\printabstractauthor}[1]{%
{\noindent\centering\scshape#1\par\nobreak\vspace*{35pt}}%
}
\newcommand{\authortoabs}[1]{%
  \addtocontents{abs}{\vskip-10pt}%
  \addtocontents{abs}{%
    \protect\contentsline{section}{\hskip1.3em\mdseries\scshape\protect\scriptsize#1}{}{}}%
  \addtocontents{abs}{\vskip5pt}%
}

\begin{document}

\listofabstracts
\clearpage

\begin{abstracts}{This is a test title of an abstract}
\abstractauthor{First Author, Second Author}
\blindtext[3]
\end{abstracts}

\begin{abstracts}{This is a second abstract}
\abstractauthor{First Author}
\blindtext[3]
\end{abstracts}

\end{document} 

答案1

尝试一下这个简单的方法。

A

% !TeX TS-program = pdflatex

\documentclass[11pt,a4paper]{article}

\usepackage[ngerman]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{blindtext}

\setlength{\parindent}{0cm} % Default is 15pt.

\usepackage[titles]{tocloft}

\newcommand{\listabstractname}{List of Abstracts}
\newlistof[section]{abstracts}{abs}{\listabstractname}

%%************************************ added <<<<<<<<<<<<
\newcounter{authornum}
\newcommand{\TA}{\stepcounter{authornum}\textsuperscript{\theauthornum}}

\newcounter{affilnum}
\newcommand{\TF}{\stepcounter{affilnum}\textsuperscript{\theaffilnum}}

\newcommand{\afillauthor}[1]{\par\medskip\noindent\hfill\TF#1\hfill}

\newcommand{\printabstract}[1]{\par\vspace*{2em}#1}
%%************************************

\newenvironment{abstracts}[1]{%
    \refstepcounter{abstracts}%
    \setcounter{authornum}{0}\setcounter{affilnum}{0}% added <<<<<<<<<<<<   
    \small%
    \begin{center}%
        \textbf{#1}%
    \end{center}%
    \quotation% 
    \addtocontents{abs}{\vskip2ex}% added <<<<<<<<<<<<  
    \addcontentsline{abs}{abstracts}{#1}%
}{%
    \endquotation%
    \clearpage%
}

\newcommand{\printabstractauthor}[1]{% changed <<<<<<<<<<<<
    {\noindent\hfill\scshape#1\TA\hfill}
}%

\newcommand{\addauthortoToC}[1]{% added <<<<<<<<<<<<
    \par\addtocontents{abs}{%
        \protect\contentsline{section}{\vskip-1.7\baselineskip\hskip1.3em\mdseries\scshape\protect\scriptsize#1}{}{}}%
}


\begin{document}
    
    \listofabstracts
    \clearpage

    \begin{abstracts}{This is a test title of an abstract}
        \printabstractauthor{First Author}
        \printabstractauthor{Second Author}
        \addauthortoToC{First Author, Second Author}
        \afillauthor{University One}
        \afillauthor{University Two}
        \printabstract{\blindtext[3]}
    \end{abstracts}
    
    \begin{abstracts}{This is a second abstract}
        \printabstractauthor{First Author}
        \addauthortoToC{First Author}
        \afillauthor{University Three}
        \printabstract{\blindtext[3]}
    \end{abstracts}
    
    \begin{abstracts}{This is a third abstract}
        \printabstractauthor{First Author}
        \printabstractauthor{Second Author}
        \printabstractauthor{Third Author}
        \addauthortoToC{First Author, Second Author, Third Author}
        \afillauthor{University One}
        \afillauthor{University Two}
        \afillauthor{University Three}
        \printabstract{\blindtext[3]}
    \end{abstracts}
    
\end{document}

相关内容