def _construct_header_string(markdown, use_source, per_atom, eform, hull, summary, energy_key):
    """ Construct the header of the table, from the passed options.
    For arguments, see docstring for `matador.utils.cursor_utils.display_results`.

    Returns:
        (str, str): the header and units string.

    """
    header_string = ''
    units_string = ''
    if not markdown:
        if use_source:
            header_string += "{:^38}".format('Source')
            units_string += "{:^38}".format('')
        else:
            header_string += "{:^26}".format('ID')
            units_string += "{:^26}".format('')

        header_string += "{:^5}".format('!?!')
        units_string += "{:^5}".format('')
    else:
        header_string += '```\n'
        header_string += "{:^43}".format('Root')
        units_string += "{:^43}".format('')

    header_string += "{:^10}".format('Pressure')
    units_string += "{:^10}".format('(GPa)')

    header_string += "{:^14}".format('Cell volume')
    if per_atom:
        units_string += "{:^14}".format('(Å³/atom)')
    else:
        units_string += "{:^14}".format('(Å³/fu)')

    if eform:
        header_string += "{:^18}".format('Formation energy')
        units_string += "{:^18}".format('(eV/atom)')
    elif hull:
        header_string += "{:^18}".format('Hull dist.')
        units_string += "{:^18}".format('(meV/atom)')
    elif per_atom:
        header_string += "{:^18}".format(' '.join(energy_key.replace('_per_atom', '').split('_')).title())
        units_string += "{:^18}".format('(eV/atom)')
    else:
        header_string += "{:^18}".format(' '.join(energy_key.replace('_per_atom', '').split('_')).title())
        units_string += "{:^18}".format('(eV/fu)')

    header_string += "{:^15}".format('Space group')
    header_string += " {:^13} ".format('Formula')
    header_string += "{:^8}".format('# fu')
    header_string += "{:^8}".format('Prov.')

    if summary:
        header_string += '{:^12}'.format('Occurrences')

    return header_string, units_string