✅ Overview
The Scimax VS Code extension provides a comprehensive export system for converting org-mode documents to various formats including HTML, LaTeX, PDF, Markdown, and Microsoft Word (DOCX). The export system follows the familiar org-mode export dispatcher interface (`C-c C-e') from Emacs.
✅ Export Dispatcher
✅ Opening the Export Dispatcher
Press `C-c C-e' (or `C-c C-e' in Emacs notation) to open the export dispatcher menu. This provides a quick-pick interface showing all available export formats and options.
The export dispatcher presents options with keyboard hints, similar to Emacs org-mode:
Type the letter keys shown in square brackets to select an option
For example, type `h h' for HTML export or `l p' for PDF export
✅ Export Formats
✅ HTML Export
HTML export generates semantic HTML5 documents with modern styling.
✅ Features
Semantic HTML5 structure (<section>, <header>, <nav>)
Syntax highlighting via highlight.js
MathJax support for mathematical equations
Responsive design with mobile-friendly layout
Table of contents generation
Footnote support
Custom CSS and JavaScript support
✅ MathJax Integration
HTML exports automatically include MathJax for rendering mathematical content:
| Syntax | Renders as |
|---|---|
$x^2 + y^2 = r^2$ | \(x^2 + y^2 = r^2\) |
$$E = mc^2$$ | \[E = mc^2\] |
\(inline\) | \(inline\) |
\[display\] | \[display\] |
LaTeX environments also work directly.
Inline math: \(\int_0^1 x dx\)
Display math:
\[\int0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}\]
✅ Example
This document demonstrates HTML export with math: \(E = mc^2\)
Export with `C-c C-e h h' to produce a standalone HTML file.
✅ LaTeX Export
LaTeX export converts org documents to LaTeX source suitable for academic papers, reports, and books.
✅ Document Classes
The default document class is article. You can specify alternatives:
#+LATEX_CLASS: report
#+LATEX_CLASS_OPTIONS: [11pt,a4paper,twoside]
Supported classes: article, report, book, beamer (for presentations)
⚠️ Custom Exporters by LaTeX Class
Document classes that need a template (letters, memos, theses) are handled by custom exporters. Map the class to an exporter id once, and the standard LaTeX/PDF exports use it automatically:
{
"scimax.export.latexClassExporters": {
"cmu-memo": "cmu-memo"
}
}
Then a file that begins with
,#+LATEX_CLASS: cmu-memo
,#+TO: Selection Committee
,#+FROM: John Kitchin
,#+SUBJECT: Recommendation
exports through the cmu-memo template on C-c C-e l o - no special command
to remember. Class names match case-insensitively, and the mapped exporter id
does not have to match the class name.
Per-document control:
| Keyword | Effect |
|---|---|
#+EXPORTER: cmu-memo | Use this exporter regardless of #+LATEX_CLASS |
#+EXPORTER: none | Force the built-in LaTeX backend for this file |
Routing applies to l l (writes the rendered .tex), l p (compiles the PDF)
and l o (compiles and opens it), plus scimax export --format latex|pdf on
the command line. Body-only exports are never routed. If the mapped exporter is
not installed you get a warning and the built-in export runs instead.
✅ Custom Preambles
Add custom LaTeX packages and settings in the preamble:
#+LATEX_HEADER: \usepackage{geometry}
#+LATEX_HEADER: \geometry{margin=1in}
#+LATEX_HEADER: \usepackage{tcolorbox}
✅ Global Custom Header
Configure a complete custom LaTeX preamble in VS Code settings:
Open Settings (`C-,')
Search for `scimax.export.latex.customHeader'
Enter your complete preamble (from \documentclass through packages)
Example:
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}
\usepackage[colorlinks=true]{hyperref}
Code Listings
LaTeX export supports two code highlighting backends:
listings Package (default)
#+BEGIN_SRC python
def fibonacci(n):
return n if n < 2 else fibonacci(n-1) + fibonacci(n-2)
Exports to:
\begin{lstlisting}[language=Python]
def fibonacci(n):
return n if n < 2 else fibonacci(n-1) + fibonacci(n-2)
\end{lstlisting}
minted Package (for advanced highlighting)
Enable in export options (requires Pygments):
#+LATEX_COMPILER: pdflatex -shell-escape
Tables with booktabs
Tables are exported using the booktabs package for professional appearance:
#+CAPTION: Experimental Results
#+NAME: tab:results
| Method | Accuracy | Time (s) |
|--------+----------+----------|
| A | 0.95 | 12.3 |
| B | 0.97 | 15.6 |
Exports to:
\begin{table}[htbp]
\centering
\begin{tabular}{lrr}
\toprule
Method & Accuracy & Time (s) \\
\midrule
A & 0.95 & 12.3 \\
B & 0.97 & 15.6 \\
\bottomrule
\end{tabular}
\caption{Experimental Results}
\label{tab:results}
\end{table}
Wide tables fit the margins automatically
Plain tabular columns (l, c, r) do not wrap or shrink, so a table with
long cell content would otherwise run past the right page margin. By default the
LaTeX exporter wraps each plain table in an adjustbox with max width\textwidth=,
which scales over-wide tables down to fit the text width while leaving narrower
tables at their natural size:
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{lll}
...
\end{tabular}
\end{adjustbox}
This adds \usepackage{adjustbox} to the preamble. Tables that set their own
width via #+ATTR_LATEX: :environment tabularx :width \textwidth (or longtable)
are left alone, since they already control their width. The behavior is controlled
by the fitTablesToTextWidth export option (default true); set it to false to
emit a bare tabular. If a scaled table's text becomes too small, prefer a
tabularx table with wrapping X columns, which keeps the font size and wraps
long cells instead.
⚠️ Long inline code wraps at separators
Inline verbatim (=code=), Emacs command markup (`command'), and inline source
(src_python{...}) export to \texttt{}, which does not hyphenate. A long dotted
identifier such as =difflow.flowsheet.Flowsheet.solve()= would otherwise be one
unbreakable box that overflows the right margin (an Overfull \hbox). The
exporter inserts \allowbreak after identifier separators (. / : - _) so
these wrap naturally across lines. Word-internal characters are not broken, so a
single very long token with no separators can still overrun; add a natural
separator or use a display source block for such cases.
⚠️ Literal dollar signs in prose
A $ in text starts inline LaTeX math mode on PDF/LaTeX export. A single stray
$, or a pair around currency ($50,000 ... $273,000), is silently typeset as
math, dropping the $ signs and running the words together in italics.
Important: the usual escape \$ does *not* work in this org→LaTeX pipeline.
Org turns the leading backslash into \textbackslash{}, so \$50,000 exports as
\textbackslash{}\$50,000 (a visible stray backslash), and in Emacs org it can
even fail to compile with ! Missing $ inserted.
Forms that do work:
Reword to drop the sign:
50,000 USDorUSD 50,000.Inline verbatim: =
$50,000= exports as\texttt{\$50,000}(monospace, but correct).Raw LaTeX snippet for the sign only:
@@latex:\$@@50,000emits a literal\$just in the LaTeX backend.
The literal-dollar lint flags likely offenders: comma-grouped currency amounts
($50,000) and any line with an odd number of unescaped $ (which opens math
mode). Dollar signs inside verbatim/code spans and source blocks are ignored.
Cross-References
Use #+NAME: for labeled elements and link to them:
#+NAME: fig:diagram
[[file:diagram.png]]
See Figure [[fig:diagram]] for the system architecture.
✅ PDF Export
PDF export works by first generating LaTeX and then compiling with a LaTeX engine.
✅ Compilation Process
The system uses latexmk for smart incremental builds:
Org → LaTeX conversion
`latexmk' compilation (handles multiple passes automatically)
Bibliography processing if needed
PDF generation
✅ Supported Compilers
Configure the LaTeX compiler in VS Code settings (scimax.latexLivePreview.compiler):
`pdflatex' (default) - Standard LaTeX compiler
`xelatex' - For Unicode and system fonts
`lualatex' - For advanced features and LuaTeX
✅ Requirements
PDF export requires:
LaTeX distribution (TeX Live, MiKTeX, or MacTeX)
`latexmk' utility (included with most distributions)
⚠️ Build Profiles
A single compiler setting cannot express every build. One paper needs
pdflatex + bibtex, the next needs lualatex + biber, a third needs an extra
makeglossaries pass. A build profile is a named sequence of commands that
replaces the built-in compile logic for a document.
Profiles come from four places, lowest precedence first:
| Source | Where |
|---|---|
| Built-in | always available (see below) |
| Settings | scimax.export.pdf.profiles |
| Global file | {scimax.directory}/latex-profiles.json |
| Project files | latex-profiles.json near the document |
Project files are found by walking up from the document's directory to the
workspace root, checking .scimax/latex-profiles.json then
latex-profiles.json at each level. A nearer definition wins, so a profile in
a manuscript folder overrides the same name defined at the repository root.
⚠️ Built-in profiles
| Name | Sequence |
|---|---|
pdflatex-bibtex | pdflatex → bibtex → pdflatex → pdflatex |
lualatex-biber | lualatex → biber → lualatex → lualatex |
xelatex-biber | xelatex → biber → xelatex → xelatex |
latexmk-pdflatex | latexmk -pdf -bibtex (handles reruns itself) |
latexmk-lualatex | latexmk -lualatex -bibtex (handles reruns itself) |
pdflatex-fast | one pdflatex pass (drafts; no bibliography, stale refs) |
The bibliography step in each is guarded, so a document with no citations skips it instead of failing.
⚠️ Choosing a profile
Per file, in the org document:
,#+LATEX_BUILD: lualatex-biber
In a .tex file, use a magic comment in the spirit of % !TEX program:
% !SCIMAX build = lualatex-biber
Or run Scimax LaTeX: Select Build Profile (scimax.latex.selectBuildProfile),
which lists every visible profile and writes the #+LATEX_BUILD: line for you.
When a document names no profile, the default from the nearest
latex-profiles.json applies, then the scimax.export.pdf.profile setting.
#+LATEX_BUILD: none opts out entirely and restores the plain
scimax.export.pdf.compiler path.
⚠️ The profiles file
Run Scimax LaTeX: Create Build Profiles File
(scimax.latex.createBuildProfilesFile) to drop a commented example next to
your document, or write one by hand:
{
"default": "pdflatex-bibtex",
"profiles": {
"thesis": {
"description": "lualatex with biber and a glossary",
"steps": [
{ "command": "lualatex", "args": ["-interaction=nonstopmode", "%f"] },
{ "command": "biber", "args": ["%b"], "whenFileExists": "%b.bcf" },
{ "command": "makeglossaries", "args": ["%b"], "whenFileExists": "%b.glo" },
{ "command": "lualatex", "args": ["-interaction=nonstopmode", "%f"] },
{ "command": "lualatex", "args": ["-interaction=nonstopmode", "%f"] }
]
}
}
}
⚠️ File name tokens
Steps rarely want the same form of the file name. bibtex and biber take the
base name with no extension; the engines take the file name; -output-directory
takes a directory. Every string in args, cwd, and the guard file names is
expanded with these tokens (for /papers/2026/thesis.tex):
| Token | Expands to | Example |
|---|---|---|
%f | file name with extension | thesis.tex |
%b | base name, no extension | thesis |
%p | absolute path to the .tex file | /papers/2026/thesis.tex |
%d | directory holding the .tex file | /papers/2026 |
%o | output directory | /papers/2026 |
%P | the PDF that will be produced | /papers/2026/thesis.pdf |
%% | a literal % | % |
%b is the one bibliography processors need: bibtex thesis, not
bibtex thesis.tex. Unknown tokens are left alone, so a stray % is harmless.
⚠️ Step options
| Key | Meaning |
|---|---|
command | executable to run (required) |
args | argument array; tokens expanded, never shell-parsed |
label | name shown in progress messages |
cwd | working directory (defaults to the .tex file's directory) |
env | extra environment variables for this step |
timeoutMs | per-step timeout (default 180000) |
continueOnError | set false to abort the build when this step fails |
whenFileExists | run only if this file exists, e.g. "%b.bcf" |
whenFileMatches | run only if a file contains a string/regex |
A step written as a bare string is shorthand for { "command": "..." }.
By default a failing step does not stop the build - LaTeX exits non-zero on
warnings routinely - and the export is judged by whether a PDF appeared. Set
continueOnError: false on steps where failure really is fatal.
Guards keep conditional passes out of the way:
{ "command": "bibtex", "args": ["%b"],
"whenFileMatches": { "file": "%b.aux", "pattern": "\\\\citation", "regex": true } }
⚠️ Security
Profiles name executables to run, so project-local latex-profiles.json files
are only honored in a trusted workspace. Built-in and settings-defined
profiles are always available. Steps are spawned directly with no shell, so
arguments are never re-parsed - a ; or $(...) inside an argument is passed
through as text.
⚠️ Compiling .tex files
Profiles are not limited to org export. scimax.latex.compile (C-c C-c in a
.tex file) uses the profile named by the % !SCIMAX build magic comment,
falling back to scimax.latex.compiler when no profile applies. That covers compile and view
(C-c C-a) and the built-in PDF panel as well, since both compile through the
same command. See
Build Profiles for TeX Files.
⚠️ CLI
The scimax export --format pdf CLI honors the same profiles, resolved from
the same files relative to the input document.
⚠️ Commands
| Command | Description |
|---|---|
scimax.latex.selectBuildProfile | Pick a profile and set #+LATEX_BUILD: |
scimax.latex.showBuildProfile | Show which profile a document uses |
scimax.latex.createBuildProfilesFile | Write an example profiles file |
👀 SVG Images
LaTeX engines (pdflatex/lualatex/xelatex) cannot embed .svg files directly,
so a figure like [[file:diagram.svg]] would otherwise abort the build with
"Unknown graphics extension: .svg".
Scimax handles this automatically: during PDF export each referenced SVG is
converted to PDF next to the original (diagram.svg → diagram.svg.pdf) and the
\includegraphics path is rewritten to the converted file. No -shell-escape is
required. The first available converter is used, tried in this order:
rsvg-convert(from librsvg -- fastest, recommended)cairosvg(a Python package)inkscape(version 1.x)
Install at least one to get SVG support (e.g. brew install librsvg for
rsvg-convert). If none is installed, or a specific SVG cannot be converted, the
export prints a warning naming the file and continues; the .svg include is left
untouched (so LaTeX will still error on that figure). The generated
diagram.svg.pdf is a derived build artifact and is safe to delete.
HTML export renders SVG natively and needs no conversion.
👀 Error Handling
If PDF compilation fails:
The extension offers to open the `.log' file
Review the log for LaTeX errors
Common issues:
Missing packages → Install via your TeX distribution
Syntax errors → Check LaTeX syntax in export
Image paths → Ensure images exist and paths are correct
👀 CLI failure reporting
When scimax export --format pdf fails, it does not fail silently:
The first LaTeX error (message plus the
.texline it points at) is printed, e.g.LaTeX error: Unknown graphics extension: .svg. (report.tex:95), along with the path to the full.log. Add--show-log(aliases--verbose,-v) to also print the tail of the log.The incomplete PDF is removed on failure. A fatal LaTeX error can still leave behind a
report.pdfthat looks complete but is broken (a classic case: LaTeX aborts before BibTeX runs, so every citation is unresolved). Removing it means a failed build can't be mistaken for a good export. Any pre-existing--outputtarget is left untouched, since a failed run never writes to it.With
--json, the failure object includeslatex_error,tex_line,log_file, andremoved_partial_pdf.
⚠️ The generated .tex is disposable
The org file is the source of truth; the report.tex produced during PDF export
is a disposable build artifact. Every scimax export --format pdf run
regenerates report.tex from report.org, overwriting any manual edits to the
.tex. (The converted *.svg.pdf files from SVG figures are disposable in the
same way.)
Practical consequences:
Do not hand-edit
report.texexpecting the change to survive. Fix the problem in the.orgsource and re-export. With in-pipeline SVG→PDF conversion (see SVG Images above) and clear failure reporting (see Error Handling above), the two common reasons to reach for a.texpatch are already handled inside the export.Some LaTeX setups also define a
latexmkcustom dependency that rebuilds.texfrom.org; where that exists, runninglatexmkon the.texregenerates it too, so a.tex-level patch is doubly futile.If you truly need a one-off from an edited
.tex(e.g. to test a fix for an export bug), compile it directly with the LaTeX engine and do *not* re-runscimax export(which would regenerate it): #+BEGIN_SRC bash lualatex -interaction=nonstopmode report.tex bibtex report lualatex -interaction=nonstopmode report.tex lualatex -interaction=nonstopmode report.tex #+END_SRC
Build on Save
Enable automatic PDF building in settings:
{
"scimax.latexLivePreview.buildOnSave": true,
"scimax.latexLivePreview.compiler": "pdflatex"
}
✅ PDF Viewer Panel with Bidirectional Sync
For an Overleaf-like editing experience, use the built-in PDF viewer panel:
Command: scimax.org.viewPdfPanel - "Scimax Org: View PDF in Panel (with sync)"
This exports your org file to PDF and opens it in a VS Code panel with full bidirectional synchronization support.
Forward Sync (Org → PDF)
Double-click a word in your org source to jump to that location in the PDF. The word is highlighted with a yellow flash for easy identification.
Command: scimax.org.jumpToPdf - "Scimax Org: Jump to PDF (forward sync)"
The forward sync:
Maps your org line to the generated LaTeX line
Uses SyncTeX to find the PDF position
Searches the PDF text layer to find the exact word
Highlights the word with a flash animation
Inverse Sync (PDF → Org)
Double-click a word in the PDF viewer to jump back to the corresponding line in your org source file.
The inverse sync:
Gets PDF coordinates from your click
Uses SyncTeX to find the LaTeX line
Maps the LaTeX line back to your org source line
Opens the org file and highlights the text
How It Works
The system maintains a mapping between org source lines and generated LaTeX lines. When you export to PDF, this mapping is stored so that both forward and inverse sync can translate between org positions and PDF positions.
Note: The sync is approximate due to the org → LaTeX transformation. It works best with paragraph-level precision.
✅ Markdown Export
Markdown export produces GitHub-flavored Markdown (GFM) suitable for GitHub, GitLab, and other platforms.
✅ Features
Headings (`# ## ###')
Emphasis (*bold*, _italic_, `~strikethrough~')
Lists (ordered and unordered)
Code blocks with syntax highlighting
Tables (GFM format)
Links and images
Blockquotes
✅ Example Conversion
Org input:
,* Project Overview
This is a *bold* statement and an /italic/ one.
,** Features
- Fast rendering
- Simple syntax
- Wide support
,#+BEGIN_SRC python
print("Hello, world!")
,#+END_SRC
Markdown output:
# Project Overview
This is **bold** statement and an *italic* one.
## Features
- Fast rendering
- Simple syntax
- Wide support
```python
print("Hello, world!")
```
✅ Jupyter Notebook Export
Export org-mode documents to Jupyter Notebook format (.ipynb), compatible with Jupyter Lab, Jupyter Notebook, VS Code notebook viewer, and ox-ipynb from Emacs.
Features
Full nbformat v4 notebook structure
Automatic kernel detection from document content
Source blocks become code cells (when language matches kernel)
Headlines, paragraphs, lists, tables become markdown cells
Participant mode for teaching materials (strips solutions)
ox-ipynb compatibility (keywords, slideshow metadata)
Base64 image embedding for self-contained notebooks
Basic Usage
Export the current org file to Jupyter Notebook:
| Keybinding | Command | Description |
|---|---|---|
| C-c C-e j j | scimax.org.exportIpynb | Export to .ipynb file |
| C-c C-e j o | scimax.org.exportIpynbOpen | Export and open in notebook viewer |
| C-c C-e j p | scimax.org.exportIpynbParticipant | Export with solutions stripped |
Kernel Detection
The kernel is determined in this order:
#+OX_IPYNB_KERNEL_NAME:keyword in the documentMost common source block language in the document
Default: python3
,#+OX_IPYNB_KERNEL_NAME: julia-1.9
,#+TITLE: Julia Tutorial
Content here will use the Julia kernel.
Cell Conversion
| Org Element | Jupyter Cell Type | Notes |
|---|---|---|
| Headlines | Markdown | #, ##, ### syntax |
| Paragraphs | Markdown | Inline markup converted |
| Lists | Markdown | Ordered, unordered, checkboxes |
| Tables | Markdown | Pipe-delimited format |
| Source blocks (kernel lang) | Code | With outputs if results exist |
| Source blocks (other) | Markdown | As code fences |
| LaTeX fragments | Markdown | $...$ or $$...$$ |
Participant Mode (for Teaching)
Create student versions of notebooks with solutions stripped:
,#+BEGIN_SRC python
# Setup code (kept)
x = 1
### BEGIN SOLUTION
# This solution is removed in participant mode
y = x + 1
### END SOLUTION
# More code (kept)
,#+END_SRC
Content between ### BEGIN SOLUTION / ### END SOLUTION markers is removed.
Also supports ### BEGIN HIDDEN / ### END HIDDEN markers.
Headlines with the :remove: tag are also excluded in participant mode.
Settings
Configure notebook export behavior in VS Code settings:
| Setting | Default | Description |
|---|---|---|
scimax.export.ipynb.defaultKernel | "python3" | Default Jupyter kernel name |
scimax.export.ipynb.embedImages | true | Base64 encode images in outputs |
scimax.export.ipynb.includeResults | true | Include #+RESULTS as cell outputs |
ox-ipynb Compatibility
The following ox-ipynb keywords are supported:
,#+OX_IPYNB_KERNEL_NAME: python3
,#+OX_IPYNB_LANGUAGE: python
,#+OX_IPYNB_NOTEBOOK_METADATA: {"custom_key": "value"}
✅ DOCX Export
DOCX export generates Microsoft Word (.docx) documents using Pandoc for high-quality conversion with proper equation rendering and bibliography support.
Requirements
Pandoc must be installed for DOCX export. Install from https://pandoc.org/installing.html
Features
High-quality conversion via Pandoc
LaTeX equations render as native Word equations
Bibliography support via pandoc-citeproc
Full export options support (
p:nil,todo:nil,tags:nil, etc.)Citation formats: org-ref (
cite:key) and org-cite ([cite:@key])Embedded images from file links
Tables with proper formatting
Nested lists (ordered, unordered, description)
Special blocks (quote, example, verse)
Basic Usage
Export the current org file to Word:
| Keybinding | Command | Description |
|---|---|---|
| C-c C-e d d | scimax.org.exportDocx | Export to .docx file |
| C-c C-e d o | scimax.org.exportDocxOpen | Export and open in Word |
Code Blocks
Source blocks are exported as formatted code:
,#+BEGIN_SRC python
def fibonacci(n):
if n < 2:
return n
return fibonacci(n-1) + fibonacci(n-2)
,#+END_SRC
Code blocks appear in Word with monospace formatting. Pandoc handles the conversion.
Images
Images from file links are embedded directly into the Word document:
[[file:diagram.png]]
Images are automatically scaled to fit within the page margins. Control image width with attributes:
#+ATTR_HTML: :width 400
[[file:large-diagram.png]]
Tables
Org tables are converted to Word tables with:
Header row with bold text and shaded background
Proper cell borders
Caption support from
#+CAPTION:
#+CAPTION: Experimental Results
| Method | Accuracy | Time (s) |
|--------+----------+----------|
| A | 0.95 | 12.3 |
| B | 0.97 | 15.6 |
Citations and Bibliography
DOCX export uses Pandoc's citeproc for full bibliography support. Both org-ref and org-cite citation formats are supported:
* My Document
Recent work cite:smith2023 demonstrates...
According to citet:jones2024, the approach...
You can also use org-cite: [cite:@smith2023] or [cite/t:@jones2024].
* References
bibliography:~/references.bib
The = line specifies your BibTeX file. Citations are automatically resolved and a formatted bibliography is generated at the end of the document.
Note: Add a * References heading where you want the bibliography to appear.
Word Styles
The exported document uses standard Word styles:
Heading 1throughHeading 6for headlinesNormalfor paragraph textCodefor inline codeQuotefor quote blocksCaptionfor figure and table captions
These styles can be customized in Word after export to change the document appearance.
Special Blocks
Special blocks export with appropriate styling:
,#+BEGIN_QUOTE
This is a block quote with left indent and italic styling.
,#+END_QUOTE
,#+BEGIN_note
Important information highlighted in a styled box.
,#+END_note
,#+BEGIN_warning
Critical warning with distinct visual treatment.
,#+END_warning
LaTeX Equations
LaTeX equations are converted to native Word equation format:
Inline math: $E = mc^2$
Display math:
\begin{equation}
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
\end{equation}
Both inline ($...$) and display (\begin{equation}...) formats are supported.
Limitations
Table of contents may require manual update in Word (Insert → Update Field)
Complex nested tables may need adjustment
Internal links work within the document but external file links are text-only
✅ Clipboard Export (ox-clip)
Clipboard export (inspired by ox-clip) copies formatted org content to the clipboard, enabling pasting into email clients, Word, Google Docs, and other applications that accept rich text.
Features
Rich HTML clipboard: Copy HTML as formatted text that pastes with styling
Source clipboard: Copy HTML, LaTeX, or Markdown source code
Scope selection: Export full document, current subtree, or selection
Platform support: macOS, Linux (X11/Wayland), Windows
Quick Usage
| Keybinding | Command | Description |
|---|---|---|
| C-c k | scimax.org.clipboardHtmlRich | Copy subtree as rich HTML |
| C-c C-e k | Clipboard menu | Open clipboard export submenu |
Export Scope
The export scope determines which content is copied:
| Scope | Description |
|---|---|
full | Entire document |
subtree | Current headline and all children (default) |
selection | Selected text only |
Configure the default scope in settings:
{
"scimax.export.clipboard.defaultScope": "subtree"
}
Rich Text Clipboard (Platform-Specific)
Rich HTML clipboard uses platform-specific tools to copy formatted text that pastes with styling preserved:
| Platform | Tool | Notes |
|---|---|---|
| macOS | textutil + pbcopy | Converts HTML to RTF, built-in |
| Linux | xclip or wl-copy | X11: sudo apt install xclip; Wayland: wl-copy |
| Windows | PowerShell | Uses System.Windows.Forms.Clipboard |
If rich clipboard tools aren't available, falls back to plain text clipboard with a warning.
Configuration
{
// Use rich text clipboard when platform tools available (default: true)
"scimax.export.clipboard.preferRichText": true,
// Default scope: "full", "subtree", or "selection" (default: "subtree")
"scimax.export.clipboard.defaultScope": "subtree"
}
Use Cases
Sharing in Email
Position cursor on a headline
Press
C-c kto copy as rich HTMLPaste into email - formatting, code blocks, and links are preserved
Copying to Word/Google Docs
Select the content or position on headline
C-c C-e k hto copy as rich HTMLPaste into document - tables, lists, and emphasis are formatted
Sharing Source Code
Position on headline containing code explanation
C-c C-e k mto copy as MarkdownPaste into GitHub issue or PR description
LaTeX Snippets
Select a portion with equations
C-c C-e k lto copy as LaTeXPaste into LaTeX editor
Export Keybindings
Primary Keybindings
| Keybinding | Command | Description |
|---|---|---|
| C-c C-e | Export dispatcher | Open export menu |
| C-c C-e h h | HTML export | Export to HTML file |
| C-c C-e h o | HTML export and open | Export HTML and open in browser |
| C-c C-e l l | LaTeX export | Export to .tex file |
| C-c C-e l p | PDF export | Export to PDF via LaTeX |
| C-c C-e l o | PDF export and open | Export PDF and open viewer |
| C-c C-e m m | Markdown export | Export to .md file |
| C-c C-e d d | DOCX export | Export to .docx file |
| C-c C-e d o | DOCX export and open | Export and open in Word |
| C-c k | Clipboard HTML rich | Copy subtree as rich HTML |
| C-c C-e k h | Clipboard HTML rich | Copy as rich HTML (menu) |
| C-c C-e k H | Clipboard HTML src | Copy HTML source |
| C-c C-e k l | Clipboard LaTeX | Copy LaTeX source |
| C-c C-e k m | Clipboard Markdown | Copy Markdown source |
Additional LaTeX Keybindings
| Keybinding | Command | Description |
|---|---|---|
| C-c C-e l v | Open LaTeX preview | Open PDF preview (if built) |
| C-c C-e l s | Forward sync | Sync cursor position to PDF (SyncTeX) |
Quick Access
For frequently used exports, use the quick commands:
Export Scope
The export system supports three scope modes:
Full Document Export (default)
Exports the entire org file from beginning to end.
Usage: Select "Full document" when prompted for export scope.
Subtree Export
Exports only the current headline and its children.
Usage:
Place cursor on or within a headline
Invoke export dispatcher (`C-c C-e')
Select "Current subtree" as scope
Example:
,* Introduction
Some intro text.
,* Methods ← Cursor here
,** Data Collection
,** Analysis
,* Results
Exporting with subtree scope from "Methods" exports:
Methods heading
Data Collection subsection
Analysis subsection
(Results is NOT included)
Use Cases for Subtree Export
Export a single chapter from a book
Generate standalone reports from sections
Create focused documentation for specific topics
Share individual project components
Visible Content Export
Exports only content that is currently visible (not folded).
Usage:
Fold sections you want to exclude (`Tab' on headings)
Invoke export (`C-c C-e')
Select "Visible content" as scope
This is useful for:
Creating executive summaries (hide details)
Generating public versions (hide private notes)
Focusing on high-level structure
HTML Export Options
Standalone vs. Body-Only
Standalone (default)
Generates complete HTML document:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>My Document</title>
<!-- CSS and JavaScript -->
</head>
<body>
<main>
<!-- Content -->
</main>
</body>
</html>
Custom CSS
Add custom styles via export options:
#+HTML_HEAD: <style>
#+HTML_HEAD: .org-content { max-width: 900px; }
#+HTML_HEAD: h1 { color: #2c3e50; }
#+HTML_HEAD: </style>
Or link external CSS:
#+HTML_HEAD: <link rel="stylesheet" href="custom.css" />
JavaScript Support
Include custom JavaScript:
#+HTML_HEAD: <script src="https://cdn.example.com/lib.js"></script>
#+HTML_HEAD: <script>
#+HTML_HEAD: // Custom initialization
#+HTML_HEAD: </script>
MathJax Configuration
HTML exports use MathJax 3 by default. The CDN URL is:
https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
MathJax automatically renders:
Inline math: \(...\) or $...$
Display math: \[...\] or $$...$$
LaTeX environments: \begin{equation}...\end{equation}
Syntax Highlighting
Code blocks use highlight.js for syntax highlighting:
#+BEGIN_SRC python
def greet(name):
print(f"Hello, {name}!")
Supported languages: Python, JavaScript, Java, C, C++, Rust, Go, Ruby, Shell, SQL, and many more.
LaTeX Export Options
Document Structure
Headline Levels
Control which headline levels become sections:
#+OPTIONS: H:4
H:1 → Only top-level headlines become sections
H:2 → Two levels (section, subsection)
H:3 → Three levels (section, subsection, subsubsection)
H:4 → Four levels (adds paragraph)
Section Numbering
Control section numbering:
#+OPTIONS: num:t % Number all sections
#+OPTIONS: num:nil % No numbering
#+OPTIONS: num:3 % Number up to level 3
In LaTeX output, this sets:
\setcounter{secnumdepth}{3}
Table of Contents
#+OPTIONS: toc:t % Include TOC
#+OPTIONS: toc:nil % No TOC
#+OPTIONS: toc:2 % TOC with 2 levels
Generates:
\tableofcontents
\newpage
Images and Figures
Include images with captions and labels:
#+CAPTION: System Architecture Diagram
#+NAME: fig:architecture
#+ATTR_LATEX: :width 0.8\textwidth :placement [htbp]
[[file:architecture.png]]
Exports to:
\begin{figure}[htbp]
\centering
\includegraphics[width=0.8\textwidth]{architecture.png}
\caption{System Architecture Diagram}
\label{fig:architecture}
\end{figure}
Image Attributes
:width - Image width (e.g., 0.8\textwidth, 12cm)
:height - Image height
:placement - Float placement ([htbp])
:scale - Scale factor (0.5 for 50%)
Bibliography Support
BibTeX Integration
Include bibliography:
#+LATEX_HEADER: \usepackage{natbib}
Reference a citation cite:knuth1984.
bibliography:~/references.bib
bibliographystyle:plainnat
Citation Links
Org-ref style citations work directly:
cite:key → \cite{key}
citep:key → \citep{key} (parenthetical)
citet:key → \citet{key} (textual)
citeauthor:key → \citeauthor{key}
citeyear:key → \citeyear{key}
Org-cite Citations [cite/STYLE/VARIANTS:@key]
Org-cite citations are translated to LaTeX through a configurable backend. The
default backend, bibtex, emits natbib commands; the biblatex backend
emits the corresponding biblatex commands.
Choose a backend with the setting scimax.export.latex.citeBackend (values
bibtex or biblatex) or per-document with:
#+cite_export: bibtex
,#+cite_export: biblatex
Both the short and long org-cite spellings are accepted (t = text,
a = author, na = noauthor, n = nocite, y = year). Variants are
b (bare), c (caps), f (full); they may be combined as bc, cf, bcf
or as hyphenated long names like bare-caps.
Style → command mapping (bibtex backend, default)
| Org-cite | LaTeX command |
|---|---|
[cite:@k] | \citep{k} |
[cite//c:@k] | \Citep{k} |
[cite//b:@k] | \citealp{k} |
[cite//bc:@k] | \Citealp{k} |
[cite/t:@k] | \citet{k} |
[cite/t/c:@k] | \Citet{k} |
[cite/t/b:@k] | \citealt{k} |
[cite/t/bc:@k] | \Citealt{k} |
[cite/a:@k] | \citeauthor{k} |
[cite/a/c:@k] | \Citeauthor{k} |
[cite/a/f:@k] | \citeauthor*{k} |
[cite/na:@k] | \citeyearpar{k} |
[cite/y:@k] | \citeyearpar{k} |
[cite/y/b:@k] | \citeyear{k} |
[cite/n:@k] | \nocite{k} |
Style → command mapping (biblatex backend)
| Org-cite | LaTeX command |
|---|---|
[cite:@k] | \autocite{k} |
[cite//c:@k] | \Autocite{k} |
[cite//b:@k] | \cite{k} |
[cite/t:@k] | \textcite{k} |
[cite/t/c:@k] | \Textcite{k} |
[cite/a:@k] | \citeauthor{k} |
[cite/a/c:@k] | \Citeauthor{k} |
[cite/na:@k] | \autocite*{k} |
[cite/y:@k] | \citeyear{k} |
[cite/n:@k] | \nocite{k} |
[cite/b:@k] | \fullcite{k} |
[cite/ni:@k] | \notecite{k} |
Per-key prefix and suffix
For single-key citations the per-key prefix and suffix are emitted as
natbib's [pre][post]{key} bracketed arguments:
| Org-cite | LaTeX command |
|---|---|
[cite:@k p. 5] | \citep[p. 5]{k} |
[cite:see @k p. 5] | \citep[see][p. 5]{k} |
Multi-key citations always emit a single \citep{k1,k2,...} form (per-key
notes have no clean LaTeX analogue).
HTML Citation Export
HTML export includes full citation processing using citation-js, which formats citations according to standard citation styles (CSL).
Supported Citation Formats
The following citation link types are supported in HTML export:
| Link Type | Example | Output Style |
|---|---|---|
cite: | cite:knuth1984 | Parenthetical (Smith, 2020) |
citep: | citep:knuth1984 | Parenthetical (Smith, 2020) |
citet: | citet:knuth1984 | Textual: Smith (2020) |
citeauthor: | citeauthor:knuth1984 | Author only: Smith |
citeyear: | citeyear:knuth1984 | Year only: 2020 |
[cite:@key] | [cite:@knuth1984] | Org 9.5+ style |
Specifying Bibliography Files
To include citations in HTML export, specify your bibliography file(s):
#+BIBLIOGRAPHY: references.bib
Or use a bibliography link:
[[bibliography:~/path/to/references.bib]]
The export system automatically:
Finds all
#+BIBLIOGRAPHY:keywords and[[bibliography:...]]linksLoads the BibTeX entries from those files
Formats citations according to the selected style
Generates a bibliography section at the end of the document
Citation Styles
The default citation style is APA. You can change it with the #+CSL_STYLE: keyword:
#+CSL_STYLE: apa
Available built-in styles:
| Style | Description |
|---|---|
apa | American Psychological Association (default) |
mla | Modern Language Association |
chicago | Chicago Manual of Style |
harvard | Harvard referencing |
ieee | IEEE citation format |
vancouver | Vancouver (numeric) style |
Example Document with Citations
#+TITLE: My Research Paper
#+AUTHOR: Jane Doe
#+BIBLIOGRAPHY: references.bib
#+CSL_STYLE: apa
,* Introduction
Recent advances in machine learning cite:lecun2015 have enabled
remarkable progress in computer vision. According to citet:krizhevsky2012,
deep convolutional networks outperform traditional methods.
,* Methods
We follow the approach of citep:he2016,simonyan2014 for our experiments.
Bibliography Output
The bibliography section is automatically generated at the end of the HTML document with:
A "References" heading (customizable)
Properly formatted entries according to the CSL style
Hanging indent formatting for readability
Missing Citations
If a citation key is not found in the bibliography:
The citation appears with a "missing" CSS class
It renders as
[missing: key]in red italic textCheck your
.bibfile for the correct key spelling
Configuring Citation Defaults
You can configure default citation behavior in VS Code settings:
{
"scimax.references.defaultCiteStyle": "citep"
}
Options: cite, citep, citet, citeauthor, citeyear
Advanced LaTeX Features
Custom Environments
Use #+BEGIN_LATEX blocks for raw LaTeX:
#+BEGIN_LATEX
\begin{theorem}[Pythagorean Theorem]
For a right triangle with legs $a$ and $b$ and hypotenuse $c$:
\[a^2 + b^2 = c^2\]
\end{theorem}
#+END_LATEX
Special Blocks
Special blocks map to LaTeX environments:
#+BEGIN_abstract
This paper presents a novel approach...
#+END_abstract
#+BEGIN_theorem
If $P$, then $Q$.
#+END_theorem
#+BEGIN_proof
Assume $P$. Then...
#+END_proof
Math Environments
LaTeX math environments work directly:
\begin{equation}
E = mc^2
\label{eq:einstein}
\end{equation}
\begin{align}
x &= a + b \\
y &= c + d
\end{align}
PDF Export Configuration
Compiler Selection
Set the LaTeX compiler in VS Code settings:
pdflatex (default)
Fast compilation
Wide compatibility
Standard LaTeX packages
ASCII and Latin-1 support
Configuration:
{
"scimax.latexLivePreview.compiler": "pdflatex"
}
xelatex
Unicode support (UTF-8)
System fonts (TrueType, OpenType)
Modern typography
Required for non-Latin scripts
Configuration:
{
"scimax.latexLivePreview.compiler": "xelatex"
}
Example with system fonts:
#+LATEX_HEADER: \usepackage{fontspec}
#+LATEX_HEADER: \setmainfont{Libertinus Serif}
#+LATEX_HEADER: \setmonofont{Fira Code}
lualatex
Unicode support
Lua scripting in LaTeX
Advanced typography
Memory-efficient for large documents
Configuration:
{
"scimax.latexLivePreview.compiler": "lualatex"
}
latexmk Configuration
The export system uses latexmk for reliable compilation:
Benefits
Automatic multiple passes (for TOC, references, etc.)
Bibliography processing (BibTeX/Biber)
Dependency tracking
Incremental builds
Configuration File
Create .latexmkrc in your project directory:
# Use pdflatex
$pdf_mode = 1;
# Clean auxiliary files
$clean_ext = "synctex.gz synctex.gz(busy) run.xml";
# Custom compiler options
$pdflatex = 'pdflatex -interaction=nonstopmode -shell-escape %O %S';
Disabling latexmk
If you prefer direct compiler invocation:
{
"scimax.latexLivePreview.useLatexmk": false
}
Build Automation
Build on Save
Automatically rebuild PDF when saving:
{
"scimax.latexLivePreview.buildOnSave": true
}
Build on Idle
Build after idle period (useful for live preview):
{
"scimax.latexLivePreview.buildOnIdle": true,
"scimax.latexLivePreview.idleDelay": 2000
}
SyncTeX Integration
SyncTeX enables bidirectional sync between source and PDF:
Forward Sync (Source → PDF)
Place cursor in org file
Press `C-c C-e l s'
PDF viewer jumps to corresponding location
Reverse Sync (PDF → Source)
C-click in PDF viewer (if supported) to jump to source line.
Markdown Export Details
GitHub-Flavored Markdown (GFM)
The Markdown export follows GitHub's flavor for maximum compatibility.
Supported Elements
Headings
,* Level 1 → # Level 1
,** Level 2 → ## Level 2
,*** Level 3 → ### Level 3
Text Formatting
*bold* → **bold**
/italic/ → *italic*
_underline_ → _underline_
+strikethrough+ → ~~strikethrough~~
=code= → `code`
~verbatim~ → `verbatim`
Lists
Unordered:
- Item 1
- Item 2
- Nested
Ordered:
1. First
2. Second
3. Third
Code Blocks
#+BEGIN_SRC python
def hello():
print("Hello")
Exports to:
```python
def hello():
print("Hello")
```
Tables
| Name | Age | City |
|-------+-----+------------|
| Alice | 30 | New York |
| Bob | 25 | London |
Exports to:
| Name | Age | City |
| --- | --- | --- |
| Alice | 30 | New York |
| Bob | 25 | London |
Links
[[https://example.com][Example Site]] → [Example Site](https://example.com)
[[file:image.png]] → [image.png](image.png)
Images
[[file:diagram.png]] → 
Metadata Handling
Document metadata is converted:
#+TITLE: My Document
#+AUTHOR: Jane Doe
#+DATE: 2024-01-15
Becomes:
# My Document
*Jane Doe*
2024-01-15
Export Options Reference
#+OPTIONS Keyword
The #+OPTIONS keyword controls various export behaviors:
Syntax
#+OPTIONS: key1:value1 key2:value2 ...
Complete OPTIONS Reference
| Option | Values | Default | Description |
|---|---|---|---|
| toc | t, nil, N | nil | Table of contents (N depth) |
| num | t, nil, N | t | Section numbering (N depth) |
| H | N | 0 | Headline levels to export (0 all) |
| author | t, nil | t | Include author in output |
| date | t, nil | t | Include date in output |
| t, nil | nil | Include email in output | |
| tags | t, nil, not-in-toc | t | Include tags in headlines |
| todo | t, nil | t | Include TODO keywords in headlines |
| pri | t, nil | nil | Include priority cookies ([#A], etc.) |
| <, timestamp | t, nil | t | Include timestamps |
| creator | t, nil | nil | Include creator string in postamble |
| f | t, nil | t | Include footnotes |
| p | t, nil | nil | Include statistics cookies (, ) |
| c | t, nil | nil | Include CLOCK entries |
| d | t, nil, (list) | nil | Include drawers (or specific drawers) |
| prop | t, nil | t | Include PROPERTIES drawers |
| \vert{} | t, nil | t | Include tables |
| ^ | t, nil, {} | {} | Sub/superscripts (default: only ab/ab; t: also a_b/a^b) |
| : | t, nil | t | Include fixed-width sections |
| \n | t, nil | nil | Preserve line breaks |
Examples
Full configuration:
#+OPTIONS: toc:3 num:t H:4 author:t date:t tags:nil todo:nil
Minimal export (no metadata):
#+OPTIONS: toc:nil num:nil author:nil date:nil tags:nil todo:nil pri:nil
Academic paper:
#+OPTIONS: toc:t num:t H:3 ^:{} author:t date:t email:t
Include all drawers:
#+OPTIONS: d:t c:t p:t
Include only specific drawers:
#+OPTIONS: d:("LOGBOOK" "NOTES")
Hide tags from headlines but keep them in TOC:
#+OPTIONS: tags:not-in-toc
Subscripts and Superscripts
The ^ option controls how _ and ^ are interpreted in body text:
| Value | Behavior |
|---|---|
{} | (default) Only braced forms render: a_{b} → subscript, a_b → literal |
t | Both forms render: a_{b} and a_b both produce a subscript |
nil | Never render as sub/superscripts; both forms stay literal |
The default was changed from t to {} because bare _ and ^ in
prose (filenames, identifiers, math expressions) are usually meant
literally. If you have an existing document that relied on bare-form
subscripts, add #+OPTIONS: ^:t to restore the old behavior.
# Default behavior (subscripts only render with braces)
H_{2}O is water. # → H<sub>2</sub>O is water
file_name.txt # → literal: file_name.txt
# Old behavior (any underscore is a subscript)
#+OPTIONS: ^:t
H_2O is water. # → H<sub>2</sub>O is water
file_name.txt # → file<sub>name</sub>.txt (probably unwanted)
Document Keywords
Required Keywords
#+TITLE: Document Title
#+AUTHOR: Your Name
#+DATE: 2024-01-15
#+EMAIL: you@example.com
#+LANGUAGE: en
Note: #+EMAIL is only included in output when email:t is set in OPTIONS.
HTML-Specific Keywords
#+HTML_HEAD: <style>body { font-family: sans-serif; }</style>
#+HTML_HEAD_EXTRA: <meta name="keywords" content="research, science" />
#+HTML_LINK_HOME: index.html
#+HTML_LINK_UP: ../index.html
LaTeX-Specific Keywords
#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [11pt,a4paper]
#+LATEX_HEADER: \usepackage{geometry}
#+LATEX_HEADER: \geometry{margin=1in}
#+LATEX_COMPILER: pdflatex
✅ Export Settings Keywords
EXPORT_FILE_NAME
Override the output file name:
#+EXPORT_FILE_NAME: custom-output-name
If set to
custom-output-name, exporting to HTML producescustom-output-name.htmlThe extension is automatically appended based on export format
If the keyword already includes the correct extension, it's used as-is
Paths are relative to the org file's directory
Example:
#+TITLE: My Report
#+EXPORT_FILE_NAME: final-report-v2
,* Content here...
Exporting to PDF produces final-report-v2.pdf instead of the default filename.
Configuration Settings
Export Settings Location
All export settings are in VS Code preferences:
`C-,' (`s-,' on Mac) to open Settings
Search for "scimax export" or "scimax latex"
Modify settings as needed
LaTeX Export Configuration
Custom Header
Setting: scimax.export.latex.customHeader
Type: String (multiline)
Description: Complete custom LaTeX preamble replacing auto-generated one.
Example:
{
"scimax.export.latex.customHeader": "\\documentclass[12pt]{article}\n\\usepackage[utf8]{inputenc}\n\\usepackage{graphicx}\n\\usepackage{amsmath}"
}
Or in settings.json:
{
"scimax.export.latex.customHeader": [
"\\documentclass[12pt]{article}",
"\\usepackage[utf8]{inputenc}",
"\\usepackage{graphicx}",
"\\usepackage{amsmath}",
"\\usepackage[colorlinks=true]{hyperref}"
]
}
LaTeX Preview Settings
Compiler
Setting: scimax.latexLivePreview.compiler
Values: "pdflatex", "xelatex", "lualatex"
Default: "pdflatex"
Example:
{
"scimax.latexLivePreview.compiler": "xelatex"
}
Use latexmk
Setting: scimax.latexLivePreview.useLatexmk
Type: Boolean
Default: true
Description: Use latexmk for smart incremental builds (recommended).
Build on Save
Setting: scimax.latexLivePreview.buildOnSave
Type: Boolean
Default: true
Description: Automatically rebuild PDF when org file is saved.
Build on Idle
Setting: scimax.latexLivePreview.buildOnIdle
Type: Boolean
Default: false
Description: Rebuild PDF after idle period (for live preview).
Idle Delay
Setting: scimax.latexLivePreview.idleDelay
Type: Number (milliseconds)
Default: 2000
Description: Delay before idle build triggers.
Complete Configuration Example
{
// LaTeX Export
"scimax.export.latex.customHeader": "",
// LaTeX Preview
"scimax.latexLivePreview.compiler": "pdflatex",
"scimax.latexLivePreview.useLatexmk": true,
"scimax.latexLivePreview.buildOnSave": true,
"scimax.latexLivePreview.buildOnIdle": false,
"scimax.latexLivePreview.idleDelay": 2000,
// LaTeX Equation Preview
"scimax.latexPreview.enabled": true,
"scimax.latexPreview.cacheEnabled": true,
"scimax.latexPreview.darkModeAware": true
}
Advanced Export Techniques
Conditional Export
Exclude Content by Tag
Tag headlines to exclude them from export:
#+EXCLUDE_TAGS: noexport private draft
,* Public Section
Content for everyone.
,* Private Notes :noexport:
Internal notes not included in export.
,* Draft Ideas :draft:
Work in progress, excluded.
Select Content by Tag
Only export tagged content:
#+SELECT_TAGS: export publish
,* Internal Document
This section won't be exported.
,* Published Chapter :export:
This section will be exported.
Backend-Specific Content
HTML-Only Content
#+BEGIN_EXPORT html
<div class="alert alert-info">
This appears only in HTML export.
</div>
#+END_EXPORT
LaTeX-Only Content
#+BEGIN_EXPORT latex
\begin{tcolorbox}[title=Important]
This appears only in LaTeX/PDF export.
\end{tcolorbox}
#+END_EXPORT
Export Snippets
Inline backend-specific content:
Click @@html:<button>@@here@@html:</button>@@ to continue.
The value is @@latex:\textcolor{red}{@@important@@latex:}@@.
Macros for Reusable Content
Define macros for repeated content:
#+MACRO: version 2.5.0
#+MACRO: author-email john.doe@example.com
Current version: {{{version}}}
Contact: {{{author-email}}}
Built-in macros:
{{{date}}} - Current date
{{{time}}} - Current time
{{{title}}} - Document title
{{{author}}} - Document author
Include Files
Include content from other files using the #+INCLUDE: directive. Files are processed during export, allowing modular document organization.
Basic Syntax
,#+INCLUDE: "chapter1.org"
,#+INCLUDE: "path/to/file.org"
Paths can be relative (to the current document) or absolute.
Block Wrappers
Wrap included content in a block:
,# Include as source code block
,#+INCLUDE: "code/example.py" src python
,#+INCLUDE: "script.sh" src bash
,# Include as example (verbatim) block
,#+INCLUDE: "output.txt" example
,# Include as quote block
,#+INCLUDE: "excerpt.txt" quote
,# Include as export block (raw format)
,#+INCLUDE: "custom.html" export html
Line Selection with :lines
Include only specific lines from a file:
,# Lines 10 through 20 (inclusive, 1-indexed)
,#+INCLUDE: "data.org" :lines "10-20"
,# From line 10 to end of file
,#+INCLUDE: "data.org" :lines "10-"
,# From beginning to line 20
,#+INCLUDE: "data.org" :lines "-20"
,# Single line
,#+INCLUDE: "data.org" :lines "15"
Headline Level Adjustment with :minlevel
Shift all headlines in the included file to a minimum level:
,# Shift headlines so the minimum level is 2
,#+INCLUDE: "chapter.org" :minlevel 2
This is useful for including a standalone document as a section:
A file with * Heading becomes ** Heading with :minlevel 2
Sub-headlines are adjusted proportionally
Content Only with :only-contents
Strip the first headline and include only its contents:
,#+INCLUDE: "section.org" :only-contents t
This extracts the body of the first headline without including the headline itself.
Combining Options
Options can be combined:
,# Include lines 5-25 of Python file, shift headlines to level 3
,#+INCLUDE: "code.py" src python :lines "5-25"
,# Include chapter, make it a subsection (minlevel 2)
,#+INCLUDE: "chapter.org" :minlevel 2 :only-contents t
Recursive Includes
Included files can themselves contain #+INCLUDE: directives, which are processed recursively. A maximum depth of 10 levels prevents infinite loops.
Example: Modular Book Structure
,#+TITLE: My Book
,#+AUTHOR: Author Name
,#+INCLUDE: "frontmatter.org"
,* Part I: Introduction
,#+INCLUDE: "chapters/intro.org" :minlevel 2
,* Part II: Main Content
,#+INCLUDE: "chapters/chapter1.org" :minlevel 2
,#+INCLUDE: "chapters/chapter2.org" :minlevel 2
,* Appendices
,#+INCLUDE: "appendices/code-samples.org" :minlevel 2
,* Index
,#+INCLUDE: "backmatter/index.org" :only-contents t
Custom Link Types
Define custom export behavior for link types:
# Link to bug tracker
[[bug:1234][Bug #1234]]
# Link to commit
[[commit:abc123][View commit]]
Troubleshooting
HTML Export Issues
MathJax Not Rendering
Problem: Math equations appear as plain text.
Solution:
Ensure internet connection (MathJax loads from CDN)
Check browser console for errors
Verify math syntax (use \(...\) or $...$ for inline, \[...\] for display)
Broken Images
Problem: Images don't appear in exported HTML.
Solution:
Use relative paths: [[file:. images plot.png]]
Ensure images are in same directory or subdirectory
Check image file names (case-sensitive on Linux)
CSS Not Applied
Problem: Custom CSS doesn't show.
Solution:
Verify #+HTML_HEAD: syntax
Check CSS selector specificity
Inspect generated HTML for CSS inclusion
LaTeX/PDF Export Issues
Missing Packages
Problem: Compilation fails with "! LaTeX Error: File xyz.sty not found"
Solution:
# TeX Live
sudo tlmgr install xyz
# MiKTeX (Windows)
miktex packages install xyz
# MacTeX
sudo tlmgr install xyz
Unicode Errors
Problem: "! Package inputenc Error: Unicode character ... not set up"
Solution:
Switch to XeLaTeX or LuaLaTeX: #+BEGIN_SRC json { "scimax.latexLivePreview.compiler": "xelatex" } #+END_SRC
Or use LaTeX-safe characters
Bibliography Not Generated
Problem: Citations show as [?] in PDF.
Solution:
Ensure `.bib' file exists
Use `latexmk' (handles BibTeX automatically)
Check citation keys match bibliography entries
Verify bibliography: and bibliographystyle: links
Images Not Found
Problem: LaTeX can't find image files.
Solution:
Use relative paths from org file location
Avoid spaces in filenames
Use supported formats: PNG, JPG, PDF, EPS
Check \graphicspath if using custom image directories
Compilation Timeout
Problem: PDF export hangs or times out.
Solution:
Check for infinite loops in LaTeX code
Reduce document size
Disable auto-build: buildOnSave: false
Review `.log' file for warnings
Markdown Export Issues
Table Alignment
Problem: Tables don't align properly.
Solution:
GitHub-flavored Markdown tables are left-aligned by default
Org-mode alignment hints (<l>, <c>, <r>) are not supported
Consider using HTML tables for complex layouts
Math Not Rendering
Problem: Math equations don't work.
Solution:
GitHub supports some math via $$...$$ (display) and $...$ (inline)
Other platforms may require MathJax integration
Consider exporting to HTML for math-heavy content
General Export Issues
Empty Export
Problem: Export produces empty or minimal file.
Solution:
Check export scope (full vs. subtree)
Verify content isn't excluded by tags
Ensure headlines match H: level setting
Review #+OPTIONS settings
Slow Export
Problem: Export takes very long.
Solution:
Disable `buildOnIdle' for PDF export
Reduce `toc' depth
Split large documents into smaller files
Use #+INCLUDE: for modular organization
Wrong Output Location
Problem: Export file appears in unexpected location.
Solution:
Check #+EXPORT_FILE_NAME: keyword
Verify save dialog selection
Review file permissions in target directory
Best Practices
Document Organization
Use Meaningful Headings
Clear, descriptive headline text
Logical hierarchy (avoid jumping levels)
Consistent depth for similar content
Metadata at Top
#+TITLE: Document Title
#+AUTHOR: Your Name
#+DATE: 2024-01-15
#+OPTIONS: toc:t num:t
#+LATEX_CLASS: article
Separate Concerns
Content in main file
References in `.bib' file
Images in images/ directory
Custom styles in `.css' file
Version Control
Track Generated Files Separately
Add to .gitignore:
*.pdf
*.html
*.tex
*.aux
*.log
*.out
*.toc
Use Meaningful Commit Messages
Update export configuration for XeLaTeX support
Add custom LaTeX preamble for ACM format
Fix image paths in HTML export
✅ Performance Optimization
✅ For Large Documents
Disable auto-build during editing
Use #+INCLUDE: for modular structure
Cache expensive computations
Optimize image sizes
✅ For Fast Iteration
Use HTML preview for quick checks
Enable `buildOnIdle' with appropriate delay
Use body-only export for faster generation
Minimize custom packages
✅ Example Workflows
✅ Academic Paper Workflow
1. Initial Setup
#+TITLE: Novel Approach to Machine Learning
#+AUTHOR: Dr. Jane Smith
#+DATE: \today
#+OPTIONS: toc:t num:t H:3
#+LATEX_CLASS: IEEEtran
#+LATEX_HEADER: \usepackage{amsmath,amssymb}
#+LATEX_HEADER: \usepackage{algorithm,algorithmic}
#+BIBLIOGRAPHY: references.bib
2. Write Content
Structure with standard sections:
Abstract
Introduction
Related Work
Methodology
Results
Discussion
Conclusion
3. Add Citations
Recent work cite:smith2023 has shown...
4. Export to PDF
`C-c C-e l p' → PDF via LaTeX
5. Submit
Review generated PDF, make final edits, submit.
Technical Documentation Workflow
1. Setup
#+TITLE: API Documentation
#+AUTHOR: Development Team
#+OPTIONS: toc:2 num:nil H:4
#+HTML_HEAD: <link rel="stylesheet" href="docs.css" />
2. Write Sections
Getting Started
API Reference
Examples
Troubleshooting
3. Export to HTML
`C-c C-e h h' → HTML
4. Deploy
Copy HTML and CSS to docs server or GitHub Pages.
✅ Blog Post Workflow
✅ 1. Write in Org
#+TITLE: 10 Tips for Better Python Code
#+AUTHOR: Tech Blogger
#+DATE: 2024-01-15
#+OPTIONS: toc:nil num:nil
✅ 2. Export to Markdown
`C-c C-e m m' → Markdown
✅ 3. Publish
Copy Markdown to CMS or static site generator (Hugo, Jekyll, etc.)
✅ Resources
✅ External Links
✅ Org-Mode Documentation
✅ LaTeX Resources
✅ Community
✅ Appendix
✅ Complete Keybinding Reference
| Keybinding | Command | Description |
|---|---|---|
| C-c C-e | Export dispatcher | Open export menu |
| C-c C-e h h | HTML export | Export to .html |
| C-c C-e h o | HTML export and open | Export and open in browser |
| C-c C-e h p | HTML preview | Preview in VS Code webview |
| C-c C-e l l | LaTeX export | Export to .tex |
| C-c C-e l p | PDF export | Export to PDF |
| C-c C-e l o | PDF export and open | Export and open PDF |
| C-c C-e l v | LaTeX preview | Open PDF preview |
| C-c C-e l s | Forward sync | Sync cursor to PDF (SyncTeX) |
| C-c C-e m m | Markdown export | Export to .md |
| C-c C-e m o | Markdown export and open | Export and open in editor |
| C-c C-e d d | DOCX export | Export to .docx |
| C-c C-e d o | DOCX export and open | Export and open in Word |
| C-c k | Clipboard HTML (rich) | Copy subtree as rich HTML |
| C-c C-e k h | Clipboard HTML (rich) | Copy as rich HTML (menu) |
| C-c C-e k H | Clipboard HTML (source) | Copy HTML source code |
| C-c C-e k l | Clipboard LaTeX | Copy LaTeX source code |
| C-c C-e k m | Clipboard Markdown | Copy Markdown source code |
Export Options Quick Reference
| Option | Values | Default | Effect |
|---|---|---|---|
| toc | t/nil/N | nil | Table of contents (N = depth) |
| num | t/nil/N | t | Section numbering (N = depth) |
| H | N | 0 | Export headlines up to level N |
| author | t/nil | t | Include author name |
| date | t/nil | t | Include date |
| t/nil | nil | Include email (from #+EMAIL) | |
| tags | t/nil/not-in-toc | t | Include tags in headlines |
| todo | t/nil | t | Include TODO keywords |
| pri | t/nil | nil | Include priority cookies ([#A]) |
| < | t/nil | t | Include timestamps |
| creator | t/nil | nil | Include creator in postamble |
| f | t/nil | t | Include footnotes |
| p | t/nil | nil | Include planning info |
| c | t/nil | nil | Include CLOCK entries |
| d | t/nil/(list) | nil | Include drawers |
| \vert{} | t/nil | t | Include tables |
| ^ | t/nil/{} | {} | Sub/superscripts (default: only ab/ab; t: also a_b/a^b) |
| : | t/nil | t | Include fixed-width sections |
| \n | t/nil | nil | Preserve line breaks |
LaTeX Package Reference
Essential Packages (Auto-Included)
| Package | Purpose |
|---|---|
| inputenc | Character encoding (UTF-8) |
| fontenc | Font encoding (T1) |
| hyperref | Hyperlinks and PDF metadata |
| graphicx | Image inclusion |
| amsmath | Mathematical typesetting |
| amssymb | Math symbols |
| booktabs | Professional tables |
| listings | Code listing (if enabled) |
| ulem | Strike-through support |
Optional Packages
| Package | Purpose | Add With |
|---|---|---|
| geometry | Page layout | #+LATEX_HEADER: |
| natbib | Bibliography | #+LATEX_HEADER: |
| minted | Advanced syntax highlighting | #+LATEX_HEADER: |
| tikz | Graphics and diagrams | #+LATEX_HEADER: |
| tcolorbox | Colored boxes | #+LATEX_HEADER: |
| cleveref | Smart cross-references | #+LATEX_HEADER: |
| fontspec | System fonts (XeLaTeX/LuaLaTeX) | #+LATEX_HEADER: |
HTML Classes and IDs
Exported HTML uses semantic classes for styling:
Document Structure
`.org-content' - Main content container
`.org-section' - Document section
`.org-preamble' - Document preamble
`#title-block' - Title, author, date header
Headings and TOC
`.org-toc' - Table of contents
`.section-number' - Section number prefix
Text Elements
`.org-todo' - TODO keyword
`.org-done' - DONE keyword
`.org-priority' - Priority marker
`.org-tags' - Tag container
`.org-tag' - Individual tag
`.org-timestamp' - Timestamp
`.org-underline' - Underlined text
Blocks
`.org-src-container' - Source block wrapper
`.src' - Source block pre element
`.example' - Example block
`.org-center' - Centered content
`.org-latex-environment' - LaTeX environment
Tables and Lists
`.org-table' - Table element
`.org-footnotes' - Footnotes container
`.org-footnote' - Individual footnote
`.org-footnote-ref' - Footnote reference link
Admonitions
`.admonition' - Generic admonition
`.org-warning' - Warning box
`.org-note' - Note box
`.org-tip' - Tip box
`.org-important' - Important box
Troubleshooting Decision Tree
Export Problem?
├─ HTML Export
│ ├─ Math not rendering → Check MathJax CDN, internet connection
│ ├─ Images broken → Verify paths, file existence
│ └─ Styling wrong → Check CSS inclusion, specificity
├─ PDF Export
│ ├─ Compilation fails
│ │ ├─ Missing package → Install via tlmgr/MiKTeX
│ │ ├─ Unicode error → Switch to XeLaTeX/LuaLaTeX
│ │ └─ Timeout → Review .log, reduce complexity
│ ├─ Bibliography missing → Check .bib file, use latexmk
│ └─ Images not found → Verify paths, formats (PNG/JPG/PDF)
├─ Markdown Export
│ ├─ Tables misaligned → GFM limitation, consider HTML
│ └─ Math not rendering → Platform-specific, try HTML
└─ General
├─ Empty export → Check scope, tags, OPTIONS
├─ Slow → Disable auto-build, optimize images
└─ Wrong location → Check EXPORT_FILE_NAME, save dialog
This documentation covers the complete export system in Scimax VS Code. For additional help, consult the project repository or file an issue.