Chapter 7 Converting To PreTeXt
Suppose you have materials written in another format, such as MS Word or LaTeX, and would like to convert these to PreTeXt. Alas, there is not a perfect way to make this happen, but what follows is some general advice to get you started. We would love to hear what sort of workflow you would like to see so we can improve this experience.
Section 7.1 Using Pandoc
If you have a number of individual documents that you would like to convert, from pretty much any format, consider trying
Pandoc 1 . This command-line tool can read in lots of different formats and output in lots of different formats. Unfortunately, PreTeXt is not a default output format, so you need to use a custom
writer. Download the this
writer 2 and put it somewhere you will remember.
Section 7.3 By hand
If you have some familiarity with Regex, you can use VS Code's find/replace tools to clean up text that you copied/pasted into your document. For example, if you entered \$(.*?)\$
in the search bar (with the “.*” setting selected), and put <m>$1</m>
in the replace box, you can easily replace all math in your document with the correct syntax.
raw.githubusercontent.com/oscarlevin/pandoc-pretext/master/pretext.lua
github.com/oscarlevin/pandoc-pretext