我们正在组织一个活动。大约有 60 名参与者,我需要为他们准备名牌(标签)。
徽章将涉及name surname
每个affiliation
参与者不同的领域。
这些字段实际上已经在 Excel 表中了。因此,我可以轻松地将它们导出到 csv 文件。
并且会有一个带有徽标(图片)和组织名称的页脚。
我想创建一个每页包含 8 或 10 张卡片的 PDF,然后用剪刀剪下。
我可以在 Word 中手动创建文件,但我不喜欢这样做。如何在 LaTeX 中自动执行此过程?
举个例子,这里有一个我想要的简单设计:
答案1
ticket
封装非常适合此用途。引脚示例就是您要寻找的:
%%%%
%
% ticket.sty example file for a pin for conferences
%
%%%%
% use the corresponding paper size for your ticket definition
\documentclass[a4paper,10pt]{letter}
% load ticket.sty with the appropriate ticket definition
\usepackage[freepin,crossmark]{ticket}
% load misc stuff
\usepackage{graphicx}
% make your default ticket. \ticketdefault is somewhat like a background
\renewcommand{\ticketdefault}{%
\put(50, 3){\includegraphics[width=15mm]{ifmlogoc}}
\put( 5, 13){\line(1,0){60}}
\put( 7, 10){\scriptsize Animal annual meeting (AAM)}
\put( 7, 7){\scriptsize In the gardens}
\put( 7, 4){\scriptsize April 1, 2000}
}
% now what do you like to put in your ticket
\newcommand{\confpin}[2]{\ticket{%
\put(35,36){\makebox[0mm]{\bfseries\Large #1}}
\put(35,28){\makebox[0mm]{\bfseries\large #2}}%
}}
%% the pins for the partipiciants ... ;-)
%% you can generate this part from a database!
\begin{document}
\sffamily
\confpin{Camelus dromedarius}{North Africa}
\confpin{Urocyon cinereoargenteus}{America}
\confpin{Galago moholi}{South Africa}
\confpin{Dasypus novemcintus}{South America}
\confpin{Rhinocerus sondaicus}{Java}
\confpin{Canis lupus}{Northern sphere}
\confpin{Ramphastus spec.}{South Amerika}
\confpin{Panthera tigris sondaica}{Java}
\confpin{Hippocampus spec.}{the ocean}
\confpin{Anthonomus grandis}{Mexico}
\confpin{Petrogale penicillata}{Australia}
\confpin{Tarsius spec.}{Sumatra}
\end{document}
结果如下:
对于盒装徽章,使用
\usepackage[freepin,boxed]{ticket}
在序言中。有关其他选项,请参阅手动的。
要创建confpin
内容,您可以在 Excel 中使用以下命令并将内容复制到您的文档中。假设 A 列有name surname
,B 列有affiliation
。
=CONCATENATE("\confpin{"; A2; "}{";B2; "}")
答案2
与 Sigur 的答案略有不同,基于他的代码:
\documentclass{article}
\usepackage{pdfpages}
\usepackage[a4paper,margin=.5in]{geometry}
\usepackage{filecontents}
\begin{filecontents*}{informations.csv}
name,sirname,university
Jon,Doe,From Moon
Jane,Dipp,From Mars
Jon,Doe,From Moon
Jane,Dipp,From Mars
Jon,Doe,From Moon
Jane,Dipp,From Mars
Jon,Doe,From Moon
Jane,Dipp,From Mars
Jon,Doe,From Moon
Jane,Dipp,From Mars
\end{filecontents*}
\begin{filecontents*}{cards.tex}
\documentclass[12pt,a5paper,landscape]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{datatool}
\usepackage[lmargin=1cm,tmargin=1cm,bmargin=1.6cm,rmargin=1.6cm]{geometry}
\usepackage{fancybox} % border page and boxes
\usepackage{mathpazo}
\sloppy
\pagestyle{empty}
\fancypage{\setlength{\fboxsep}{8pt}\doublebox}{}
\newcommand{\event}{Univeristy Name \\
University Address - 1\\
University Address - 2}
\begin{document}
\DTLloaddb{list}{informations.csv}
\DTLforeach{list}{%
\firstname=name,\sirname=sirname,\university=university}{%
\fontfamily{pbk}\fontseries{m}\fontshape{n}\selectfont
\baselineskip 2.5em
\vspace*{2cm}
\begin{center}
{\Large \firstname~\MakeUppercase{\sirname}}
\vskip 2cm
{\large \university}
\vfill
\hrulefill
\parbox[b]{.7\textwidth}{\event}\hfill\fbox{\includegraphics[width=2cm]{example-image-a}}
\end{center}
\newpage
}%
\end{document}
\end{filecontents*}
%
% compile with pdflatex
\immediate\write18{pdflatex cards.tex}
%
\begin{document}
\includepdf[pages=-,nup=2x4,delta=0.0in 0cm,turn=true,frame=true]{cards.pdf}
\end{document}
答案3
这是一个简单的例子。请根据您的情况进行调整。
文件informations.csv
(第一行是变量名)
"name","sirname","university"
"Aaaa","Bbbb","Cccc"
文件foo.tex
(根据您的喜好设置格式)
\documentclass[12pt,a5paper,landscape]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% If the error
% ``No room for ..''
% increase the reserved inserts
%--------------------------------------------
% \usepackage{etex} % to use etex extensions
% \reserveinserts{28} % using etex extensions
\usepackage[english]{babel}
% UTF-8 support any characters
\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
%\usepackage{ucs}
% Defaul loaded character table is ASCII and latin
\usepackage{amsmath}
\usepackage{amssymb} % amsfonts is part of amssymb
\usepackage{graphicx}
\usepackage[usenames]{color}
%\usepackage{chancery} % change serif to Zapf Chancery
\usepackage{datatool}
\usepackage[lmargin=1cm,tmargin=1cm,bmargin=1.6cm,rmargin=1.6cm]{geometry}
\usepackage{fancybox} % border page and boxes
\usepackage{mathpazo}
\sloppy
\pagestyle{empty}
% box around pages, using fancybox package
%
% \fancypage{\fbox}{}
% \fancypage{\setlength{\fboxsep}{8pt}\setlength{\shadowsize}{8pt}\shadowbox}{}
%\fancypage{\setlength{\fboxsep}{8pt}\shadowbox}{}
\fancypage{\setlength{\fboxsep}{8pt}\doublebox}{}
\newcommand{\event}{Insert the title of event here}
\begin{document}
% default separator is coma and default delimiter is double quote
% \DTLsetseparator{,}
% \DTLsetdelimiter{"}
\DTLloaddb{list}{informations.csv}
\DTLforeach{list}{%
\firstname=name,\sirname=sirname,\university=university}{%
\fontfamily{pbk}\fontseries{m}\fontshape{n}\selectfont
\baselineskip 2.5em
\vspace*{2cm}
\begin{center}
{\Large \firstname~\MakeUppercase{\sirname}}
\vskip 2cm
{\large \university}
\vfill
\hrulefill
\event~\fbox{logo here}
\end{center}
\newpage
}
\end{document}
输出