Md2latex
Convert a Markdown file into a compilable LaTeX document (.tex + latexmkrc). Auto-selects a bundled template (general_jp / general_en / exercise) from the YAML frontmatter and body language, runs a deterministic Python converter for the mechanical grammar, then does a small semantic pass (labels, cross-references, captions). Use when the user asks to turn a Markdown file into LaTeX/TeX, e.g. "/md2latex target.md".From its SKILL.md
npx -y skills add yusekiya/md2latex --skill md2latexAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
3.7 KB, 819 tokens by cl100k_base, as published. Nobody here has run it
md2latex
Convert a Markdown file to LaTeX. The heavy, mechanical work is done by a bundled Python script (zero model tokens); you only spend tokens on the few semantic fixes the script reports.
Guardrails (always)
- Never modify the source Markdown. Read it only.
- Convert grammar, not content. Never reword, add, or drop the author's text.
- No personal data in output. Leave
\author{names}as-is; never insert real names, emails, IDs, or passwords (outputs may be published).
Workflow
Let SKILL_DIR be the directory containing this SKILL.md.
-
Run the converter (it writes into the current working directory):
python3 "$SKILL_DIR/scripts/md2latex.py" <target.md>It writes
./<basename>.tex,./latexmkrcand — for templates that split their preamble —./config.tex, and prints a POST-EDIT HINTS report to stderr. It auto-selects the template; override with--template general_jp|general_en|exerciseonly if the user asks. -
Read the hints from stderr. They tell you exactly which lines still need a human decision — do not re-scan the whole file.
-
Apply only the reported edits to the generated
.tex(useEdit):- Equation labels: the script turned each
\tag{N}into a placeholder\label{eq:eqN}. Optionally rename to a meaningful label (e.g.eq:sin_function) — if you do, update every reference to it. - Cross-references: rewrite the listed prose references to
\eqref{eq:...}(equations) or\ref{...}(figures/tables/sections), using the label map in the hints. Verify each candidate — some matches (e.g. a number that appears inside a caption) are not references. For a referenced section, add a\label{sec:...}to that\sectionfirst. - Empty captions: figures/tables with no adjacent
>caption block get\caption{}. Leave them empty (do not invent text) unless the user provides the caption. - Subproblems / lists: the script folds each subproblem's full body
(math, continuation prose, nested lists, figures) into its
\item; just confirm the(a)/(b)/...order matches the source. - Callouts: Obsidian callouts (
> [!theorem]…) are converted automatically; act only on flagged ones (a title-less[!law], an unmapped type rendered asinfo, or a degradation toquotein theexercisetemplate).
- Equation labels: the script turned each
-
(Recommended) Compile to confirm it builds, then report the PDF:
latexmk <basename>.texgeneral_jpandexerciseuse LuaLaTeX;general_enuses pdfLaTeX (the bundledlatexmkrcselects the right engine). Re-run once after adding references so the.auxcross-references resolve. Fix any compile errors. -
Report the generated files and any captions left empty / references you were unsure about, so the user can finish those.
Conversion rules & template selection
The full, authoritative grammar mapping and the template-selection rules live in
reference/conversion-spec.md. The semantic
post-edit details live in reference/post-editing.md.
Read them when you hit a case not covered above.
What ships with it: 11 files
92.3 KB alongside SKILL.md, 1 of them executable
reference/
- conversion-spec.md11.6 KB
- post-editing.md4.4 KB
scripts/
- md2latex.pyruns36.4 KB
templates/
- exercise/latexmkrc287 B
- exercise/main.tex2.9 KB
- general_en/config.tex17.3 KB
- general_en/latexmkrc249 B
- general_en/main.tex407 B
- general_jp/config.tex18.1 KB
- general_jp/latexmkrc287 B
- general_jp/main.tex437 B