?

Log in

TeX input mode - Tobin's Lab Notebook [entries|archive|friends|userinfo]
Tobin Fricke's Lab Notebook

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

TeX input mode [Oct. 16th, 2012|11:35 pm]
Tobin Fricke's Lab Notebook
[Tags|, , ]

I've often wished for an easier way to enter unicode math symbols, for example by typing the LaTeX code. Instead the only way I know is to google for the symbol, which has got to be most complicated way of entering a symbol.

But I just found out that EMACS has a "TeX input mode", where you just type TeX symbols and they magically turn into unicode symbols.

For example, if you type

     \forall x \in R, x^2 \geq 0

you get

     ∀ x ∈ R, x² ≥ 0

Awesome! If only I could get this input mode system-wide.

Invoke it with M-x set-input-method and then TeX. I found out about this via this stackoverflow answer.
LinkReply

Comments:
[User Picture]From: gaal
2012-10-19 01:31 am (UTC)
This doesn't directly solve your problem, but I've found the following script, which I occasionally hack a bit, useful on the command line for all sorts of things. Piping output from it / something similar / something analogous but TeXy into xsel might get you part of the way?

#!/usr/bin/perl -CA

# Look up Unicode characters, code points, and names
# Originally by Larry Wall.


binmode STDOUT, ":utf8";
my $pat = "@ARGV";
my @pats = map { my $r = qr/$_/i; $r } @ARGV;
if (ord $pat > 256) {
    $pat = sprintf("%04X", ord $pat);
    print "That's $pat...\n";
}
elsif (ord $pat > 128) {        # arg in sneaky UTF-8
    $pat = sprintf("%04X", unpack("U0U",$pat));
    print "That's $pat...\n";
}

my @names = split /^/, do 'unicore/Name.pl';
for my $n (@names) {
    if ($n =~ /$pat/io) {
        printname($n);
    } else {
        if (@pats == map { $n =~ /$_/ } @pats) {
            printname($n);
        }
    }
}

sub printname {
    local $_ = shift;
    chomp;
    printf "$_\t[%s]\n", chr hex $_;
}



(Is there no more raw input to lj? I bet this is going to suck...)
(Reply) (Thread)