CLAWRIM Wiki

The Computational Lab for Advanced Water Resources Informatics and Modeling

User Tools

Site Tools


howtos:how_to_convert_latex_to_qmd

This is an old revision of the document!


How to convert LaTeX to QMD

# convert tex to tempory qmd
pandoc main.tex --from=latex --to=markdown+tex_math_dollars+raw_tex --wrap=none -o main.tmp
 
# extract citations
grep -oE '@\{[^}]+\}|@[A-Za-z0-9_:/.-]+' main.tmp |
  sed 's/[@{}]//g; s/^/\\citation{/; s/$/}/' |
  sort -u > refs.keys
 
# extract cited bib entries only
bibtool -x refs.keys -i full.bib -o refs.bib
 
# add yaml header
(cat<<'EOT'
---
title: "TITLE"
format:
  html:
    toc: true
    number-sections: true
  pdf:
    toc: true
    number-sections: true
bibliography: refs.bib
---
 
EOT
cat main.tmp) > main.qmd
 
# delete tmp file
rm main.tmp
 
# render
quarto render main.qmd --to pdf
howtos/how_to_convert_latex_to_qmd.1772288094.txt.gz · Last modified: by hcho

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki