✅ Overview
When writing academic papers in LaTeX, e.g. with Overleaf, it is common to organize figures into a separate directory, and sometimes to include files in directories to keep the main directory well-organized. Some publishers do not like this, however, and it is extremely annoying to have to manually copy all the files into a single directory with simple names, inline the bibliography, and flatten all the \input and \include commands into a single .tex file.
The manuscript module helps prepare LaTeX documents for journal submission by creating a self-contained, flattened version of your manuscript.
When submitting papers to journals, you often need:
A single
.texfile (no\inputor\includecommands)Bibliography inlined from the
.bblfileAll figures in the same directory with simple names
Local style files (
.sty,.cls,.bst) included
This module automates that process while preserving your original files.
✅ Commands
✅ Flatten Manuscript
Command: scimax.manuscript.flatten
Opens from Command Palette: "Scimax: Flatten Manuscript for Submission"
This is the main command that:
Optionally compiles your document to generate/update the
.bblfileFlattens all
\input{}and\include{}commandsInlines the bibliography (
.bblcontent)Renames figures sequentially (
1.pdf,2.png, etc.)Detects and copies local support files (
.sty,.cls,.bst, data files)Creates a timestamped submission directory
✅ Preview Flattening
Command: scimax.manuscript.preview
Opens from Command Palette: "Scimax: Preview Manuscript Flattening"
Shows what would happen without making changes:
Number of included files
Number of figures to rename
Support files to copy (
.sty,.cls,.bst, data files)Whether compilation is needed
Any warnings
✅ Flatten to Directory
Command: scimax.manuscript.flattenToDirectory
Opens from Command Palette: "Scimax: Flatten Manuscript to Directory"
Same as flatten, but lets you choose the output directory.
✅ Output Structure
Given a project structure like:
paper/ ├── main.tex ├── sections/ │ ├── intro.tex │ └── methods.tex ├── figures/ │ ├── plot1.pdf │ └── results.png ├── refs.bib └── main.bbl
After flattening, you get:
paper/ ├── submission-2026-01-20/ │ ├── main.tex # Flattened, all paths updated │ ├── 1.pdf # was figures/plot1.pdf │ └── 2.png # was figures/results.png └── (original files unchanged)
✅ Figure Naming
Figures are renamed sequentially with smart padding based on the total count:
| Total Figures | Naming Pattern |
|---|---|
| 1-9 | 1.pdf, 2.png, ... |
| 10-99 | 01.pdf, 02.png, ... |
| 100-999 | 001.pdf, 002.png, ... |
This ensures correct sorting in file managers.
✅ Support Files
The module automatically detects and copies local support files that your document needs:
✅ Style Files (.sty)
Custom LaTeX packages in your project directory. Detected from \usepackage{...} commands.
✅ Class Files (.cls)
Custom document classes. Detected from \documentclass{...}.
✅ Bibliography Style Files (.bst)
Custom bibliography styles. Detected from \bibliographystyle{...}.
Standard styles (plain, unsrt, alpha, IEEEtran, etc.) are not copied since they're available on most LaTeX installations.
✅ Data Files
Files used by packages like pgfplots:
\pgfplotstableread{data.csv}\DTLloaddb{name}{data.csv}\input{data.dat}
✅ Bibliography Handling
The module supports both traditional BibTeX and biblatex:
✅ BibTeX
Replaces
\bibliography{refs}with the contents ofmain.bblKeeps
\bibliographystyle{...}in place
✅ Biblatex
Replaces
\printbibliographywith the contents ofmain.bblComments out
\addbibresource{...}lines
✅ Compilation
Before flattening, the module checks if your .bbl file is up-to-date by comparing modification times of:
The
.texfileThe
.bibfile(s)The existing
.bblfile
If compilation is needed, you'll be prompted:
*Compile first* - Runs
pdflatex+bibtex/biberto update the.bbl*Use existing .bbl* - Uses the current
.bblas-is
The module auto-detects whether to use bibtex or biber based on your document's packages.
✅ Configuration
| Setting | Default | Description |
|---|---|---|
scimax.manuscript.autoCompile | "ask" | When to compile: always, if-needed, never, ask |
scimax.manuscript.pdflatexPath | "pdflatex" | Path to pdflatex executable |
scimax.manuscript.bibtexPath | "bibtex" | Path to bibtex executable |
scimax.manuscript.biberPath | "biber" | Path to biber executable |
✅ Workflow Example
Open your main
.texfileRun "Scimax: Flatten Manuscript for Submission" from Command Palette
Choose whether to compile first (recommended if you've made recent changes)
Wait for processing
Find your submission-ready files in
submission-YYYY-MM-DD/
✅ What Gets Flattened
✅ Included
\input{file}- Content inserted directly\include{file}- Content inserted with\clearpagebefore and after\includegraphics[opts]{path}- Figures renamed and paths updated\bibliography{refs}- Replaced with.bblcontent\printbibliography- Replaced with.bblcontent (biblatex)
✅ Ignored (Not Processed)
Commands inside
% commentsCommands inside verbatim environments (
verbatim,lstlisting,minted)\inputcommands that can't be resolved (warning issued)
✅ Warnings
The module issues warnings for:
Missing included files
Missing figure files
Missing
.bblfileCircular includes (A includes B, B includes A)
Maximum include depth exceeded (default: 20 levels)
Warnings are shown after flattening completes. You can review them by clicking "Show Warnings" in the success notification.
✅ Limitations
The module handles most common manuscript scenarios but has some limitations:
✅ Not Supported
| Feature | Description | Workaround |
|---|---|---|
\graphicspath | Custom figure search paths are not parsed | Use relative paths in \includegraphics |
| Custom fonts | Font files (.ttf, .otf) are not copied | Manually copy font files to submission directory |
| TikZ externalize | Externalized TikZ figures (.pdf cache) not handled | Disable externalize or manually copy |
| Index files | .ind files from makeindex not copied | Manually copy if using index |
| Glossary files | .gls files from makeglossaries not copied | Manually copy if using glossaries |
| Multiple bibliographies | Only one .bbl file supported | Combine bibliographies before flattening |
| Subfiles package | \subfile commands not processed | Use \input instead |
✅ Encoding
The module assumes UTF-8 encoding for all files. Non-UTF-8 files may cause errors or produce garbled output.
✅ Figure Detection
Only \includegraphics commands are detected. Other figure inclusion methods are not handled:
\pgfimage\pdfximageRaw PDF includes via
\pdfpages
✅ Path Resolution
Paths are resolved relative to the directory of the file containing the command
Absolute paths are not modified
Paths with special characters may not resolve correctly
✅ Bibliography Edge Cases
Multiple
\printbibliographycommands: only the first is replaced with content; others are commented outrefsectionenvironments (biblatex): not handled, may produce incomplete bibliographiesCustom
.bbllocations: the module looks for.bblalongside the main.texfile
✅ Support Files
Standard LaTeX packages from TeX distributions are not copied (they're assumed to be available). The module only copies files that exist in your project directory.