Agent SkillsAgent Skills
Mearman

md-to-latex

@Mearman/md-to-latex
Mearman
3
0 forks
Updated 3/31/2026
View on GitHub

Convert Markdown to LaTeX format. Use when the user asks to convert, transform, or change Markdown files to LaTeX, or mentions converting .md files to .tex files.

Installation

$npx agent-skills-cli install @Mearman/md-to-latex
Claude Code
Cursor
Copilot
Codex
Antigravity

Details

Pathplugins/tex/skills/md-to-latex/SKILL.md
Branchmain
Scoped Name@Mearman/md-to-latex

Usage

After installing, this skill will be available to your AI coding assistant.

Verify installation:

npx agent-skills-cli list

Skill Instructions


name: md-to-latex description: Convert Markdown to LaTeX format. Use when the user asks to convert, transform, or change Markdown files to LaTeX, or mentions converting .md files to .tex files.

Markdown to LaTeX Converter

Convert Markdown documents to LaTeX format with comprehensive support for common Markdown syntax.

Usage

npx tsx plugins/tex/scripts/md-to-latex.ts <text>
npx tsx plugins/tex/scripts/md-to-latex.ts --file <input.md>
npx tsx plugins/tex/scripts/md-to-latex.ts --file <input.md> --output <output.tex>

Supported Conversions

Headers

  • # Heading β†’ \chapter{Heading}
  • ## Heading β†’ \section{Heading}
  • ### Heading β†’ \subsection{Heading}
  • #### Heading β†’ \subsubsection{Heading}
  • ##### Heading β†’ \paragraph{Heading}
  • ###### Heading β†’ \subparagraph{Heading}

Text Formatting

  • **bold** or __bold__ β†’ \textbf{bold}
  • *italic* or _italic_ β†’ \emph{italic}
  • `code` β†’ \texttt{code}

Code Blocks

```python
def hello():
    print("world")
```

β†’

\begin{verbatim}
def hello():
    print("world")
\end{verbatim}

Lists

Unordered lists:

- Item 1
- Item 2
  - Nested item

β†’

\begin{itemize}
\item Item 1
\item Item 2
  \item Nested item
\end{itemize}

Ordered lists:

1. First
2. Second
3. Third

β†’

\begin{enumerate}
\item First
\item Second
\item Third
\end{enumerate}

Links

  • [text](url) β†’ \href{url}{text}

Images

  • ![alt](path) β†’ \begin{figure}[h]\n\centering\n\includegraphics{path}\n\caption{alt}\n\end{figure}
  • ![](path) β†’ \includegraphics{path} (no caption)

Blockquotes

> This is a quote
> spanning multiple lines

β†’

\begin{quote}
This is a quote
spanning multiple lines
\end{quote}

Horizontal Rules

  • --- β†’ \hrulefill

Special Character Handling

LaTeX special characters (&, %, $, #, _, {, }) are automatically escaped in text content (but not in code blocks).

Arguments

  • Positional arguments: Text to convert (if no --file flag)
  • --file: Read input from file
  • --output <file>: Write output to file (default: stdout)

Examples

Convert inline text

npx tsx plugins/tex/scripts/md-to-latex.ts "# Hello World\n\nThis is **bold** text."

Convert file

npx tsx plugins/tex/scripts/md-to-latex.ts --file document.md --output document.tex

Use in pipeline

echo "## Section\n\nParagraph with *italic*" | npx tsx plugins/tex/scripts/md-to-latex.ts

Limitations

  • Does not handle complex nested structures beyond simple cases
  • Tables are not automatically converted (Markdown tables have no direct LaTeX equivalent without packages)
  • Math notation is preserved as-is (both Markdown and LaTeX use $...$ for inline math and $$...$$ for display math)
  • HTML tags in Markdown are not converted

Related Skills

  • latex-to-md: Convert LaTeX back to Markdown
  • tex-encode: Encode Unicode characters to LaTeX commands
  • tex-decode: Decode LaTeX commands to Unicode
  • tex-strip: Remove all LaTeX formatting for plain text