Last active
December 22, 2018 04:44
-
-
Save MilesCranmer/6a192f15a7c6e67c5ffc26e2b60baede to your computer and use it in GitHub Desktop.
Remove latex code so can feed paper into grammarly.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Delete up to begin{document}, and from end{document} to before the bibliography. | |
:%s/\\cite{[a-zA-Z0-9_]\+}/REF/g | |
:%s/\\citealt{[a-zA-Z0-9_]\+}/REF/g | |
:%s/\\cref{[a-zA-Z0-9_:]\+}/REF/g | |
:%s/\\caption{//g | |
:%s/\$\$.\{-}\$\$/REF/g | |
:%s/\$.\{-}\$/REF/g | |
:%s/\\[a-zA-Z_]\+{.*}/ /g | |
:%s/\\[a-zA-Z_]\+/ /g | |
:%s/\\\\//g | |
:%s/%.*//g | |
:%s/{/ /g | |
:%s/}/ /g | |
" Run the following several times to remove line breaks (only single line breaks) | |
:%s/^\(.\+\)\n\(.\+\)\n/\1 \2\r/g | |
" Run the following several times | |
:%s/ / /g | |
" Delete remaining double blank lines | |
:%s/\n\n\n/\r\r/g |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment