youfoundjk_TeXcore/docs/features/pdf-export.md
Jovi Koikkara eea4d67e3e
feat(tikz): major rendering, layout, and editor enhancements (#1)
Fixes
- WebAssembly & initialization
  - Fix TikZJax WebAssembly initialization issues.

- Fonts & symbol rendering
  - Override DVI parser `machine.putText` to use split character code offsets from `tikzjax.js`.
  - Map codes 0–9 starting at 161 to fix incorrect Γ rendering (was showing as Θ).
  - Map codes 10–19 starting at 173 to resolve Ω and ⊗ collisions with soft hyphen.

- Layout & rendering
  - Fix SVG clipping by switching to `position: relative` with `overflow: visible`.
  - Adjust inline SVG behavior to prevent top-of-page clipping.

- Type compatibility
  - Cast types to `unknown` in `TikzJaxLoader` and worker functions for compatibility.

- Error handling & cleanup
  - Improve error handling across TikZ components.
  - Remove unused dependencies and unnecessary console logs.

Features
- Package loading system
  - Add robust dependency resolution in `loader.ts` for:
    - `tikz-cd`
    - `tikz-feynhand`
    - `pgfcalendar`
  - Ensure required libraries and keys load dynamically on demand.

- Rendering & layout improvements
  - Enhance SVG bounding box calculation.
  - Implement dynamic column width calculation.
  - Improve row and column layout alignment and responsiveness.

- TikZ editor enhancements
  - Add keyboard shortcut tooltips to sidebar buttons.
  - Introduce thickness control slider for elements.
  - Improve snapping system with modes:
    - grid
    - half
    - none
  - Add support for new shapes:
    - circles
    - rectangles
    - triangles
  - Improve TikZ code generation error handling.

Improvements
- Selection & editing UX
  - Add lasso selection for multiple vertices in `CanvasGrid`.
  - Support multi-element editing in `RightSidebar`.
  - Refactor `TikzEditorModal` to handle multiple selected vertices.
  - Enable batch updates for selected elements.

- Layout & styling
  - Compact `.block-language-tikz` layout:
    - margin: `1.5em 0` → `0.3em 0`
    - padding: `1rem 0` → `0`
  - Improve canvas controls and interaction styles.

- Component refactoring
  - Refactor `CanvasGrid` to use template literals.
  - Replace inline styles with `setCssStyles`.
  - Improve `TikzCodec` node naming clarity.
  - Improve `history manager` type safety with `EditorElement`.
  - Use `window.setTimeout` in asset manager for better compatibility.

- Accessibility & UI polish
  - Improve sidebar button titles and tooltips.
  - Standardize live preview overlay button titles.
  - Clean up modal styling and text consistency.

Documentation
- Revamp TeXcore plugin documentation:
  - Clarify PDF export features and settings.
  - Improve quick preview architecture explanation.
  - Enhance equation search and autocomplete docs.
  - Streamline snippets usage and transformations.
  - Expand TikZ diagrams section with graphical editor guide.
  - Improve getting started guide with clearer steps.
  - Add navigation and configuration updates.

- Update plugin manifest descriptions for clarity.
2026-06-06 12:08:11 +02:00

3.9 KiB
Raw Permalink Blame History

PDF Compilation & Export

TeXcore provides an advanced PDF rendering module to export your mathematical notes with full math layout support. Accessible via ++ctrl+p++ (search Export current file to PDF) or by right-clicking any file/folder in the file explorer to choose Better Export PDF, this modal splits into a real-time responsive 2/3 preview pane and a 1/3 export configuration sidebar.


Core Layout Settings

Customize document geometry, printing limits, and margins before compilation.

Control Option Description Typical Options
Page Size Select standard sheet geometry or define millimeters. A4, Letter, Legal, Tabloid, or Custom
Orientation Vertical portrait layout or horizontal landscape. Portrait, Landscape
Margins Inner safety margins specified in millimeters per edge. None, Default (10mm), Small, or Custom
Downscale Scales content down (0100%) to fit complex tables/formulas. Integer slider percentage

Headers & Footers Configuration

Headers and footers render HTML dynamically using dedicated style selectors.

HTML Template Classes

Include these target element class names in your header/footer HTML code. TeXcore will parse and replace them with print values:

  • <span class="title"></span>: Resolves to note file title.
  • <span class="pageNumber"></span>: Resolves to current page index.
  • <span class="totalPages"></span>: Resolves to total compiled pages.
  • <span class="date"></span>: Inserts local print timestamp.
  • <span class="url"></span>: Inserts workspace source path.

=== "Header Template" html <div style="width: 100vw; font-size: 10px; text-align: center;"> <span class="title"></span> </div>

=== "Footer Template" html <div style="width: 100vw; font-size: 10px; text-align: center;"> <span class="pageNumber"></span> / <span class="totalPages"></span> </div>


Accessing Custom CSS Styling

Style your PDF print outputs independently of Obsidian's active theme.

  1. Write a custom .css template sheet and save it inside your vault folder: .obsidian/snippets/.
  2. Keep this snippet disabled in Obsidian settings. This prevents it from altering your editor UI.
  3. Open the TeXcore Export Dialog, and choose your stylesheet in the dropdown menu. The snippet's styling will be injected exclusively during PDF compilation.

Advanced Compiler Operations

???+ info "Batch Compilation & Tables of Contents" When right-clicking a folder, you can choose Export each file to PDF to compile all children in parallel. The Generate TOC.md file action generates a table of contents file (_TOC_.md) automatically. Configure parallel limits under the Settings Reference.

???+ warning "Metadata & Bookmark Outlines" If enabled in Settings Panel, TeXcore compiles Frontmatter fields (title, author, keywords, subject) into metadata tags inside the output PDF. Outlines index heading levels 1 through 6 dynamically depending on user preferences.


Troubleshooting Print Errors

!!! failure "Common Rendering Obstacles" - Broken Equations / Untagged Math: If preview is incomplete, wait a few seconds before hitting export. MathJax runs asynchronously and needs time to process large nodes. - Missing Snippet Styles: Double check that your snippet stylesheet is in .obsidian/snippets/ and is disabled in standard Obsidian settings. - Write Failures: Ensure the output path is writable and not locked by another PDF reader app. - Webview Crashes: If errors persist, enable Debug Mode in the Settings Reference and click the Debug button in the modal to inspect the Electron DevTools container.