✅ 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

✅ 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

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

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)

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:

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:

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.

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

,* 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
# 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

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 bibliography: line specifies your BibTeX file. Citations are automatically resolved and a formatted bibliography is generated at the end of the document.

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

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

- Item 1
- Item 2
  - Nested
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, {}tSub/superscripts ({} requires braces)
:t, niltInclude fixed-width sections
\nt, nilnilPreserve line breaks

Examples

#+OPTIONS: toc:3 num:t H:4 author:t date:t tags:nil todo:nil
#+OPTIONS: toc:nil num:nil author:nil date:nil tags:nil todo:nil pri:nil
#+OPTIONS: toc:t num:t H:3 ^:{} author:t date:t email:t
#+OPTIONS: d:t c:t p:t
#+OPTIONS: d:("LOGBOOK" "NOTES")
#+OPTIONS: tags:not-in-toc

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

EXPORTFILENAME

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.

EXCLUDETAGS

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

SELECTTAGS

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

{
  "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

{
  "scimax.latexLivePreview.compiler": "xelatex"
}

Use latexmk

Build on Save

Build on Idle

Idle Delay

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

  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

  1. Use relative paths: [[file:./images/plot.png]]

  2. Ensure images are in same directory or subdirectory

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

CSS Not Applied

  1. Verify #+HTML_HEAD: syntax

  2. Check CSS selector specificity

  3. Inspect generated HTML for CSS inclusion

LaTeX/PDF Export Issues

Missing Packages

# TeX Live
sudo tlmgr install xyz

# MiKTeX (Windows)
miktex packages install xyz

# MacTeX
sudo tlmgr install xyz

Unicode Errors

  1. Switch to XeLaTeX or LuaLaTeX:

  2. Or use LaTeX-safe characters

Bibliography Not Generated

  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

  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

  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

  • 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

  • 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

  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

  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

  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
dtnil(list)nilInclude drawers
\vert{}t/niltInclude tables
^tnil{}tSub/superscripts ({}=braces required)
: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#+LATEXHEADER:
natbibBibliography#+LATEXHEADER:
mintedAdvanced syntax highlighting#+LATEXHEADER:
tikzGraphics and diagrams#+LATEXHEADER:
tcolorboxColored boxes#+LATEXHEADER:
cleverefSmart cross-references#+LATEXHEADER:
fontspecSystem fonts (XeLaTeX/LuaLaTeX)#+LATEXHEADER:

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