我已定义\editor{strong text}
并\reviewer{strong text}
多次使用命令。但我仅获得最后一个\editor{Some Text}
命令的输出。
我的类文件定义了下面提到的这个命令:
\def\@editor{}
\def\editor#1{%
\gdef\@editor{\raggedright \textbf{Edited by:}\newline #1}}
\def\@reviewer{}
\def\reviewer#1{%
\gdef\@reviewer{\raggedright \textbf{Reviewed by:}\newline #1}}
\def\@maketitle{%
\newpage
\null
\vskip 50pc%
\vbox{\hbox to 0pt{\vbox to 0pt{\vskip -40pc%
\begin{minipage}[b]{10pc}
{\@editor\par}
\vskip 1.5em%
{\@reviewer\par}
\vskip 1.5em%
{\@correspondence\par}%
\vskip 1.5em%
{\@metanote}%
\end{minipage}
\hspace*{12pt}
\begin{minipage}[b]{31pc}
\let \footnote \thanks
{\raggedright\fontsize{18pt}{20pt}\selectfont\color{colorA}\@title \par}%
\vskip 1.5em%
{\large
% \lineskip .5em%
\begin{tabular}[t]{l}%
\raggedright\@author
\end{tabular}\par}%
\vskip 1em%
{\@abstract\par}
\vskip 1em%
{\@keywords\par}
\vskip 1em%
{\@firstpara\par}
\end{minipage}}}}%
\par
\vskip 8.5em}
我的 TeX 文件编码如下:
\editor{Wagner L. Ara\'{u}jo, Universidade Federal de Vi\c{c}osa, Brazil}
\editor{Kannan L. juvio, Universidade Federal de Vi\c{c}osa, Brazil}
\reviewer{Jedrzej Jakub Szymanski, Max Planck Institute of Molecular Plant Physiology, Germany }
\reviewer{Dimas Mendes Ribeiro, Universidade Federal de Vi\c{c}osa, Brazil}
我没有改变编码结构,因为我的.tex
文件正在使用另一个转换过程。我的问题是仅输出打印最后的编辑器输出。我不知道如何打印每位编辑和审稿人。请提供解决方案以打印超过编辑和审稿人的数量。
我的输出看起来像是:
答案1
通常你不将元标题“编辑者:”添加到收集元信息的宏中,例如
\newcommand{\editor}[1]{\def\@editor{\raggedright \textbf{Edited by:}\newline #1}}
请注意,我使用了 LaTeX 命令\newcommand
作为顶级元宏(这是更好的选择!),而这\gdef
对于内部元存储的定义来说并不是必需的,即\@editor
;\def
就足够了。
在你的情况下,你可以使用一个元命令来增加内部存储
\newcommand{\editor}[1]{\edef\@editor{\@editor #1}}
为了尽量减少对现有设置的更改,最终版本如下所示
\newcommand{\editor}[1]{\protected@edef\@editor{\@editor\newline#1\vspace{3pt}}}
最后给出了完整的代码。你会看到一些变化是不可避免的。这次我还清理了整体代码。
\documentclass{article}
\usepackage{color}
\makeatletter
\let\@editor\@empty
\newcommand{\editor}[1]{\protected@edef\@editor{\@editor\newline#1\vspace{3pt}}}
\let\@reviewer\@empty
\newcommand{\reviewer}[1]{\protected@edef\@reviewer{\@reviewer\newline#1\vspace{2pt}}}
\let\@correspondence\@empty
\newcommand{\correspondence}[1]{%
\protected@edef\@correspondence{\@correspondence\newline#1\vspace{2pt}}}
\def\@maketitle{%
\vspace{50pc}%
\noindent
\begin{minipage}{.33\textwidth}
\raggedright
\textbf{Edited by:}\vspace{3pt}
\@editor
\par\vspace{1.5em}
\textbf{Reviewed by:}\vspace{3pt}
\@reviewer
\par\vspace{1.5em}
\textit{Correspondence:}\vspace{3pt}
\@correspondence
\par\vspace{1.5em}
\@metanote%
\end{minipage}%
\hspace{12pt}%
\begin{minipage}{.66\textwidth}
\let \footnote \thanks
\let \and \newline
\begin{tabular}[t]{p{\textwidth}}
{\fontsize{18pt}{20pt}\selectfont\color{blue}\@title} \\[1.5em]
{\large \@author} \\[2em]
{\small \@abstract} \\[1em]
Keywords: \@keywords \\[1em]
\@firstpara
\end{tabular}
\end{minipage}
\par
\vskip 8.5em}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%auxiliary macros (not provided in the MWE!)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\abstract}[1]{\def\@abstract{#1}}
\newcommand{\keywords}[1]{\def\@keywords{#1}}
\let\@firstpara\@empty
\let\@metanote\@empty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatother
\editor{Wagner L. Ara\'{u}jo, Universidade Federal de Vi\c{c}osa, Brazil}
\editor{Kannan L. juvio, Universidade Federal de Vi\c{c}osa, Brazil}
\reviewer{Jedrzej Jakub Szymanski, Max Planck Institute of Molecular Plant Physiology, Germany }
\reviewer{Dimas Mendes Ribeiro, Universidade Federal de Vi\c{c}osa, Brazil}
\correspondence{Jana Doe, University of TeX Wizardry}
\author{John Doe}
\title{Multiple usage of meta macros}
\abstract{Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.}
\keywords{Lorem, Ipsum, Dolor, Sit}
\begin{document}
\maketitle
\end{document}
答案2
正如一些评论所说,\editor
和的当前定义\reviewer
旨在设置内容并覆盖前一个内容。
这是一个简单的定义(使用etoolbox
包的列表处理工具,即使用\RequirePackage{etoolbox}
或`\usepackage{etoolbox} 来加载它)。
\newcommand{\@editor}{}
\newcommand{\@reviewer}{}
\newcommand{\editor}[1]{\listadd{\@editor}{#1}}
\newcommand{\reviewer}[1]{\listadd{\@reviewer}{#1}}
\newcommand{\printeditor}{Edited By:\newline\dolistloop{\@editor}}
\newcommand{\printreviewer}{Reviewed By:\newline\dolistloop{\@reviewer}}
这样,命令\editor{some text}
和\reviewer{some text}
就将其参数添加到编辑器列表中(存储在\@editor
和中\@reviewer
)。两个命令\printeditor
和\printreviewer
循环遍历列表并打印相应列表的内容。
对于示例, 在 的给定定义中将\@editor
和替换\@reviewer
为\printeditor
和。\printreviewer
\maketitle