Skip to content

Instantly share code, notes, and snippets.

@schoettl
Created November 7, 2016 20:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
#!/bin/bash
# utf82latex - Convert UTF-8 encoded input to ASCII encoded LaTeX
# warning:
# does not work if input contains double quotes (") or back slashes (\)
# usage:
# in Vim: :%!utf82latex
# in shell: xclip -o -selection c | utf82latex | xclip -selection c
# in shell: utf82latex <<EOF | xclip -selection c
# see also:
# clipboard-utf82latex - short for clipboard usage example above
while read -r line; do
R -q --vanilla <<EOF 2>&1 >/dev/null
library(tools)
message(encoded_text_to_latex("$line", "UTF-8"))
EOF
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment