serhii.net

In the middle of the desert you can say anything you want

UNLISTED

16 Mar 2024

Adventures in converting obsidian markdown with pandoc to latex for overleaf

Given: my thesis, 230928-1745 Masterarbeit draft.

Citations format is 231010-2007 A new attempt at Zotero and Obsidian. Needs conversion to latex.

Solution: two vim search-and-replaces:

# markdown convert footnotes to AAAAfootnoteAAAB
:%s/\[\^@\([^]]*\)\]/AAAA\1BBBB/g

# latex convert AAAfootnoteAAA to \cite{footnote}
:%s/AAAA\([^B]*\)BBBB/\\cite{\1}/g

For superscripts could’nt find a cleaner solution so:

# markdown
%s/<sup>/STSUP/g
%s/<\/sup>/ENDSUP/g

# latex
%s/STSUP/\\textsuperscript{/g
%s/ENDSUP/}/g

Ugly but God feels better than doing pandoc filters magic (as I attempted: 231225-2240 Glosses markdown magic)

THEN1, to get a correct-ish heading thing:

--top-level-division=part

The h1 title becomes a \part, then the h2s become chapters which is what I want basically.

Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus