我正在使用以下代码提交我们正在准备的纪念品的摘要。
\documentclass[12pt,a4paper,footinclude=true,headinclude=true,openany]{scrbook}
\usepackage{graphicx,tikz,lipsum,amsmath,amssymb,amsthm}
\usepackage{transparent,rotating}
\usepackage{eso-pic}
\usepackage{minitoc}
\def\aut#1{\textbf{#1}}
\def\inst#1{\textit{#1}}
\def\address#1{\textit{#1}}
\def\email#1{\texttt{#1}}
\def\aut#1{\textbf{#1}\addtocontents{toc}{\protect\contentsline{subsection}{#1}{}}}
\makeatletter \renewcommand\@dotsep{300}
\def\insti#1{\textit{#1}\addtocontents{toc}{\protect\contentsline{subsection}{#1}{}}}
% % % % % % % %Abstract Environment % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % %
\newcommand\abstractname{Abstract} %%% here
\makeatletter
\newenvironment{abstract}{%
\if@twocolumn
\section*{\abstractname}%
\else
\small
\begin{center}%
{\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}%
\end{center}%
\quotation
\fi}
{\if@twocolumn\else\endquotation\fi}
%\fi
\makeatother
% % % % % % % % % % % % % % % % % % % % % % %
\begin{document}
\dominitoc
\faketableofcontents
\chapter{Abstracts}
\minitoc
\section{Type your title if the paper if you are having Only one authors}
\aut{Name of the Author}\\
\inst{Department of Biostatistics,}\\
\address{1st line, 2nd line, 3rd line}
\begin{abstract}
You can Type your Abstract Here.
\end{abstract}
\section{Type your Title here....}
\begin{minipage}{.5\textwidth}
\aut{First author }\\
\inst{Department of Biostatistics}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage} %
\begin{minipage}{.5\textwidth}
\aut {Second Author,}\\
\inst{Department of Radiology}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage}
\begin{abstract}
You can Type your Abstract Here.
\end{abstract}
\section{Type your title of the paper if you are having three authors}
\begin{minipage}{.35\textwidth}
\aut{First author }\\
\inst{Department of Biostatistics}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage}
\begin{minipage}{.3\textwidth}
\aut {Second Author,}\\
\inst{Department of Radiology}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage}
\begin{minipage}{.35\textwidth}
\aut {Third author}\\
\inst{Department of Mathematics}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage}
\begin{abstract}
You can Type your Abstract Here.
\end{abstract}
`\end{document}
书中的输出很好,但在内容中,如果我使用三位作者,则会出现一个接一个的情况。但我希望作者姓名必须位于一行中,无论我为一个部分使用了多少位作者。
有办法纠正这个问题吗?
如果有其他解决方案来解决这种情况,请提供。
答案1
逗号分隔列表似乎是实现此目的的理想选择。此解决方案的工作原理是按指定的方式将作者添加到列表中,但仅在抽象环境的开头(假设所有作者都已给出)时将列表写入内容。
请注意,模板中有一些虚假空格导致框过满,我已将其删除。除此之外,作者的模板是一样的。
当新的 LaTeX 3 语法(我已将其用于列表)处于活动状态时,空格将被忽略。因此,无需在代码块内注释行尾
\ExplSyntaxOn
\ExplSyntaxOff
在序言中。这里~
实际上产生了一个正常的可破坏空间。
我还用 替换了\def
它,\newcommand
因为这样更安全,并且删除了\def
根本没有执行任何操作的 s。
\documentclass[12pt,a4paper,footinclude=true,headinclude=true,openany]{scrbook}
\usepackage{expl3,minitoc}
\ExplSyntaxOn
\clist_new:N \g_souvenir_authors_clist
\newcommand\inst[1]{\textit{#1}}
\newcommand\address[1]{\textit{#1}}
\newcommand\email[1]{\texttt{#1}}
\newcommand\aut[1]{
\clist_gput_right:Nn \g_souvenir_authors_clist {#1}
\textbf{#1}
}
\newcommand\insti[1]{\textit{#1}\addtocontents{toc}{\protect\contentsline{subsection}{#1}{}}}
\newcommand\abstractname{Abstract}
\makeatletter
\renewcommand\@dotsep{300}
\newenvironment{abstract}{
\addtocontents{toc}{\protect\contentsline{subsection}{\clist_use:Nnnn \g_souvenir_authors_clist {~and~} {,~} {~and~} }{}}
\clist_gclear:N \g_souvenir_authors_clist
\small
\begin{center}
{\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}
\end{center}
\quotation}
{\endquotation}
\makeatother
\ExplSyntaxOff
\begin{document}
\dominitoc
\faketableofcontents
\chapter{Abstracts}
\minitoc
\section{Type your title if the paper if you are having Only one authors}
\aut{Name of the Author}\\
\inst{Department of Biostatistics,}\\
\address{1st line, 2nd line, 3rd line}
\begin{abstract}
You can Type your Abstract Here.
\end{abstract}
\section{Type your Title here....}
\begin{minipage}{.5\textwidth}
\aut{First author }\\
\inst{Department of Biostatistics}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\aut {Second Author}\\
\inst{Department of Radiology}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage}
\begin{abstract}
You can Type your Abstract Here.
\end{abstract}
\section{Type your title of the paper if you are having three authors}
\begin{minipage}{.35\textwidth}
\aut{First author }\\
\inst{Department of Biostatistics}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage}%
\begin{minipage}{.3\textwidth}
\aut {Second Author}\\
\inst{Department of Radiology}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage}%
\begin{minipage}{.35\textwidth}
\aut {Third author}\\
\inst{Department of Mathematics}\\
\address{first line\\second line\\ third line}\\
\email{[email protected]}
\end{minipage}
\begin{abstract}
You can Type your Abstract Here.
\end{abstract}
\end{document}