Problem is the acronyms in the report are used throughout, but not surrounded in the standard latex way. It requires \ac{} around the acronyms.


In [1]:
from pylab import *

In [2]:
cd ../report/


/home/gavin/Documents/MRes/opencast-bio/report

In [8]:
with open("sections/misc/acronyms.tex") as f:
    s = f.readlines()

In [11]:
s = s[1:]

In [16]:
s[0].split("{")[1].strip("}")


Out[16]:
'DIP'

In [17]:
acronyms = []
for l in s:
    acronyms.append(l.split("{")[1].strip("}"))

In [19]:
import glob

In [22]:
texfiles = glob.glob("sections/*.tex")
texfiles += glob.glob("sections/appendix/*.tex")

In [30]:
for fname in texfiles:
    with open(fname) as f:
        fstring = f.read()
        for a in acronyms:
            fstring = fstring.replace(a,r"\ac{"+a+r"}")
    with open(fname,"w") as f:
        f.write(fstring)

This code does not check for acronym conflicts, so it can cause problems. Only caused minor problems though, which are now fixed, so everything is pretty much fine.