当前位置:   article > 正文

NLPCC论文LaTeX封面生成代码

\tocauthor

先生成该表格:

  1. # In[1]
  2. import pandas as pd
  3. import os
  4. df = pd.read_excel('list.xlsx')
  5. ids = df['Pap ID'].to_list()
  6. lens = df['Page Length'].to_list()
  7. titles = df['Pap Title '].to_list()
  8. cor_authors = df['Corresponding Author'].to_list()
  9. authors = df['Authors'].to_list()
  10. emails = df['Corresponding Author Email'].to_list()
  11. affs = df['Affiliation'].to_list()
  12. affs
  13. # In[1]
  14. f = open('latex_mode.txt', 'w+', encoding='utf-8')
  15. Name = 'LNAI'
  16. page = 12430
  17. cor_mod = '{0}\\thanks{{\\mbox{{Corresponding author}}}}'
  18. latex_mod = """\setcounter{{page}}{{{0}}}
  19. \\title{{{1}}}
  20. \\author{{{2}}}
  21. \\tocauthor{{{3}}}
  22. {4}
  23. \\institute{{{5}\\\\
  24. \\email{{{6}}}}}
  25. \\maketitle
  26. \\clearpage
  27. """
  28. latex_mod
  29. # In[3]
  30. import re
  31. all_latexs = ""
  32. cur_length = 1
  33. for id, length, title, author, cor_author, aff, email in zip(ids, lens, titles, authors, cor_authors, affs, emails):
  34. id_name = '{0:05d}'.format(cur_length)
  35. cur_page = int(id_name)
  36. # print('cur_page: ', cur_page, cur_page % 800, cur_page % 801)
  37. if cur_page % 800 == 0 or cur_page % 801 == 0 % cur_page % 802 == 0:
  38. page += 1
  39. cur_name = Name + str(page) + id_name
  40. print(cur_name)
  41. # os.rename(str(id), cur_name)
  42. print('==============latex================')
  43. print(title, author, cor_author, aff, email)
  44. #### title ####
  45. ###############
  46. #### author ####
  47. author_li = re.split(',|and', author)
  48. new_author = []
  49. for li in author_li:
  50. li = li.strip()
  51. if li == cor_author:
  52. li = cor_mod.format(li)
  53. new_author.append(li)
  54. new_author = ' \\and '.join(new_author)
  55. # print(new_author)
  56. ################
  57. #### tocauthor ####
  58. tocauthor = author
  59. ####################
  60. ###### index #######
  61. indexs = ""
  62. for li in author_li:
  63. li = li.strip().split(' ')
  64. if len(li) == 2:
  65. idx = "\index{{{0}, {1}}}".format(li[1], li[0])
  66. indexs += idx + '\n'
  67. ####################
  68. ###### aff #######
  69. first_aff = aff.split('\n')[0]
  70. ###################
  71. ###### email ######
  72. ###################
  73. print(cur_length)
  74. cur_latex = latex_mod.format(cur_length, title,
  75. new_author, tocauthor,
  76. indexs[:-1], first_aff, email)
  77. print(cur_latex)
  78. # 更新 页码
  79. cur_length += length
  80. all_latexs = all_latexs + cur_latex + '\n'
  81. print(all_latexs)
  82. # %%
  83. f.write(all_latexs)
  84. f.close()

将生成代码复制到LaTeX封面模板中,生成如:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/384573
推荐阅读
相关标签
  

闽ICP备14008679号