Create a gist now

Instantly share code, notes, and snippets.

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