bib2titlepage

Here is a program to take a standard Bibtex reference and output a latex file for a title page.

I thought it would be nice to have a uniform style of title page if one wanted to group some papers from different journals into one big printout.


Input .bib Output .tex PDFLatex of output
@article {MR0210668, AUTHOR = {Baker, A.}, TITLE = {On {M}ahler's classification of transcendental numbers. {II}. {S}imultaneous {D}iophantine approximation}, JOURNAL = {Acta Arith}, FJOURNAL = {Polska Akademia Nauk. Instytut Matematyczny. Acta Arithmetica}, VOLUME = {12}, YEAR = {1966/1967}, PAGES = {281--288}, ISSN = {0065-1036}, MRCLASS = {10.32}, MRNUMBER = {0210668}, MRREVIEWER = {W. J. LeVeque}, DOI = {10.4064/aa-12-3-281-288}, URL = {https://doi.org/10.4064/aa-12-3-281-288}, } \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{setspace} \usepackage[left=2.54cm, right=2.54cm, top=3.175cm]{geometry} \setstretch{1.15} \newcommand{\papertitle}[2]{\large\uppercase{\textbf{#1}\break\break \normalsize#2 \break\break\break}} \newcommand{\paperjournal}[4]{\uppercase{\normalsize#1 \break\small Volume: #2\quad Pages: #3 \quad Year: #4\break\break}} \newcommand{\paperclassification}[1]{\uppercase{\normalsize MSC: #1}\break} \newcommand{\paperinternationalreference}[1]{\uppercase{\normalsize ISSN: #1}} \begin{document} \center \papertitle{Continued fractions of transcendental numbers}{Baker, A.} \paperjournal{Mathematika. A Journal of Pure and Applied Mathematics}{9}{1--8}{1962} \paperclassification{10.32} \paperinternationalreference{0025-5793} \end{document}
Picture of LATEX output

Program reproduced below:

program bib2titlepage implicit none character(len=1000) :: title character(len=100) :: author character(len=1000) :: journal character(len=100) :: volume character(len=100) :: year character(len=100) :: pages character(len=100) :: msc character(len=100) :: issn character(len=1000) :: inputarg character(len=1000) :: outputarg call getarg(1, inputarg) call getarg(2, outputarg) open(1,FILE=trim(inputarg),action="read") open(2,FILE=trim(outputarg)) call get_datastring(1,title,"TITLE") call get_datastring(1,author,"AUTHOR") call get_datastring(1,journal,"FJOURNAL") call get_datastring(1,volume,"VOLUME") call get_datastring(1,pages,"PAGES") call get_datastring(1,year,"YEAR") call get_datastring(1,msc,"MRCLASS") call get_datastring(1,issn,"ISSN") write(2,*) "\documentclass[a4paper,10pt]{article}" write(2,*) "\usepackage[utf8]{inputenc}" write(2,*) "\usepackage{setspace}" write(2,*) "\usepackage[left=2.54cm, right=2.54cm, top=3.175cm]{geometry}" write(2,*) "\setstretch{1.15}" write(2,*) "\newcommand{\papertitle}[2]{\large\uppercase{\textbf{#1}\break\break \normalsize#2 \break\break\break}}" write(2,*) "\newcommand{\paperjournal}[4]{\uppercase{\normalsize#1 & &\break\small Volume: #2\quad Pages: #3 \quad Year: #4\break\break}}" write(2,*) "\newcommand{\paperclassification}[1]{\uppercase{\normalsize MSC: #1}\break}" write(2,*) "\newcommand{\paperinternationalreference}[1]{\uppercase{\normalsize ISSN: #1}}" write(2,*) "\begin{document}" write(2,*) "\center" write(2,*) "\papertitle{",trim(title), "}{", trim(author), "}" write(2,*) "\paperjournal{", trim(journal), "}{", trim(volume), "}{", trim(pages), "}{", trim(year), "}" write(2,*) "\paperclassification{", trim(msc), "}" write(2,*) "\paperinternationalreference{", trim(issn), "}" write(2,*) "\end{document}" close(1) close(2) end program bib2titlepage subroutine get_datastring(u,datastring,textstring) character(len=1000) :: textbuffer character(len=1000) :: text integer :: posn1 integer :: posn2 integer :: correct_line integer :: IOstatus character(len=*) :: datastring character(len=*) :: textstring integer :: u integer :: line_is_fully_retrieved rewind(u) 10 read (u,"(a)",IOSTAT=IOstatus) text if(IOstatus > 0) stop "Necessary data not found" correct_line = index(text,trim(textstring)) if(correct_line == 0) goto 10 20 line_is_fully_retrieved = 0 call left_and_right_curly_brackets_equality(text, line_is_fully_retrieved) if(line_is_fully_retrieved == 1) goto 30 read (u,"(a)",IOSTAT=IOstatus) textbuffer if(IOstatus > 0) stop "Necessary data not found" text = trim(text) // trim(textbuffer) goto 20 30 posn1 = index(text,"{") posn2 = index(text,"}",.TRUE.) datastring = text(posn1+1:posn2-1) end subroutine get_datastring subroutine left_and_right_curly_brackets_equality(text, line_is_fully_retrieved) integer :: line_is_fully_retrieved character(len=*) :: text character(len=1000) :: textbuffer integer :: left_count integer :: right_count character :: currentchar integer :: posn write(*,*) "testing curly bracket equality" left_count = 0 right_count = 0 posn = 1 line_is_fully_retrieved = 0 textbuffer = text do while(posn /= len(trim(textbuffer))) currentchar = textbuffer(posn:posn) if(currentchar == "{") left_count = left_count + 1 if(currentchar == "}") right_count = right_count + 1 posn = posn+1 end do if(left_count == right_count) line_is_fully_retrieved = 1 end subroutine left_and_right_curly_brackets_equality