Skip to content

g-pachakis/Elsevier_formatting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Elsevier Manuscript Formatting

A Python script that reformats a Word manuscript (.docx) into Elsevier's single-column submission format, targeting journals such as Sustainable Production and Consumption.

What It Does

Takes your manuscript .docx (with headings, tables, references, figure placeholders) and produces a new .docx formatted to Elsevier submission guidelines:

Feature Output
Page setup A4, 2.5 cm margins, single-column
Typography Times New Roman 12 pt, 1.5× line spacing
Title page Title, author/affiliation placeholders, highlights, graphical abstract placeholder, abstract, keywords
Headings H1 bold, H2 bold italic, H3 italic — numbered (1., 1.1, 1.1.1)
Body text Justified, first-line indent (0.75 cm) after first paragraph
Tables Three-line borders (top, header-bottom, bottom only), 10 pt font
References Hanging indent, 11 pt, preserved as-is from source
Figures Placeholders with bold labels carried over
Equations Centred, preserved from source

Quick Start

# Install dependency
pip install python-docx

# Run
python elsevier_formatting.py manuscript.docx

Output: manuscript_Elsevier.docx in the same directory.

Specify output path

python elsevier_formatting.py manuscript.docx -o formatted_output.docx

Requirements

  • Python 3.9–3.12 (3.13 may have compatibility issues with python-docx)
  • python-docx ≥ 0.8.11 (only pip dependency)
  • lxml ≥ 4.9.0 (installed automatically with python-docx)
pip install -r requirements.txt

How It Works

The formatting script has three stages:

  1. Read — Opens the source .docx with python-docx, walks the document body in order (paragraphs, tables, section breaks), and classifies each element by its Word style name and text patterns (heading, abstract, keywords, table caption, figure placeholder, reference, etc.)

  2. Build — Creates a new python-docx Document with Elsevier page setup and styling, then writes each classified element with the appropriate formatting: title page structure, three-line tables, hanging-indent references, etc.

  3. Write — Saves the new .docx directly via python-docx.

Paragraph Classification

The script recognises these element types automatically:

Type Detection method
Title First paragraph before Abstract heading
Abstract Text following Abstract heading (style: Heading 1)
Keywords Starts with Keywords:
Heading 1 Style = Heading1 or Heading 1
Heading 2 Style = Heading2 or Heading 2
Heading 3 Style = Heading3 or Heading 3
Table caption Matches ^Table \d+\.
Table footer Starts with *, under 400 chars
Figure placeholder Matches [Figure N] or Figure N
Equation Contains (Eq. N)
Reference Style = Bibliography, or [N] pattern after References heading
Body paragraph Everything else

Tables

Source tables are read cell-by-cell (preserving merged cells and inline formatting) and rebuilt with Elsevier three-line borders:

  • Top rule — 1.5 pt solid black
  • Header separator — 1 pt solid black (bottom of first row)
  • Bottom rule — 1.5 pt solid black
  • No vertical lines, no internal horizontal lines

Title Page

The formatting script generates placeholder fields you fill in before submission:

  • [Author Name] with superscript affiliation markers
  • [Department, University/Institution, City, Country]
  • [email@institution.edu]
  • Highlights — 5 bullet placeholders (Elsevier requirement for many journals)
  • Graphical Abstract — Dashed-border placeholder box with size guidance
  • Abstract and keywords extracted from the source manuscript

Supported Manuscript Formats

The script expects a standard academic manuscript .docx with:

  • Word heading styles (Heading 1, Heading 2) or equivalent
  • Tables as Word tables (not images)
  • References with Bibliography style or [N] numbered format
  • Figure placeholders as text (e.g., [Figure 1] Caption text...)

It preserves inline formatting (bold, italic, superscript, subscript) from the source document.

Limitations

  • Does not convert reference style (e.g., numbered [1] to author-year) — use a reference manager for that
  • Does not embed images — figure placeholders are carried over as text
  • Designed for English-language manuscripts
  • Tables with complex nested merges may need minor manual adjustment

Repo Structure

Elsevier-formatting/
├── elsevier_formatting.py   # The formatting script
├── requirements.txt        # pip dependencies
├── README.md               # This file
├── LICENSE                  # MIT License
└── .gitignore

License

MIT — see LICENSE.

About

Python script that reformats Word manuscripts (.docx) into Elsevier journal template format. Run it, pick your file, get a publication-ready document.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages