def read_template(file_name):
  """reads the tex content from a file and returns it as a string"""
 
  # open file
  with open(file_name, 'r') as file:

    # skip lines until we read a latex comment marker
    for line in file:
      if len(line) > 0 and line[0] == '%': break

    # add lines to the template until we read a python docstring marker
    template = ""
    for line in file:
      if len(line) >= 3 and line[0:3] == '"""': break
      template += line

  # return template
  return template