如何根据姓名列表批量生成徽章?

如何根据姓名列表批量生成徽章?

我想用 LaTeX 为暑期学校的学员制作一些徽章。大约有 40 人,所以我不想手动更改名称并编译然后打印。我可以想到:

  1. 制作一个带有 40 个选项的下拉框的单个文档。我不知道在这种情况下是否可以自动进行选择和打印。

  2. 使用python等脚本语言调用latex来完成这项工作。但是我对Python没有任何经验,而且我在网上也没有找到一个万无一失的教程(可能是因为搜索关键字错误)。

所以...我在等你们想出一个好的解决方案:-)。

答案1

\documentclass{article}

\begin{document}


\makeatletter
\def\Name{\expandafter\@firstoftwo\name}
\def\Affiliation{\expandafter\@secondoftwo\name}
\setlength\fboxsep{10pt}

\@for \name:=%
{{David}{here}},%
{{Paulo}{There}},%
{{egreg}{Somewhere}},%
{{Werner}{Not Here}},%
{{Gonzalo}{Not There}}%
\do {
\clearpage
\fbox{\begin{minipage}[c][4cm]{6cm}
Name: \Name\\
Afilliation: \Affiliation
\end{minipage}}}

\end{document}

相关内容