Convert a LaTeX or Word document
Import a .tex file, a LaTeX project or a Word document into LibreTimes Markdown, check what conversion changed, and fix what it could not carry over.
A paper or a set of notes that already exists in LaTeX or Word does not need
retyping. Import converts it into LibreTimes Markdown, with its formulae,
theorems, figures and bibliography, and opens the result as a draft for you
to check. This guide imports a document, says what the conversion does with
each part of it, and lists what to check before publishing. The last section
covers Markdown files you already have, published with lt.
Import the file
-
Go to
/new, which New publication on your home page opens, and choose Import. -
Drop the file, or click to choose it:
- a Word document,
.docx; - a single LaTeX file,
.tex; - a LaTeX project as a
.zip, with its figures and its.bibfile, which is the best choice when the paper has either; - a PDF,
.pdf, which is published as the PDF itself rather than converted, because a PDF does not hold the structure to convert.
A file may be up to 50 MB.
- a Word document,
-
If the language or the type could not be read from the file, choose them when asked.
-
Read the list of warnings shown with the draft, if there is one: it names each kind of thing that could not be converted exactly, and how many times.
The draft opens with the title, the abstract, the text and the references filled in. It is private until you publish it.
What the conversion does
Knowing what happened to each part of the document tells you where to look.
| In the source | In the draft |
|---|---|
| The title, from the document's metadata or a leading top-level heading | The work's title, not a heading in the text |
| The abstract | The work's abstract |
| Sections | Headings from ## down; a document with more than four levels has its deepest ones merged, with a warning |
$…$, \[…\], equation, align | Maths, unchanged |
theorem, lemma, definition, proof and the other statement environments; Word paragraph styles with the same names | Statements, such as :::theorem |
| Word styles named Note, Tip, Important, Warning or Caution | Admonitions |
| Figures with captions | ::::figure blocks with their captions and an anchor; the images are uploaded with the work |
\cite with a .bib file in the project; citations from Zotero or Mendeley in Word | Numbered markers such as [1] in the text, and the bibliography as the work's references |
| Tables | Tables; merged cells and cells holding several paragraphs are simplified, with a warning |
| Raw LaTeX or HTML with no Markdown equivalent | Removed, with a warning |
LaTeX's own commands outside maths, such as \emph, \section or
\begin{theorem}, never reach the text: conversion rewrites them into the
dialect once, so the page never has to read LaTeX. That is also why there is
no way to keep them: the dialect takes
no LaTeX outside maths.
Check the draft
Conversion is good, not perfect. Go through the draft in the editor, with Preview open, and look at these in turn:
- Formulae. Look for anything in red. A command from a package KaTeX does
not have, or one of your own
\newcommands, is the usual cause; write it out in full. See Write mathematics. - Statements. Each theorem, lemma or proof should be a block with its own
bold label. If a label shows twice, once from the block and once as text
copied from the source, delete the text. Add
number=to each statement whose number the text cites; see Number your results. - Cross-references.
\ref,\eqrefand\autorefhave no counterpart in a formula or in the text. Give the target an anchor and link to it, as in Link to a part of your own text. - Citations. A citation with no entry in the bibliography is kept as plain text and counted in the warnings. Add the missing entry in the References tab, or cite the source in a footnote.
- Figures. Check that every image arrived. An image in an older format that could not be converted for the web is removed, with a warning; convert it to PNG or SVG yourself and add it again. A TikZ picture can be kept as TikZ: see Draw a diagram with TikZ.
- Tables. Rebuild any table the warnings say was simplified. A table that needs merged cells can be written in raw HTML.
When the preview reads as the original did, with every formula typeset and no
::: line or {…} line shown as text, the draft is ready to publish.
Publish Markdown files with lt
If your text is already Markdown, written by hand or converted elsewhere, you
do not need the site's import. lt, the
LibreTimes command-line client,
publishes Markdown files as works, and on the next run updates them instead
of creating copies.
-
Install
ltand sign in withlt auth login. -
Give each file a frontmatter block with at least a
title, atypeand alanguage, and animport_keythat names it for good:--- title: The mean value theorem type: lecture language: en import_key: analysis-course/03-mean-value is_draft: true --- -
See what would be created or updated, without writing anything:
lt work publish notes/*.md --dry-run -
Publish:
lt work publish notes/*.md --yes
Each file becomes a work, and is_draft: true keeps it a private draft until
you publish it on the site. The text must
already be LibreTimes Markdown: lt publishes what the file says and converts
nothing, so a file that still holds LaTeX outside maths shows it as typed. The
same checks as above apply, in the preview of each draft.
A whole book goes the same way, from a folder of chapter files and one manifest: see Write a book.