From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Help with new exporter
Date: Fri, 12 Jul 2013 16:12:33 +0200 [thread overview]
Message-ID: <871u73eujy.fsf@gmx.us> (raw)
In-Reply-To: 87ip0f520a.fsf@gmail.com
Nick. Robert,
Disclaimer: I didn't follow this thread closely. . .
Nick Dokos <ndokos@gmail.com> writes:
>> (sorry, this should've gone to the list the first time)
>>
>> Hi John,
>>
>> sorry, I can't help you with the filters.
>>
>> On the other hand, I don't see any reason why you gt whose square brackets.
>>
>> I tried different versions of org-mode, and never got *empty* square
>> brackets.
>
> That was my experience as well...
If one desires empty squares why not use [\mbox{}]? In LaTeX terms I
think [\mbox{}] is equivalent or almost equivalent o [], and to Org
they are different. . .
Otherwise add a (regexp) filter to
org-export-filter-final-output-functions inserting the missing []s.
Here's an example of a filer I use. Notice that ox keeps everything
in a string and in property lists (← just an indexed dictionary).
#+BEGIN_SRC emacs-lisp
(defun org-latex-filter-nobreaks-double-space (text backend info)
"Tries to export \"S1. S2\" as \"S1.~S2\",
while letting \"S1. S2\" be exported without tilde"
(when (org-export-derived-backend-p backend 'latex)
(replace-regexp-in-string "\\(\\. \\)\\{1\\}\\([^ ]\\)" ".~\\2" text)))
(add-to-list 'org-export-filter-final-output-functions
'org-latex-filter-nobreaks-double-space)
#+END_SRC
(This may not be a great example as one probably should implement it
at org-export-before-processing-hook and insert NO-BREAK SPACEs and
tell LaTeX how to handle these).
> Rasmus's derived backend idea might work perhaps - I for one wouldn't
> know how to implement it at this point. But trying to edit artifacts out
> after the backend is more or less finished seems to me to be a fruitless
> approach.
I'm not claiming it's easy (Lisp can be pretty daunting, yes?), but
it's definitely doable.
1. You start by thinking about how you want your layout to be. This
is particularly the case if you don't want to (mis)use the *s for
everything. For instance the Org file Robert posted had a lot of
repeated things that might as well be handeled by the computer.
2. Then you write functions that translate the elements that you want
to work differently into LaTeX code and put 'em into
the :translate-alist. All functions that you're not adding will
come from the LaTeX class.
Here's some documentations (somewhat heavy)
http://orgmode.org/manual/Adding-export-back_002dends.html
http://orgmode.org/worg/dev/org-export-reference.html
and an not-so-enlightening example
http://orgmode.org/worg/exporters/filter-markup.html
Further: I'm working on a section for the manual on ways of adding new
backends, but alas I must spend my time on other activities at the
moment. Of course, the present discussion of implementing an exam
class is a much more interesting example than the cookbook I'm working
on at the moment :)
–Rasmus
--
Send from my Emacs
next prev parent reply other threads:[~2013-07-12 14:12 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <51DFEC7B.7050504@mpip-mainz.mpg.de>
2013-07-12 11:47 ` Help with new exporter Robert Klein
2013-07-12 13:41 ` Nick Dokos
2013-07-12 14:12 ` Rasmus [this message]
2013-07-12 14:59 ` Nick Dokos
2013-07-12 15:05 ` John Rakestraw
2013-07-12 15:27 ` Rasmus
2013-07-12 15:47 ` John Rakestraw
2013-07-12 15:28 ` Nick Dokos
2013-07-12 15:49 ` John Rakestraw
2013-07-12 16:20 ` Nick Dokos
2013-07-10 16:32 John Rakestraw
2013-07-10 16:58 ` Robert Klein
2013-07-10 17:27 ` John Rakestraw
2013-07-10 19:37 ` Robert Klein
2013-07-10 20:46 ` John Rakestraw
2013-07-10 21:04 ` John Rakestraw
2013-07-11 4:04 ` Charles Berry
2013-07-11 5:22 ` Robert Klein
2013-07-11 15:15 ` John Rakestraw
2013-07-11 23:05 ` John Rakestraw
2013-07-12 3:00 ` Thomas S. Dye
2013-07-10 19:56 ` Rasmus
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871u73eujy.fsf@gmx.us \
--to=rasmus@gmx.us \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.