[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to translate LaTeX into UTF-8 in Elisp?
From: |
Marcin Borkowski |
Subject: |
Re: How to translate LaTeX into UTF-8 in Elisp? |
Date: |
Tue, 04 Jul 2017 07:57:53 +0200 |
User-agent: |
mu4e 0.9.19; emacs 26.0.50 |
On 2017-07-03, at 10:37, Teemu Likonen <tlikonen@iki.fi> wrote:
> Marcin Borkowski [2017-07-03 06:56:36+02] wrote:
>
>> On 2016-12-08, at 18:04, Marcin Borkowski <mbork@mbork.pl> wrote:
>>> I have a string with embedded sequences like "\'e" or "\H{o}". The
>>> Emacs TeX input method knows how to convert them into "é" or "ő" (when
>>> typing, of course). Is there a way to use that to perform similar
>>> conversions in a string?
>
>> I'm revisiting this old thread now.
>
>> It is a horrible hack, but it should work. Any better ideas?
>
> I would filter buffer's content through recode command.
>
> [Highlight a region.]
>
> C-u M-x shell-command-on-region RET recode tex.. RET
>
> You wanted to do this for a string so we can write a function that uses
> a temporary buffer and returns its content as a string. Here is a quick
> example:
>
> (defun convert-from-latex (string)
> (with-temp-buffer
> (insert string)
> (call-process-region (point-min) (point-max)
> "recode" t t nil "tex..")
> (buffer-substring-no-properties (point-min) (point-max))))
Thanks, I didn't know about recode. But it doesn't work all that well:
c{\c c}c does not remove braces, for instance, and what's even worse, it
apparently doesn't know about \k.
But thanks anyway, this is a good thing to remember, even though in my
case I perceive it as even more hackish than my approach (I'd prefer
Emacs to do the job, not an external utility).
Best,
--
Marcin Borkowski
- Re: How to translate LaTeX into UTF-8 in Elisp?, Marcin Borkowski, 2017/07/03
- Re: How to translate LaTeX into UTF-8 in Elisp?, Emanuel Berg, 2017/07/03
- Re: How to translate LaTeX into UTF-8 in Elisp?, Marcin Borkowski, 2017/07/03
- Re: How to translate LaTeX into UTF-8 in Elisp?, Emanuel Berg, 2017/07/03
- Re: How to translate LaTeX into UTF-8 in Elisp?, Marcin Borkowski, 2017/07/03
- Re: How to translate LaTeX into UTF-8 in Elisp?, Emanuel Berg, 2017/07/03
- Re: How to translate LaTeX into UTF-8 in Elisp?, Héctor Lahoz, 2017/07/04
Re: How to translate LaTeX into UTF-8 in Elisp?, Teemu Likonen, 2017/07/03
- Re: How to translate LaTeX into UTF-8 in Elisp?,
Marcin Borkowski <=
- Re: How to translate LaTeX into UTF-8 in Elisp?, Udyant Wig, 2017/07/04
- Re: How to translate LaTeX into UTF-8 in Elisp?, Thien-Thi Nguyen, 2017/07/04
- Re: How to translate LaTeX into UTF-8 in Elisp?, Emanuel Berg, 2017/07/04
- Re: How to translate LaTeX into UTF-8 in Elisp?, Udyant Wig, 2017/07/05
- Re: How to translate LaTeX into UTF-8 in Elisp?, Emanuel Berg, 2017/07/05
- Re: How to translate LaTeX into UTF-8 in Elisp?, Thien-Thi Nguyen, 2017/07/13
- Re: How to translate LaTeX into UTF-8 in Elisp?, Udyant Wig, 2017/07/13
Re: How to translate LaTeX into UTF-8 in Elisp?, Joost Kremers, 2017/07/04