A Python script that reformats a Word manuscript (.docx) into Elsevier's single-column submission format, targeting journals such as Sustainable Production and Consumption.
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 |
# Install dependency
pip install python-docx
# Run
python elsevier_formatting.py manuscript.docxOutput: manuscript_Elsevier.docx in the same directory.
python elsevier_formatting.py manuscript.docx -o formatted_output.docx- 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.txtThe formatting script has three stages:
-
Read — Opens the source
.docxwithpython-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.) -
Build — Creates a new
python-docxDocument 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. -
Write — Saves the new
.docxdirectly viapython-docx.
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 |
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
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
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
Bibliographystyle 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.
- 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
Elsevier-formatting/
├── elsevier_formatting.py # The formatting script
├── requirements.txt # pip dependencies
├── README.md # This file
├── LICENSE # MIT License
└── .gitignore
MIT — see LICENSE.