✅ 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 Dispatcher Menu Structure

The dispatcher menu is organized into logical groups:

✅ HTML Exports

  • [h h] HTML file - Export to .html file

  • [h o] HTML and open - Export to .html and open in browser

  • [h p] HTML preview - Preview HTML in VS Code webview

✅ LaTeX/PDF Exports

  • [l l] LaTeX file - Export to .tex file

  • [l p] PDF file - Export to PDF via LaTeX compilation

  • [l o] PDF and open - Export to PDF and open with system viewer

These three can be routed to a custom exporter based on the document's #+LATEX_CLASS, so a memo or report class exports correctly without running a separate command. See Custom Exporters by LaTeX Class.

Beamer Exports

  • [s b] Beamer (LaTeX) - Export to Beamer .tex file

  • [s p] Beamer PDF - Compile Beamer to PDF

  • [s o] Beamer PDF and open - Compile and open with system viewer

See Beamer Export for the keyword/property reference.

✅ Markdown Exports

  • [m m] Markdown file - Export to .md file

  • [m o] Markdown and open - Export to .md and open in VS Code

✅ Jupyter Notebook Exports

  • [j j] Jupyter Notebook - Export to .ipynb file

  • [j o] Notebook and open - Export and open in VS Code notebook viewer

  • [j p] Participant notebook - Export with solutions stripped (for teaching)

✅ DOCX (Word) Exports

  • [d d] Word document - Export to .docx file

  • [d o] Word and open - Export and open in Microsoft Word

✅ Clipboard Exports (ox-clip style)

Copy formatted content to clipboard for pasting into other applications:

  • [k h] HTML (rich) - Copy as formatted rich text (paste into Word, email, etc.)

  • [k H] HTML (source) - Copy HTML source code

  • [k l] LaTeX - Copy LaTeX source code

  • [k m] Markdown - Copy Markdown source code

Quick keybinding: C-c k copies current subtree as rich HTML.

✅ 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:

SyntaxRenders 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.

\begin{equation} x^2 + y^2 = r^2 \end{equation}

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:

KeywordEffect
#+EXPORTER: cmu-memoUse this exporter regardless of #+LATEX_CLASS
#+EXPORTER: noneForce 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:

  1. Open Settings (`C-,')

  2. Search for `scimax.export.latex.customHeader'

  3. 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 USD or USD 50,000.

  • Inline verbatim: =$50,000= exports as \texttt{\$50,000} (monospace, but correct).

  • Raw LaTeX snippet for the sign only: @@latex:\$@@50,000 emits 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:

  1. Org → LaTeX conversion

  2. `latexmk' compilation (handles multiple passes automatically)

  3. Bibliography processing if needed

  4. 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:

SourceWhere
Built-inalways available (see below)
Settingsscimax.export.pdf.profiles
Global file{scimax.directory}/latex-profiles.json
Project fileslatex-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

NameSequence
pdflatex-bibtexpdflatex → bibtex → pdflatex → pdflatex
lualatex-biberlualatex → biber → lualatex → lualatex
xelatex-biberxelatex → biber → xelatex → xelatex
latexmk-pdflatexlatexmk -pdf -bibtex (handles reruns itself)
latexmk-lualatexlatexmk -lualatex -bibtex (handles reruns itself)
pdflatex-fastone 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):

TokenExpands toExample
%ffile name with extensionthesis.tex
%bbase name, no extensionthesis
%pabsolute path to the .tex file/papers/2026/thesis.tex
%ddirectory holding the .tex file/papers/2026
%ooutput directory/papers/2026
%Pthe 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

KeyMeaning
commandexecutable to run (required)
argsargument array; tokens expanded, never shell-parsed
labelname shown in progress messages
cwdworking directory (defaults to the .tex file's directory)
envextra environment variables for this step
timeoutMsper-step timeout (default 180000)
continueOnErrorset false to abort the build when this step fails
whenFileExistsrun only if this file exists, e.g. "%b.bcf"
whenFileMatchesrun 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

CommandDescription
scimax.latex.selectBuildProfilePick a profile and set #+LATEX_BUILD:
scimax.latex.showBuildProfileShow which profile a document uses
scimax.latex.createBuildProfilesFileWrite 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.svgdiagram.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:

  1. rsvg-convert (from librsvg -- fastest, recommended)

  2. cairosvg (a Python package)

  3. 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:

  1. The extension offers to open the `.log' file

  2. Review the log for LaTeX errors

  3. 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 .tex line 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.pdf that 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 --output target is left untouched, since a failed run never writes to it.

  • With --json, the failure object includes latex_error, tex_line, log_file, and removed_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.tex expecting the change to survive. Fix the problem in the .org source 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 .tex patch are already handled inside the export.

  • Some LaTeX setups also define a latexmk custom dependency that rebuilds .tex from .org; where that exists, running latexmk on the .tex regenerates 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-run scimax 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:

  1. Maps your org line to the generated LaTeX line

  2. Uses SyncTeX to find the PDF position

  3. Searches the PDF text layer to find the exact word

  4. 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:

  1. Gets PDF coordinates from your click

  2. Uses SyncTeX to find the LaTeX line

  3. Maps the LaTeX line back to your org source line

  4. 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:

KeybindingCommandDescription
C-c C-e j jscimax.org.exportIpynbExport to .ipynb file
C-c C-e j oscimax.org.exportIpynbOpenExport and open in notebook viewer
C-c C-e j pscimax.org.exportIpynbParticipantExport with solutions stripped

Kernel Detection

The kernel is determined in this order:

  1. #+OX_IPYNB_KERNEL_NAME: keyword in the document

  2. Most common source block language in the document

  3. Default: python3

,#+OX_IPYNB_KERNEL_NAME: julia-1.9
,#+TITLE: Julia Tutorial

Content here will use the Julia kernel.

Cell Conversion

Org ElementJupyter Cell TypeNotes
HeadlinesMarkdown#, ##, ### syntax
ParagraphsMarkdownInline markup converted
ListsMarkdownOrdered, unordered, checkboxes
TablesMarkdownPipe-delimited format
Source blocks (kernel lang)CodeWith outputs if results exist
Source blocks (other)MarkdownAs code fences
LaTeX fragmentsMarkdown$...$ 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:

SettingDefaultDescription
scimax.export.ipynb.defaultKernel"python3"Default Jupyter kernel name
scimax.export.ipynb.embedImagestrueBase64 encode images in outputs
scimax.export.ipynb.includeResultstrueInclude #+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:

KeybindingCommandDescription
C-c C-e d dscimax.org.exportDocxExport to .docx file
C-c C-e d oscimax.org.exportDocxOpenExport 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 1 through Heading 6 for headlines

  • Normal for paragraph text

  • Code for inline code

  • Quote for quote blocks

  • Caption for 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

KeybindingCommandDescription
C-c kscimax.org.clipboardHtmlRichCopy subtree as rich HTML
C-c C-e kClipboard menuOpen clipboard export submenu

Clipboard Menu Options

Access via C-c C-e k:

KeyFormatDescription
hHTML (rich)Copy as formatted text for email/Word
HHTML (source)Copy raw HTML source code
lLaTeXCopy LaTeX source code
mMarkdownCopy Markdown source code

Export Scope

The export scope determines which content is copied:

ScopeDescription
fullEntire document
subtreeCurrent headline and all children (default)
selectionSelected 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:

PlatformToolNotes
macOStextutil + pbcopyConverts HTML to RTF, built-in
Linuxxclip or wl-copyX11: sudo apt install xclip; Wayland: wl-copy
WindowsPowerShellUses 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

  1. Position cursor on a headline

  2. Press C-c k to copy as rich HTML

  3. Paste into email - formatting, code blocks, and links are preserved

Copying to Word/Google Docs

  1. Select the content or position on headline

  2. C-c C-e k h to copy as rich HTML

  3. Paste into document - tables, lists, and emphasis are formatted

Sharing Source Code

  1. Position on headline containing code explanation

  2. C-c C-e k m to copy as Markdown

  3. Paste into GitHub issue or PR description

LaTeX Snippets

  1. Select a portion with equations

  2. C-c C-e k l to copy as LaTeX

  3. Paste into LaTeX editor

Export Keybindings

Primary Keybindings

KeybindingCommandDescription
C-c C-eExport dispatcherOpen export menu
C-c C-e h hHTML exportExport to HTML file
C-c C-e h oHTML export and openExport HTML and open in browser
C-c C-e l lLaTeX exportExport to .tex file
C-c C-e l pPDF exportExport to PDF via LaTeX
C-c C-e l oPDF export and openExport PDF and open viewer
C-c C-e m mMarkdown exportExport to .md file
C-c C-e d dDOCX exportExport to .docx file
C-c C-e d oDOCX export and openExport and open in Word
C-c kClipboard HTML richCopy subtree as rich HTML
C-c C-e k hClipboard HTML richCopy as rich HTML (menu)
C-c C-e k HClipboard HTML srcCopy HTML source
C-c C-e k lClipboard LaTeXCopy LaTeX source
C-c C-e k mClipboard MarkdownCopy Markdown source

Additional LaTeX Keybindings

KeybindingCommandDescription
C-c C-e l vOpen LaTeX previewOpen PDF preview (if built)
C-c C-e l sForward syncSync 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:

  1. Place cursor on or within a headline

  2. Invoke export dispatcher (`C-c C-e')

  3. 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:

  1. Fold sections you want to exclude (`Tab' on headings)

  2. Invoke export (`C-c C-e')

  3. 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

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-citeLaTeX 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-citeLaTeX 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-citeLaTeX 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 TypeExampleOutput Style
cite:cite:knuth1984Parenthetical (Smith, 2020)
citep:citep:knuth1984Parenthetical (Smith, 2020)
citet:citet:knuth1984Textual: Smith (2020)
citeauthor:citeauthor:knuth1984Author only: Smith
citeyear:citeyear:knuth1984Year 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:

  1. Finds all #+BIBLIOGRAPHY: keywords and [[bibliography:...]] links

  2. Loads the BibTeX entries from those files

  3. Formats citations according to the selected style

  4. 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:

StyleDescription
apaAmerican Psychological Association (default)
mlaModern Language Association
chicagoChicago Manual of Style
harvardHarvard referencing
ieeeIEEE citation format
vancouverVancouver (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 text

  • Check your .bib file 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)

  1. Place cursor in org file

  2. Press `C-c C-e l s'

  3. 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     |

Images

[[file:diagram.png]]  →  ![](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

OptionValuesDefaultDescription
toct, nil, NnilTable of contents (N depth)
numt, nil, NtSection numbering (N depth)
HN0Headline levels to export (0 all)
authort, niltInclude author in output
datet, niltInclude date in output
emailt, nilnilInclude email in output
tagst, nil, not-in-toctInclude tags in headlines
todot, niltInclude TODO keywords in headlines
prit, nilnilInclude priority cookies ([#A], etc.)
<, timestampt, niltInclude timestamps
creatort, nilnilInclude creator string in postamble
ft, niltInclude footnotes
pt, nilnilInclude statistics cookies ([1/3], [50%])
ct, nilnilInclude CLOCK entries
dt, nil, (list)nilInclude drawers (or specific drawers)
propt, niltInclude PROPERTIES drawers
\vert{}t, niltInclude tables
^t, nil, {}{}Sub/superscripts (default: only ab/ab; t: also a_b/a^b)
:t, niltInclude fixed-width sections
\nt, nilnilPreserve 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:

ValueBehavior
{}(default) Only braced forms render: a_{b} → subscript, a_b → literal
tBoth forms render: a_{b} and a_b both produce a subscript
nilNever 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 produces custom-output-name.html

  • The 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.

EXCLUDE_TAGS

Exclude headlines with specific tags from export:

#+EXCLUDE_TAGS: noexport private draft
  • Space-separated list of tags

  • noexport is always excluded by default (even if not specified)

  • Headlines with any of these tags (and their children) are omitted

  • Useful for keeping internal notes, drafts, or private content

SELECT_TAGS

Export only headlines with specific tags:

#+SELECT_TAGS: export publish
  • When set, only headlines with at least one of these tags are exported

  • Headlines without a select tag are excluded (unless a child has one)

  • Overrides normal export behavior for selective publishing

Example workflow:

#+SELECT_TAGS: publish
#+EXCLUDE_TAGS: noexport

,* Internal Notes                                    :noexport:
Not exported (excluded).

,* Introduction
Not exported (no select tag).

,* Published Chapter                                 :publish:
Exported (has select tag).

,** Subsection
Also exported (child of published chapter).

Configuration Settings

Export Settings Location

All export settings are in VS Code preferences:

  1. `C-,' (`s-,' on Mac) to open Settings

  2. Search for "scimax export" or "scimax latex"

  3. 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

Troubleshooting

HTML Export Issues

MathJax Not Rendering

Problem: Math equations appear as plain text.

Solution:

  1. Ensure internet connection (MathJax loads from CDN)

  2. Check browser console for errors

  3. Verify math syntax (use \(...\) or $...$ for inline, \[...\] for display)

Broken Images

Problem: Images don't appear in exported HTML.

Solution:

  1. Use relative paths: [[file:.imagesplot.png]]

  2. Ensure images are in same directory or subdirectory

  3. Check image file names (case-sensitive on Linux)

CSS Not Applied

Problem: Custom CSS doesn't show.

Solution:

  1. Verify #+HTML_HEAD: syntax

  2. Check CSS selector specificity

  3. 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:

  1. Switch to XeLaTeX or LuaLaTeX: #+BEGIN_SRC json { "scimax.latexLivePreview.compiler": "xelatex" } #+END_SRC

  2. Or use LaTeX-safe characters

Bibliography Not Generated

Problem: Citations show as [?] in PDF.

Solution:

  1. Ensure `.bib' file exists

  2. Use `latexmk' (handles BibTeX automatically)

  3. Check citation keys match bibliography entries

  4. Verify bibliography: and bibliographystyle: links

Images Not Found

Problem: LaTeX can't find image files.

Solution:

  1. Use relative paths from org file location

  2. Avoid spaces in filenames

  3. Use supported formats: PNG, JPG, PDF, EPS

  4. Check \graphicspath if using custom image directories

Compilation Timeout

Problem: PDF export hangs or times out.

Solution:

  1. Check for infinite loops in LaTeX code

  2. Reduce document size

  3. Disable auto-build: buildOnSave: false

  4. 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:

  1. Check export scope (full vs. subtree)

  2. Verify content isn't excluded by tags

  3. Ensure headlines match H: level setting

  4. Review #+OPTIONS settings

Slow Export

Problem: Export takes very long.

Solution:

  1. Disable `buildOnIdle' for PDF export

  2. Reduce `toc' depth

  3. Split large documents into smaller files

  4. Use #+INCLUDE: for modular organization

Wrong Output Location

Problem: Export file appears in unexpected location.

Solution:

  1. Check #+EXPORT_FILE_NAME: keyword

  2. Verify save dialog selection

  3. 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

  1. Disable auto-build during editing

  2. Use #+INCLUDE: for modular structure

  3. Cache expensive computations

  4. Optimize image sizes

✅ For Fast Iteration

  1. Use HTML preview for quick checks

  2. Enable `buildOnIdle' with appropriate delay

  3. Use body-only export for faster generation

  4. 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.)

✅ Appendix

✅ Complete Keybinding Reference

KeybindingCommandDescription
C-c C-eExport dispatcherOpen export menu
C-c C-e h hHTML exportExport to .html
C-c C-e h oHTML export and openExport and open in browser
C-c C-e h pHTML previewPreview in VS Code webview
C-c C-e l lLaTeX exportExport to .tex
C-c C-e l pPDF exportExport to PDF
C-c C-e l oPDF export and openExport and open PDF
C-c C-e l vLaTeX previewOpen PDF preview
C-c C-e l sForward syncSync cursor to PDF (SyncTeX)
C-c C-e m mMarkdown exportExport to .md
C-c C-e m oMarkdown export and openExport and open in editor
C-c C-e d dDOCX exportExport to .docx
C-c C-e d oDOCX export and openExport and open in Word
C-c kClipboard HTML (rich)Copy subtree as rich HTML
C-c C-e k hClipboard HTML (rich)Copy as rich HTML (menu)
C-c C-e k HClipboard HTML (source)Copy HTML source code
C-c C-e k lClipboard LaTeXCopy LaTeX source code
C-c C-e k mClipboard MarkdownCopy Markdown source code

Export Options Quick Reference

OptionValuesDefaultEffect
toct/nil/NnilTable of contents (N = depth)
numt/nil/NtSection numbering (N = depth)
HN0Export headlines up to level N
authort/niltInclude author name
datet/niltInclude date
emailt/nilnilInclude email (from #+EMAIL)
tagst/nil/not-in-toctInclude tags in headlines
todot/niltInclude TODO keywords
prit/nilnilInclude priority cookies ([#A])
<t/niltInclude timestamps
creatort/nilnilInclude creator in postamble
ft/niltInclude footnotes
pt/nilnilInclude planning info
ct/nilnilInclude CLOCK entries
dt/nil/(list)nilInclude drawers
\vert{}t/niltInclude tables
^t/nil/{}{}Sub/superscripts (default: only ab/ab; t: also a_b/a^b)
:t/niltInclude fixed-width sections
\nt/nilnilPreserve line breaks

LaTeX Package Reference

Essential Packages (Auto-Included)

PackagePurpose
inputencCharacter encoding (UTF-8)
fontencFont encoding (T1)
hyperrefHyperlinks and PDF metadata
graphicxImage inclusion
amsmathMathematical typesetting
amssymbMath symbols
booktabsProfessional tables
listingsCode listing (if enabled)
ulemStrike-through support

Optional Packages

PackagePurposeAdd With
geometryPage layout#+LATEX_HEADER:
natbibBibliography#+LATEX_HEADER:
mintedAdvanced syntax highlighting#+LATEX_HEADER:
tikzGraphics and diagrams#+LATEX_HEADER:
tcolorboxColored boxes#+LATEX_HEADER:
cleverefSmart cross-references#+LATEX_HEADER:
fontspecSystem 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.

Navigation