pyfan.util.rmd.mattexmd
¶
Convert matlab MLX files to MD and RMD files
The pyfan.util.rmd.mattexmd
generates md and rmd file from tex file converted from matlab mlx.
Use matlab’s own functions to export a MLX file to tex. Clean some elements of this text file, use pandoc to convert to MD. Then resave the md file as a RMD file by combining yml info from a preamble.yml file that is in the folder.
Includes method fp_md2rmd()
, fp_mlxtex2md()
Module Contents¶
Functions¶
|
Generate RMD from MD with YAML Header |
|
Edit and replace MLX based tex and convert to markdown |
-
pyfan.util.rmd.mattexmd.
fp_md2rmd
(spt_root='C:/Users/fan/Math4Econ/', ls_srt_subfolders=['calconevar/'], snm_folder_yml='preamble.yml', st_yml_file_key='file', st_rglob_md='*.md', verbose=False)[source]¶ Generate RMD from MD with YAML Header
In each folder, there is a prior preamble.yaml for all files in folder. There are md files generated by the fp_mlxtex2md function, this file stacks the yaml header on top of the md after searching for the yml header with the no suffix file name of the md file, which is the search key in the yaml.
- Parameters
- spt_rootstring
The root folder
- ls_srt_subfolders
list
ofstr
List of subfolders to search in
- snm_folder_yml: string
name of the file containing all rmd yaml header under spt_root
- st_yml_file_key: string
the key in the yaml header snm_folder_yml with file names no suffix
- st_rglob_mdstring
md files search string rglob
- verbosebool
print extra
- Returns
- None
nothing is returned, mlx generated tex files updates, and pandoc md generated
Examples
>>> fp_md2rmd(spt_root="C:/Users/fan/M4Econ/amto/", ... ls_srt_subfolders=['array/'], ... snm_folder_yml='preamble.yml', ... st_yml_file_key='file', ... st_rglob_md='fs_slicing.md', verbose=False)
-
pyfan.util.rmd.mattexmd.
fp_mlxtex2md
(spt_root='C:/Users/fan/Math4Econ/', ls_srt_subfolders=['calconevar/'], st_rglob_tex='*.tex', verbose=False)[source]¶ Edit and replace MLX based tex and convert to markdown
Several mlx auto converted tex elements need to be constructed, otherwise the md file would not work. Importantly, convert how images are stored to aggregate subfolder. Which relies on movefiles.py to generate to put in the image folder structure as specified here which is under an aggregate img folder.
- Parameters
- Returns
- None
nothing is returned, mlx generated tex files updates, and pandoc md generated
Examples
>>> fp_mlxtex2md(spt_root='C:/Users/fan/Math4Econ/matrix_application/', ... ls_srt_subfolders=None, st_rglob_tex='twogoods.tex', verbose=True) >>> fp_mlxtex2md(spt_root='C:/Users/fan/M4Econ/amto/array/', ... ls_srt_subfolders=None, st_rglob_tex='fs_slicing.tex', verbose=True)