Convert Markdown (.md) files to PDF ...
Project description
md2ltx
A command-line tool for converting Markdown to PDF via Pandoc and LaTeX.
Usage
md2ltx [source.md] [output.pdf] [--open] [--save] [--help]
Positional Arguments
• source_file
Path to the input Markdown (.md) file.
• output_pdf (optional)
Path to the output PDF file. If omitted, a default name is derived from the source file.
Optional Switches
• --open
Open the resulting PDF in the system’s default viewer.
• --save
Save the resulting PDF to the provided output file instead of using a temporary file.
• --help
Show this help message and exit.
Description
md2ltx uses Pandoc to transform Markdown files into LaTeX, which pdflatex then uses to generate a final PDF. This workflow supports most of Markdown’s core syntax plus many Pandoc extensions. Below is a high-level overview of how Pandoc typically converts various Markdown constructs into LaTeX. For full details, refer to Pandoc’s official documentation.
1) Headings
• Markdown
# Heading 1
## Heading 2
### Heading 3
• Pandoc → LaTeX
\section{Heading 1}
\subsection{Heading 2}
\subsubsection{Heading 3}
Pandoc chooses \section, \subsection, etc. based on the heading level. It also supports underline-style Markdown headings with “===” or “---” for level-one and level-two headings.
2) Emphasis & Strong Emphasis
• Markdown
*emphasis* or _emphasis_
**strong emphasis** or __strong emphasis__
• Pandoc → LaTeX
\emph{emphasis}
\textbf{strong emphasis}
3) Inline Code
• Markdown
`inline code`
• Pandoc → LaTeX
\texttt{inline code}
4) Code Blocks
• Markdown (fenced)
```
a = 1
b = 2
```
• Pandoc → LaTeX (by default)
\begin{verbatim}
a = 1
b = 2
\end{verbatim}
With certain options, Pandoc can use different LaTeX environments (e.g., listings).
5) Lists
• Unordered (Markdown)
- item 1
- item 2
- item 3
• Pandoc → LaTeX
\begin{itemize}
\item item 1
\item item 2
\item item 3
\end{itemize}
• Ordered (Markdown)
1. item 1
2. item 2
• Pandoc → LaTeX
\begin{enumerate}
\item item 1
\item item 2
\end{enumerate}
6) Links & Images
• Link (Markdown)
[Pandoc](https://pandoc.org)
• Pandoc → LaTeX
\href{https://pandoc.org}{Pandoc}
• Image (Markdown)

• Pandoc → LaTeX
\includegraphics{image.png}
By default, \includegraphics is placed without floats. You can add captions or figure environments using extended syntax or metadata.
7) Blockquotes
• Markdown
> This is a blockquote.
• Pandoc → LaTeX
\begin{quote}
This is a blockquote.
\end{quote}
8) Horizontal Rules
• Markdown
---
***
___
• Pandoc → LaTeX
\hrule
9) Footnotes (Pandoc Extension)
• Markdown
This is some text with a footnote.[^1]
[^1]: This is the footnote text.
• Pandoc → LaTeX
This is some text with a footnote.\footnote{This is the footnote text.}
10) Tables
• Markdown (simple pipe table)
| Column1 | Column2 |
|---------|---------|
| Val1 | Val2 |
| Val3 | Val4 |
• Pandoc → LaTeX
\begin{table}
\centering
\begin{tabular}{ll}
\hline
Column1 & Column2 \\
\hline
Val1 & Val2 \\
Val3 & Val4 \\
\hline
\end{tabular}
\end{table}
11) Math & LaTeX Blocks
• Inline Math
$E = mc^2$
• Pandoc → LaTeX
\(E = mc^2\)
• Display Math
$$
E = mc^2
$$
• Pandoc → LaTeX
\[
E = mc^2
\]
12) Citations & Bibliographies
Pandoc can handle citations if you provide a bibliography file. A reference like [@smith2009] can become \cite{smith2009} or \autocite depending on the style and Pandoc’s command-line options.
13) Metadata & Title Blocks
Markdown with a YAML metadata block (e.g., “title: My Title”) can become \title, \author, etc., in LaTeX. Use -s or --standalone to generate a title page and call \maketitle.
14) Raw LaTeX
Pandoc passes raw LaTeX through if you’re converting to LaTeX or PDF. For example:
\newpage
remains \newpage in the output.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file md2ltx-0.0.3.tar.gz.
File metadata
- Download URL: md2ltx-0.0.3.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8ce23714e8892217ae2299157d9ca2a411de2c1225d76144bc4ab46847da524
|
|
| MD5 |
7fe27cf593f6edb9e34481fd3c111f7a
|
|
| BLAKE2b-256 |
f962500782b3441c57ee66fe591fd7b2224257c9082872593b7bc5dd1b2818d7
|
File details
Details for the file md2ltx-0.0.3-py3-none-any.whl.
File metadata
- Download URL: md2ltx-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26d27b251929680b5158768a1b83c8a0c9c086bdac479cc0ade666d6dc57d0a8
|
|
| MD5 |
f4eb1dd55323a12f8e7203bb6d640a7c
|
|
| BLAKE2b-256 |
a796139d1f56a5770089ba8a300acee0efc37ab6ea4152c0ad3d9e3e7cf59ff6
|