def depart_document(self, node): 'customize document title a la beamer' LaTeXTranslator.depart_document(self, node) if self.title or self.author_stack or self.date: authors = ['\\\\\n'.join(author_entry) for author_entry in self.author_stack] title = [''.join(self.title)] + self.title_labels shorttitle = ''.join(self.title) shortauthor = ''.join(self.pdfauthor) if self.subtitle: title += [r'\\ % subtitle', r'\large{%s}' % ''.join(self.subtitle) ] + self.subtitle_labels docinfo_list = [shorttitle, '%\n '.join(title), shortauthor, ' \\and\n'.join(authors), ', '.join(self.date)] if self.organization is None: docinfo_str = PreambleCmds.documenttitle % tuple(docinfo_list) else: docinfo_list.append(self.organization) docinfo_str = docinfo_w_institute % tuple(docinfo_list) self.body_pre_docinfo[:] = [docinfo_str] # replace default title
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) title = self.paper_title authors = ', '.join(self.author_names) author_notes = [ ''' The corresponding author is with %s, e-mail: \protect\href{%s}{%s}. ''' % (self.author_institutions[0], self.author_emails[0], self.author_emails[0]) ] author_notes = ''.join('\\thanks{%s}' % n for n in author_notes) title_template = '\\title{%s}\\author{%s%s}\\maketitle' title_template = title_template % (title, authors, author_notes) marks = r''' \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} ''' % (options['proceedings_title'], title.upper()) title_template += marks self.body_pre_docinfo = [title_template]
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) title = self.paper_title authors = ', '.join(self.author_names) author_notes = [''' The corresponding author is with %s, e-mail: \protect\href{%s}{%s}. ''' % (self.author_institutions[0], self.author_emails[0], self.author_emails[0])] author_notes = ''.join('\\thanks{%s}' % n for n in author_notes) title_template = '\\title{%s}\\author{%s%s}\\maketitle' title_template = title_template % (title, authors, author_notes) marks = r''' \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} ''' % (options['proceedings_title'], title.upper()) title_template += marks self.body_pre_docinfo = [title_template]
def depart_document(self, node): self.out.append(r'\bibliography{refs}') LaTeXTranslator.depart_document(self, node) ## Generate footmarks # build map: institution -> (author1, author2) institution_authors = OrderedDict() for auth, inst in zip(self.author_names, self.author_institutions): institution_authors.setdefault(inst, []).append(auth) def footmark(n): """Insert footmark #n. Footmark 1 is reserved for the corresponding author. """ return ('\\setcounter{footnotecounter}{%d}' % n, '%d' % n) # Build one footmark for each institution institute_footmark = {} for i, inst in enumerate(institution_authors): institute_footmark[inst] = footmark(i + 2) corresponding_auth_template = r'''%% \affil[%(footmark_counter)s]{% Corresponding author: \protect\href{mailto:%(email)s}{%(email)s}}''' title = self.paper_title authors = [] institutions_mentioned = set() for n, (auth, inst) in enumerate( zip(self.author_names, self.author_institutions)): # Corresponding author if n == 0: authors += [r'\author[%d,%d]{%s}' % (n, n + 1, auth)] authors += [r'\affil[0]{%s}' % self.author_emails[0]] else: authors += [r'\author[%d]{%s}' % (n + 1, auth)] authors += [r'\affil[%d]{%s}' % (n + 1, inst)] title_template = r'\newcounter{footnotecounter}' \ r'\title{%s}%s\maketitle' title_template = title_template % (title, '\n'.join(authors)) self.body_pre_docinfo = [ '\n'.join(self.abstract_text) + title_template ] # Save paper stats self.document.stats = { 'title': title, 'authors': ', '.join(self.author_names), 'author': self.author_names, 'author_email': self.author_emails, 'author_institution': self.author_institutions, 'abstract': self.abstract_text, 'keywords': self.keywords }
def depart_document(self, node): self.out.append(r'\bibliography{refs}') LaTeXTranslator.depart_document(self, node) ## Generate footmarks # build map: institution -> (author1, author2) institution_authors = OrderedDict() for auth, inst in zip(self.author_names, self.author_institutions): institution_authors.setdefault(inst, []).append(auth) def footmark(n): """Insert footmark #n. Footmark 1 is reserved for the corresponding author. """ return ('\\setcounter{footnotecounter}{%d}' % n, '%d' % n) # Build one footmark for each institution institute_footmark = {} for i, inst in enumerate(institution_authors): institute_footmark[inst] = footmark(i + 2) corresponding_auth_template = r'''%% \affil[%(footmark_counter)s]{% Corresponding author: \protect\href{mailto:%(email)s}{%(email)s}}''' title = self.paper_title authors = [] institutions_mentioned = set() for n, (auth, inst) in enumerate(zip(self.author_names, self.author_institutions)): # Corresponding author if n == 0: authors += [r'\author[%d,%d]{%s}' % (n, n + 1, auth)] authors += [r'\affil[0]{%s}' % self.author_emails[0]] else: authors += [r'\author[%d]{%s}' % (n + 1, auth)] authors += [r'\affil[%d]{%s}' % (n + 1, inst)] title_template = r'\newcounter{footnotecounter}' \ r'\title{%s}%s\maketitle' title_template = title_template % (title, '\n'.join(authors)) self.body_pre_docinfo = ['\n'.join(self.abstract_text) + title_template] # Save paper stats self.document.stats = {'title': title, 'authors': ', '.join(self.author_names), 'author': self.author_names, 'author_email': self.author_emails, 'author_institution': self.author_institutions, 'abstract': self.abstract_text, 'keywords': self.keywords}
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) title = self.paper_title authors = ', '.join(self.author_names) d = {} compsocthanks = '' for auth, inst in zip(self.author_names, self.author_institutions): d.setdefault(inst, []).append(auth) for inst, authlist in d.iteritems(): if len(authlist) <= 2: auths = ' and '.join(authlist) else: auths = ', '.join(authlist[:-1] + [ 'and ' + authlist[-1], ]) verb = ' is ' if len(authlist) == 1 else ' are ' compsocthanks += auths + verb + 'with ' + inst_table[ inst] + ' ' + inst + '. ' copyright_holder = self.author_names[0] + ('.' if len( self.author_names) == 1 else ' et al.') author_notes = r'''E-mail: \protect\href{%s}{%s}. \noindent \copyright %s %s %s ''' % ('mailto:' + self.author_emails[0], self.author_emails[0], options['proceedings']['year'], copyright_holder, options['proceedings']['copyright']['article']) author_notes = compsocthanks + author_notes title_template = '\\title{%s}\\author{%s\\thanks{%s}}\\maketitle' title_template = title_template % (title, authors, author_notes) marks = r''' \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} ''' % (options['proceedings']['title']['short'], title.upper()) title_template += marks self.body_pre_docinfo = [title_template] # Save paper stats self.document.stats = { 'title': title, 'authors': authors, 'author': self.author_names, 'author_institution': self.author_institutions, 'abstract': self.abstract_text, 'keywords': self.keywords, 'copyright_holder': copyright_holder }
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) title = self.paper_title authors = ', '.join(self.author_names) d = {} compsocthanks = '' for auth, inst in zip(self.author_names, self.author_institutions): d.setdefault(inst, []).append(auth) for inst, authlist in d.iteritems(): if len(authlist) <= 2: auths = ' and '.join(authlist) else: auths = ', '.join(authlist[:-1] + ['and ' + authlist[-1],]) verb= ' is ' if len(authlist)==1 else ' are ' compsocthanks += auths+verb+'with '+ inst_table.get(inst, '') +' '+inst+'. ' copyright_holder = self.author_names[0] + ('.' if len(self.author_names) == 1 else ' et al.') author_notes = r'''E-mail: \protect\href{%s}{%s}. \noindent \copyright %s %s %s ''' % ('mailto:' + self.author_emails[0], self.author_emails[0], options['proceedings']['year'], copyright_holder, options['proceedings']['copyright']['article']) author_notes = compsocthanks+author_notes title_template = '\\title{%s}\\author{%s\\thanks{%s}}\\maketitle' title_template = title_template % (title, authors, author_notes) marks = r''' \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} ''' % (options['proceedings']['title']['short'], title.upper()) title_template += marks self.body_pre_docinfo = [title_template] # Save paper stats self.document.stats = {'title': title, 'authors': authors, 'author': self.author_names, 'author_email': self.author_emails, 'author_institution': self.author_institutions, 'abstract': self.abstract_text, 'keywords': self.keywords, 'copyright_holder': copyright_holder}
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) ## Generate footmarks # build map: institution -> (author1, author2) institution_authors = OrderedDict() for auth in self.author_institution_map: for inst in self.author_institution_map[auth]: institution_authors.setdefault(inst, []).append(auth) def footmark(n): """Insert footmark #n. Footmark 1 is reserved for the corresponding author. Footmark 2 is reserved for the equal contributors.\ """ return ('\\setcounter{footnotecounter}{%d}' % n, '\\fnsymbol{footnotecounter}') # Build a footmark for the corresponding author corresponding_footmark = footmark(1) # Build a footmark for equal contributors equal_footmark = footmark(2) # Build one footmark for each institution institute_footmark = {} for i, inst in enumerate(institution_authors): institute_footmark[inst] = footmark(i + 3) footmark_template = r'\thanks{%(footmark)s %(instutions)}' corresponding_auth_template = r'''%% %(footmark_counter)s\thanks{%(footmark)s %% Corresponding author: \protect\href{mailto:%(email)s}{%(email)s}}''' equal_contrib_template = r'''%% %(footmark_counter)s\thanks{%(footmark)s %% These authors contributed equally.}''' title = self.paper_title authors = [] institutions_mentioned = set() equal_authors_mentioned = False corr_emails = [] if len(self.corresponding) == 0: self.corresponding = [self.author_names[0]] for n, auth in enumerate(self.author_names): if auth in self.corresponding: corr_emails.append(self.author_emails[n]) for n, auth in enumerate(self.author_names): # get footmarks footmarks = ''.join([''.join(institute_footmark[inst]) for inst in self.author_institution_map[auth]]) if auth in self.equal_contributors: footmarks += ''.join(equal_footmark) if auth in self.corresponding: footmarks += ''.join(corresponding_footmark) authors += [r'%(author)s$^{%(footmark)s}$' % {'author': auth, 'footmark': footmarks}] if auth in self.equal_contributors and equal_authors_mentioned==False: fm_counter, fm = equal_footmark authors[-1] += equal_contrib_template % \ {'footmark_counter': fm_counter, 'footmark': fm} equal_authors_mentioned = True if auth in self.corresponding: fm_counter, fm = corresponding_footmark authors[-1] += corresponding_auth_template % \ {'footmark_counter': fm_counter, 'footmark': fm, 'email': ', '.join(corr_emails)} for inst in self.author_institution_map[auth]: if not inst in institutions_mentioned: fm_counter, fm = institute_footmark[inst] authors[-1] += r'%(footmark_counter)s\thanks{%(footmark)s %(institution)s}' % \ {'footmark_counter': fm_counter, 'footmark': fm, 'institution': inst} institutions_mentioned.add(inst) ## Add copyright # If things went spectacularly wrong, we could not even parse author # info. Just fill in some dummy info so that we can see the error # messages in the resulting PDF. if len(self.author_names) == 0: self.author_names = ['John Doe'] self.author_emails = ['*****@*****.**'] authors = [''] copyright_holder = self.copyright_holder or (self.author_names[0] + ('.' if len(self.author_names) == 1 else ' et al.')) author_notes = r'''%% \noindent%% Copyright\,\copyright\,%(year)s %(copyright_holder)s %(copyright)s%% ''' % \ {'email': self.author_emails[0], 'year': options['proceedings']['year'], 'copyright_holder': copyright_holder, 'copyright': options['proceedings']['copyright']['article']} authors[-1] += r'\thanks{%s}' % author_notes ## Set up title and page headers if not self.video_url: video_template = '' else: video_template = r'\\\vspace{5mm}\tt\url{%s}\vspace{-5mm}' % self.video_url title_template = r'\newcounter{footnotecounter}' \ r'\title{%s}\author{%s' \ r'%s}\maketitle' title_template = title_template % (title, ', '.join(authors), video_template) marks = r''' \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} ''' % (options['proceedings']['title']['short'], title.upper()) title_template += marks self.body_pre_docinfo = [title_template] # Save paper stats self.document.stats = {'title': title, 'authors': ', '.join(self.author_names), 'author': self.author_names, 'author_email': self.author_emails, 'author_institution': self.author_institutions, 'abstract': self.abstract_text, 'keywords': self.keywords, 'copyright_holder': copyright_holder, 'video': self.video_url, 'bibliography':self.bibliography} if hasattr(self, 'bibtex') and self.bibtex: self.document.stats.update({'bibliography': self.bibtex[1]})
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) ## Generate footmarks # build map: institution -> (author1, author2) institution_authors = OrderedDict() for auth in self.author_institution_map: for inst in self.author_institution_map[auth]: institution_authors.setdefault(inst, []).append(auth) def footmark(n): """Insert footmark #n. Footmark 1 is reserved for the corresponding author. Footmark 2 is reserved for the equal contributors.\ """ return ('\\setcounter{footnotecounter}{%d}' % n, '\\fnsymbol{footnotecounter}') # Build a footmark for the corresponding author corresponding_footmark = footmark(1) # Build a footmark for equal contributors equal_footmark = footmark(2) # Build one footmark for each institution institute_footmark = {} for i, inst in enumerate(institution_authors): institute_footmark[inst] = footmark(i + 3) footmark_template = r'\thanks{%(footmark)s %(instutions)}' corresponding_auth_template = r'''%% %(footmark_counter)s\thanks{%(footmark)s %% Corresponding author: \protect\href{mailto:%(email)s}{%(email)s}}''' equal_contrib_template = r'''%% %(footmark_counter)s\thanks{%(footmark)s %% These authors contributed equally.}''' title = self.paper_title authors = [] institutions_mentioned = set() equal_authors_mentioned = False corr_emails = [] if len(self.corresponding) == 0: self.corresponding = [self.author_names[0]] for n, auth in enumerate(self.author_names): if auth in self.corresponding: corr_emails.append(self.author_emails[n]) for n, auth in enumerate(self.author_names): # get footmarks footmarks = ''.join([ ''.join(institute_footmark[inst]) for inst in self.author_institution_map[auth] ]) if auth in self.equal_contributors: footmarks += ''.join(equal_footmark) if auth in self.corresponding: footmarks += ''.join(corresponding_footmark) authors += [ r'%(author)s$^{%(footmark)s}$' % { 'author': auth, 'footmark': footmarks } ] if auth in self.equal_contributors and equal_authors_mentioned == False: fm_counter, fm = equal_footmark authors[-1] += equal_contrib_template % \ {'footmark_counter': fm_counter, 'footmark': fm} equal_authors_mentioned = True if auth in self.corresponding: fm_counter, fm = corresponding_footmark authors[-1] += corresponding_auth_template % \ {'footmark_counter': fm_counter, 'footmark': fm, 'email': ', '.join(corr_emails)} for inst in self.author_institution_map[auth]: if not inst in institutions_mentioned: fm_counter, fm = institute_footmark[inst] authors[-1] += r'%(footmark_counter)s\thanks{%(footmark)s %(institution)s}' % \ {'footmark_counter': fm_counter, 'footmark': fm, 'institution': inst} institutions_mentioned.add(inst) ## Add copyright # If things went spectacularly wrong, we could not even parse author # info. Just fill in some dummy info so that we can see the error # messages in the resulting PDF. if len(self.author_names) == 0: self.author_names = ['John Doe'] self.author_emails = ['*****@*****.**'] authors = [''] copyright_holder = self.copyright_holder or ( self.author_names[0] + ('.' if len(self.author_names) == 1 else ' et al.')) author_notes = r'''%% \noindent%% Copyright\,\copyright\,%(year)s %(copyright_holder)s %(copyright)s%% ''' % \ {'email': self.author_emails[0], 'year': options['proceedings']['year'], 'copyright_holder': copyright_holder, 'copyright': options['proceedings']['copyright']['article']} authors[-1] += r'\thanks{%s}' % author_notes ## Set up title and page headers if not self.video_url: video_template = '' else: video_template = r'\\\vspace{5mm}\tt\url{%s}\vspace{-5mm}' % self.video_url title_template = r'\newcounter{footnotecounter}' \ r'\title{%s}\author{%s' \ r'%s}\maketitle' title_template = title_template % (title, ', '.join(authors), video_template) marks = r''' \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} ''' % (options['proceedings']['title']['short'], title.upper()) title_template += marks self.body_pre_docinfo = [title_template] # Save paper stats self.document.stats = { 'title': title, 'authors': ', '.join(self.author_names), 'author': self.author_names, 'author_email': self.author_emails, 'author_institution': self.author_institutions, 'abstract': self.abstract_text, 'keywords': self.keywords, 'copyright_holder': copyright_holder, 'video': self.video_url, 'bibliography': self.bibliography } if hasattr(self, 'bibtex') and self.bibtex: self.document.stats.update({'bibliography': self.bibtex[1]})
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) ## Generate footmarks # build map: institution -> (author1, author2) institution_authors = OrderedDict() for auth, inst in zip(self.author_names, self.author_institutions): institution_authors.setdefault(inst, []).append(auth) def footmark(n): """Insert footmark #n. Footmark 1 is reserved for the corresponding author.\ """ return ('\\setcounter{footnotecounter}{%d}' % n, '\\fnsymbol{footnotecounter}') # Build one footmark for each institution institute_footmark = {} for i, inst in enumerate(institution_authors): institute_footmark[inst] = footmark(i + 2) footmark_template = r'\thanks{%(footmark)s %(instutions)}' corresponding_auth_template = r'''%% %(footmark_counter)s\thanks{%(footmark)s %% Corresponding author: \protect\href{mailto:%(email)s}{%(email)s}}''' title = self.paper_title authors = [] institutions_mentioned = set() for n, (auth, inst) in enumerate(zip(self.author_names, self.author_institutions)): # Corresponding author if n == 0: authors += [r'%(author)s$^{%(footmark)s}$' % \ {'author': auth, 'footmark': ''.join(footmark(1)) + ''.join(institute_footmark[inst])}] fm_counter, fm = footmark(1) authors[-1] += corresponding_auth_template % \ {'footmark_counter': fm_counter, 'footmark': fm, 'email': self.author_emails[0]} else: authors += [r'%(author)s$^{%(footmark)s}$' % {'author': auth, 'footmark': ''.join(institute_footmark[inst])}] if not inst in institutions_mentioned: fm_counter, fm = institute_footmark[inst] authors[-1] += r'%(footmark_counter)s\thanks{%(footmark)s %(institution)s}' % \ {'footmark_counter': fm_counter, 'footmark': fm, 'institution': inst} institutions_mentioned.add(inst) ## Add copyright copyright_holder = self.author_names[0] + ('.' if len(self.author_names) == 1 else ' et al.') author_notes = r'''%% \noindent%% Copyright\,\copyright\,%(year)s %(copyright_holder)s %(copyright)s%% ''' % \ {'email': self.author_emails[0], 'year': options['proceedings']['copyright_year'], 'copyright_holder': copyright_holder, 'copyright': options['proceedings']['copyright']['article']} authors[-1] += r'\thanks{%s}' % author_notes ## Set up title and page headers title_template = r'\newcounter{footnotecounter}' \ r'\title{%s}\author{%s}\maketitle' title_template = title_template % (title, ', '.join(authors)) marks = r''' \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} ''' % (options['proceedings']['title']['short'], title.upper()) title_template += marks self.body_pre_docinfo = [title_template] # Save paper stats self.document.stats = {'title': title, 'authors': ', '.join(self.author_names), 'author': self.author_names, 'author_email': self.author_emails, 'author_institution': self.author_institutions, 'abstract': self.abstract_text, 'keywords': self.keywords, 'copyright_holder': copyright_holder}
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) ## Generate footmarks # build map: institution -> (author1, author2) institution_authors = OrderedDict() for auth, inst in zip(self.author_names, self.author_institutions): institution_authors.setdefault(inst, []).append(auth) def footmark(n): """Insert footmark #n. Footmark 1 is reserved for the corresponding author.\ """ return ('\\setcounter{footnotecounter}{%d}' % n, '\\fnsymbol{footnotecounter}') # Build one footmark for each institution institute_footmark = {} for i, inst in enumerate(institution_authors): institute_footmark[inst] = footmark(i + 2) footmark_template = r'\thanks{%(footmark)s %(instutions)}' corresponding_auth_template = r'''%% %(footmark_counter)s\thanks{%(footmark)s %% Corresponding author: \protect\href{mailto:%(email)s}{%(email)s}}''' title = self.paper_title authors = [] institutions_mentioned = set() for n, (auth, inst) in enumerate( zip(self.author_names, self.author_institutions)): # Corresponding author if n == 0: authors += [r'%(author)s$^{%(footmark)s}$' % \ {'author': auth, 'footmark': ''.join(footmark(1)) + ''.join(institute_footmark[inst])}] fm_counter, fm = footmark(1) authors[-1] += corresponding_auth_template % \ {'footmark_counter': fm_counter, 'footmark': fm, 'email': self.author_emails[0]} else: authors += [ r'%(author)s$^{%(footmark)s}$' % { 'author': auth, 'footmark': ''.join(institute_footmark[inst]) } ] if not inst in institutions_mentioned: fm_counter, fm = institute_footmark[inst] authors[-1] += r'%(footmark_counter)s\thanks{%(footmark)s %(institution)s}' % \ {'footmark_counter': fm_counter, 'footmark': fm, 'institution': inst} institutions_mentioned.add(inst) ## Add copyright copyright_holder = self.author_names[0] + ('.' if len( self.author_names) == 1 else ' et al.') author_notes = r'''%% \noindent%% Copyright\,\copyright\,%(year)s %(copyright_holder)s %(copyright)s%% ''' % \ {'email': self.author_emails[0], 'year': options['proceedings']['year'], 'copyright_holder': copyright_holder, 'copyright': options['proceedings']['copyright']['article']} authors[-1] += r'\thanks{%s}' % author_notes ## Set up title and page headers if not self.video_url: video_template = '' else: video_template = r'\\\vspace{5mm}\tt\url{%s}\vspace{-5mm}' % self.video_url title_template = r'\newcounter{footnotecounter}' \ r'\title{%s}\author{%s' \ r'%s}\maketitle' title_template = title_template % (title, ', '.join(authors), video_template) marks = r''' \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} ''' % (options['proceedings']['title']['short'], title.upper()) title_template += marks self.body_pre_docinfo = [title_template] # Save paper stats self.document.stats = { 'title': title, 'authors': ', '.join(self.author_names), 'author': self.author_names, 'author_email': self.author_emails, 'author_institution': self.author_institutions, 'abstract': self.abstract_text, 'keywords': self.keywords, 'copyright_holder': copyright_holder }
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) ## Generate footmarks # build map: institution -> (author1, author2) institution_authors = OrderedDict() for auth in self.author_institution_map: for inst in self.author_institution_map[auth]: institution_authors.setdefault(inst, []).append(auth) def footmark(n): """Insert footmark #n. Footmark 1 is reserved for the corresponding author. Footmark 2 is reserved for the equal contributors.\ """ return ("\\setcounter{footnotecounter}{%d}" % n, "\\fnsymbol{footnotecounter}") # Build a footmark for the corresponding author corresponding_footmark = footmark(1) # Build a footmark for equal contributors equal_footmark = footmark(2) # Build one footmark for each institution institute_footmark = {} for i, inst in enumerate(institution_authors): institute_footmark[inst] = footmark(i + 3) footmark_template = r"\thanks{%(footmark)s %(instutions)}" corresponding_auth_template = r"""%% %(footmark_counter)s\thanks{%(footmark)s %% Corresponding author: \protect\href{mailto:%(email)s}{%(email)s}}""" equal_contrib_template = r"""%% %(footmark_counter)s\thanks{%(footmark)s %% These authors contributed equally.}""" title = self.paper_title authors = [] institutions_mentioned = set() equal_authors_mentioned = False corr_emails = [] if len(self.corresponding) == 0: self.corresponding = [self.author_names[0]] for n, auth in enumerate(self.author_names): if auth in self.corresponding: corr_emails.append(self.author_emails[n]) for n, auth in enumerate(self.author_names): # get footmarks footmarks = "".join(["".join(institute_footmark[inst]) for inst in self.author_institution_map[auth]]) if auth in self.equal_contributors: footmarks += "".join(equal_footmark) if auth in self.corresponding: footmarks += "".join(corresponding_footmark) authors += [r"%(author)s$^{%(footmark)s}$" % {"author": auth, "footmark": footmarks}] if auth in self.equal_contributors and equal_authors_mentioned == False: fm_counter, fm = equal_footmark authors[-1] += equal_contrib_template % {"footmark_counter": fm_counter, "footmark": fm} equal_authors_mentioned = True if auth in self.corresponding: fm_counter, fm = corresponding_footmark authors[-1] += corresponding_auth_template % { "footmark_counter": fm_counter, "footmark": fm, "email": ", ".join(corr_emails), } for inst in self.author_institution_map[auth]: if not inst in institutions_mentioned: fm_counter, fm = institute_footmark[inst] authors[-1] += r"%(footmark_counter)s\thanks{%(footmark)s %(institution)s}" % { "footmark_counter": fm_counter, "footmark": fm, "institution": inst, } institutions_mentioned.add(inst) ## Add copyright # If things went spectacularly wrong, we could not even parse author # info. Just fill in some dummy info so that we can see the error # messages in the resulting PDF. if len(self.author_names) == 0: self.author_names = ["John Doe"] self.author_emails = ["*****@*****.**"] authors = [""] copyright_holder = self.copyright_holder or ( self.author_names[0] + ("." if len(self.author_names) == 1 else " et al.") ) author_notes = r"""%% \noindent%% Copyright\,\copyright\,%(year)s %(copyright_holder)s %(copyright)s%% """ % { "email": self.author_emails[0], "year": options["proceedings"]["year"], "copyright_holder": copyright_holder, "copyright": options["proceedings"]["copyright"]["article"], } authors[-1] += r"\thanks{%s}" % author_notes ## Set up title and page headers if not self.video_url: video_template = "" else: video_template = r"\\\vspace{5mm}\tt\url{%s}\vspace{-5mm}" % self.video_url title_template = r"\newcounter{footnotecounter}" r"\title{%s}\author{%s" r"%s}\maketitle" title_template = title_template % (title, ", ".join(authors), video_template) marks = r""" \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} """ % ( options["proceedings"]["title"]["short"], title.upper(), ) title_template += marks self.body_pre_docinfo = [title_template] # Save paper stats self.document.stats = { "title": title, "authors": ", ".join(self.author_names), "author": self.author_names, "author_email": self.author_emails, "author_institution": self.author_institutions, "author_institution_map": self.author_institution_map, "abstract": self.abstract_text, "keywords": self.keywords, "copyright_holder": copyright_holder, "video": self.video_url, "bibliography": self.bibliography, } if hasattr(self, "bibtex") and self.bibtex: self.document.stats.update({"bibliography": self.bibtex[1]})
def depart_document(self, node): LaTeXTranslator.depart_document(self, node) ## Generate footmarks # build map: institution -> (author1, author2) institution_authors = OrderedDict() for auth, inst in zip(self.author_names, self.author_institutions): institution_authors.setdefault(inst, []).append(auth) def footmark(n): """Insert footmark #n. Footmark 1 is reserved for the corresponding author.\ """ return ("\\setcounter{footnotecounter}{%d}" % n, "\\fnsymbol{footnotecounter}") # Build one footmark for each institution institute_footmark = {} for i, inst in enumerate(institution_authors): institute_footmark[inst] = footmark(i + 2) footmark_template = r"\thanks{%(footmark)s %(instutions)}" corresponding_auth_template = r"""%% %(footmark_counter)s\thanks{%(footmark)s %% Corresponding author: \protect\href{mailto:%(email)s}{%(email)s}}""" title = self.paper_title authors = [] institutions_mentioned = set() for n, (auth, inst) in enumerate(zip(self.author_names, self.author_institutions)): # Corresponding author if n == 0: authors += [ r"%(author)s$^{%(footmark)s}$" % {"author": auth, "footmark": "".join(footmark(1)) + "".join(institute_footmark[inst])} ] fm_counter, fm = footmark(1) authors[-1] += corresponding_auth_template % { "footmark_counter": fm_counter, "footmark": fm, "email": self.author_emails[0], } else: authors += [ r"%(author)s$^{%(footmark)s}$" % {"author": auth, "footmark": "".join(institute_footmark[inst])} ] if not inst in institutions_mentioned: fm_counter, fm = institute_footmark[inst] authors[-1] += r"%(footmark_counter)s\thanks{%(footmark)s %(institution)s}" % { "footmark_counter": fm_counter, "footmark": fm, "institution": inst, } institutions_mentioned.add(inst) ## Add copyright copyright_holder = self.author_names[0] + ("." if len(self.author_names) == 1 else " et al.") author_notes = r"""%% \noindent%% Copyright\,\copyright\,%(year)s %(copyright_holder)s %(copyright)s%% """ % { "email": self.author_emails[0], "year": options["proceedings"]["year"], "copyright_holder": copyright_holder, "copyright": options["proceedings"]["copyright"]["article"], } authors[-1] += r"\thanks{%s}" % author_notes ## Set up title and page headers title_template = r"\newcounter{footnotecounter}" r"\title{%s}\author{%s}\maketitle" title_template = title_template % (title, ", ".join(authors)) marks = r""" \renewcommand{\leftmark}{%s} \renewcommand{\rightmark}{%s} """ % ( options["proceedings"]["title"]["short"], title.upper(), ) title_template += marks self.body_pre_docinfo = [title_template] # Save paper stats self.document.stats = { "title": title, "authors": ", ".join(self.author_names), "author": self.author_names, "author_email": self.author_emails, "author_institution": self.author_institutions, "abstract": self.abstract_text, "keywords": self.keywords, "copyright_holder": copyright_holder, }