emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Inserting LaTex expressions using a filter fails
Date: Tue, 05 Jan 2021 17:31:43 -0500	[thread overview]
Message-ID: <87im8brp68.fsf@alphaville.usersys.redhat.com> (raw)
In-Reply-To: 875z4bcjyz.fsf@gaheris.vdwege.eu

Mart van de Wege <mvdwege@gmail.com> writes:

> I'm trying to replace U+00BD in an org buffer with \sfrac{1}{2} during
> export to LaTex, and obviously I'm doing something wrong, or I don't
> understand the documentation.
>
> I use the following code to set up the filter:
>
> #+BIND: org-export-filter-item-functions (latex-replace-half)
> #+BEGIN_SRC emacs-lisp :exports results :results none
>
>   (defun latex-replace-half (text backend info)
>     (when (org-export-derived-backend-p backend 'latex)
>       (replace-regexp-in-string  "½" "\\sfrac{1}{2}" text)))
> #+END_SRC
>

Try

        (replace-regexp-in-string  "½" "\\\\sfrac{1}{2}" text)))


> Down the line in the document there is this example line:
>
>    - 1½ eetl. gehakte peterselie, ½ eetl. azijn, 4 eetl. olie
>
> Or this one:
>
>    Laat de gewassen en gebroken vermicelli met de foelie ½ uur in de
>
> But neither of them get replaced. I tried plain-text, item, and
> final-output filters.
>

"item" will only deal with the first one: an item in a list. You'll need
to use "final-output" probably.

> What am I missing?
>
> Mart

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler



  parent reply	other threads:[~2021-01-05 22:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 18:33 Inserting LaTex expressions using a filter fails Mart van de Wege
2021-01-05 21:58 ` Juan Manuel Macías
2021-01-06  7:50   ` Mart van de Wege
2021-01-06 11:51     ` Juan Manuel Macías
2021-01-06 12:00       ` Mart van de Wege
2021-01-06 12:24         ` Juan Manuel Macías
2021-01-06 15:17           ` Mart van de Wege
2021-01-06 15:58             ` Juan Manuel Macías
2021-01-06 16:00               ` Mart van de Wege
2021-01-05 22:31 ` Nick Dokos [this message]
2021-01-06  7:50   ` Mart van de Wege
2021-01-06 15:48 ` Maxim Nikulin
2021-01-06 17:56   ` Mart van de Wege

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87im8brp68.fsf@alphaville.usersys.redhat.com \
    --to=ndokos@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).