Skip to content

Instantly share code, notes, and snippets.

@pedroarthur
Created September 9, 2019 16:35
Show Gist options
  • Save pedroarthur/886939465c2e0faa5889712ee9606ed5 to your computer and use it in GitHub Desktop.
Save pedroarthur/886939465c2e0faa5889712ee9606ed5 to your computer and use it in GitHub Desktop.
The simplest LaTeX syntax remover
sed \
-r \
-e 's/^%.*$//' \
-e 's/\\emph\{([^{]+)\}/\1/g' \
-e 's/\\ref\{([^{]+)\}/\1/g' \
-e 's/\\cite\{([^{]+)\} //g' \
-e 's/ \\cite\{([^{]+)\}//g' \
-e 's/\$.+\$/formula/' \
-e 's/~/ /' \
-e '/\\begin\{figure\}/,/\\end\{figure\}/d' \
"${@}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment