wooorm/remark plugin for latex
Table of Contents
Install
npm i remark remark-cli @paperist/remark-latex
Usage
CLI
See here for more details.
remark -u @paperist/remark-latex document.md -o document.tex
If you configure via rc
file, you should type below.
remark -r ./remarkrc.yml document.md -o document.tex
Syntax
Inspired by pandoc-crossref.
Image label
![Caption](file.ext){#fig:label}
Equation label
$$ math $$ {#eq:label}
Table caption / label
| a | b | c |
|:---:|:---:|:---:|
| 1 | 2 | 3 |
: Caption {#tbl:label}
Section label
# Section {#sec:section}
Code block label
Not implemented
References
From label (e.g. Figure)
[@fig:label1] or [@fig:label1;@fig:label2;...]
BibTeX
[@jones99] or [@jones99;@smith06;...]
Configure
Fields
Field | Description |
---|
baseTemplate | The document template |
documentInfo | The data passed to the base template |
imageConfigs | \includegraphics configs |
templatesDir | Template folder for AST (See templates ) |
Templates
You can use ejs template.
remark-latex read baseTemplate
and bind documentInfo
to output.
%% TeX Template written by ejs format.
\author{<%= author %>}
\title{<%= title %>}
\begin{document}
\maketitle
%% Render results will be exported as `body`.
<%= body %>
\end{document}
You can configure via rc
file (e.g. remarkrc.json
, remarkrc.yml
).
See also here.
output: true
plugins:
- "@paperist/remark-latex"
settings:
latex:
baseTemplate: latex/template.tex
imageConfigs:
width: 0.9\linewidth
documentInfo:
title: A Survey on Markdown
author:
- John Smith
YAML Frontmatter
You can configure each files via YAML Frontmatter.
See also here
---
baseTemplate: ../latex/template.tex
---
# Hello World
Lorem ipsum dolor sit amet...
Contribute
PRs accepted.
License
MIT (c) 3846masa