Skip to main content

Text-based document files

In digital contexts, the word “document” is often used simply to mean a file. Here, however, we use “document files” to mean digital files used to store and share primarily text-based information written in natural language for human readers.

Document files can also contain other types of content, such as images, figures, and tables. These may either be embedded in the document itself or added through links and file path references to other files. The text in a document file may be unformatted, but document formats also allow different text styles, fonts, and layout features to be used to clarify, emphasize, or add meaning to the text, in line with the style conventions of the relevant field.

Using headings and subheadings helps communicate the thematic structure of a text to the reader. In the past, page numbering was an important feature of document files because they were mainly used to produce printed material. Today, however, document files are often intended for on-screen reading, where page numbering does not always serve the same purpose.

Common document file formats and their uses

Document files can be created in several different ways. Only the simplest documents can be saved and shared as plain text files (.txt), since plain text files do not support structure or formatting code, and cannot include images or other non-text content.

Most document files are created in word processing software, such as Microsoft Word or OpenOffice-based programs such as LibreOffice and Apache OpenOffice, or in cloud-based services such as Google Docs. The most common working formats for paginated documents are the XML-based formats .docx (Office Open XML) and .odt (OpenDocument). Both are internationally recognized open standards that can be read by many different applications.

Another category of document files is based on LaTeX, a typesetting system built on TeX. LaTeX is used mainly in academic disciplines that rely heavily on mathematical expressions, but it also includes document classes for articles, books, and presentations, as well as support for references and automatic numbering of sections, equations, and figures.

Many final versions of document files are saved in PDF format (Portable Document Format). This makes it possible to open and read the files while preserving their layout and structure, but it also makes them more difficult to edit. PDF is a flexible, platform-independent format, and free PDF readers are widely available. For long-term preservation, the recommended version is PDF/A, an ISO-standardized form of PDF, designed to ensure that documents can be displayed consistently over time in different PDF readers.

While word processing software and LaTeX were originally developed as systems for producing printed documents, HyperText Markup Language (HTML) is a markup language, a text-encoding system designed for displaying documents in web browsers. The basic principle behind HTML, and the more general Extensible Markup Language (XML), is that a document’s content and structure are kept separate from the instructions (code) that control how its elements are presented. HTML files are intended to be viewed in a web browser and lose functionality and formatting if they are saved as PDFs or printed on paper.

A simpler markup language is Markdown, which occupies a middle ground between plain text and HTML. One of its main advantages is that Markdown documents can be read and written as plain text without looking heavily marked up with tags and formatting instructions, while still being easy to convert into Word, PDF, and HTML formats for formatted display and use with hyperlinks.

Things to consider when creating document files

When saving documents as PDF or PDF/A, make sure you also save them separately in their original format, such as .docx or .odt. Check that the correct fonts are used and that images appear in the right places. You should also verify that the version being preserved is the final clean version of the document, without notes or comments from earlier drafts.

Pay attention to the following aspects:

  • The document’s hierarchical structure, such as heading levels.
    Use styles systematically, as this creates metadata that can be retained when the file is converted. Examples include automatically generated tables of contents, anchors or bookmarks linked to page numbers, and similar features.
  • Page numbering in the document. If readers need to cite or refer to the document, page numbers need to be correct in the PDF version.
    For paginated document files, it is useful if the page numbers shown in the document are synchronized with the underlying markup and preserved during file conversion. In standard pagination, for example, page number 1 is the first page after the table of contents. Where possible, this page-number information should be exported to the PDF so that PDF readers display the same numbering, rather than treating the cover page as page 1 and numbering all following pages sequentially.
  • Embedded material, particularly images, should be saved separately if it is considered part of the data material.

Recommended file formats for sharing

Because the dominant formats for document files are so well-established and widely supported, there is rarely any need to share document files in proprietary formats. Note, however, that files in the older MS Word format (.doc) should be converted to Office Open XML (.docx) or exported as PDF before being made available.

  • ASCII (.txt), Unicode (.txt)
  • MS Word (.docx)
  • OpenDocument Text (.odt)
  • PDF (.pdf), PDF/A (.pdf)
  • HTML (.html)
  • Markdown (.md)
  • XML (.xml)
  • SGML (.sgml)
  • Rich Text Format (.rtf)

Recommended file formats for long-term preservation in archives or similar

The file formats that are the best for sharing documents today may not be the most suitable for long-term preservation and archiving. On its website, the Swedish National Archives provides information on requirements, recommendations, guidance and support relating, among other things, to sustainable formats for electronic records. (See their information in Swedish on Elektroniska handlingar.)
Below are some file formats recommended for long-term preservation in archives and similar repositories.

Note that standard PDF, originally developed by Adobe, is a proprietary format, and is therefore generally not recommended for long-term preservation. PDF/A builds on PDF and was developed as an open standard specifically intended for long-term preservation.

  • ASCII (.txt), Unicode (.txt)
  • MS Word (.docx)
  • OpenDocument Text (.odt)
  • PDF/A (.pdf)
  • HTML (.html)
  • Markdown (.md)
  • XML (.xml)

For more information on file formats for text, see the ARIADNE guide Documents and digital texts: A guide to good practice (PDF). The guides have been developed by SND and translated into English in collaboration with the EU-funded research infrastructure ARIADNE. ARIADNE is responsible for updating the English guides and keeping them accessible.