emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: [patch][ox-latex] context-aware subscript
Date: Sat, 31 Aug 2013 10:11:57 +0200	[thread overview]
Message-ID: <87k3j2nusy.fsf@gmail.com> (raw)
In-Reply-To: <87vc2oojnx.fsf@gmx.us> (rasmus@gmx.us's message of "Thu, 29 Aug 2013 12:50:26 +0200")

Hello,

Rasmus <rasmus@gmx.us> writes:

> I've just enclosed a quick patch (as in doesn't contain proper commit
> msg), but it's basically the previous patch minus the removal of \text
> in math plus some quick checks towards potential nasty filters.
>
> It works with the following test file, but let me know about more
> hair-pulling test cases, and/or filters.

Thanks for the patch. Here are a few comments.

> filter replace all   & $\beta_{\text{}}$   & \texttimes{}$_{\text{}}$   \\

We might be able to handle it more nicely, i.e. by skipping \text when
contents are empty.

> +	(prev (org-export-get-previous-element entity info))
> +	(next (org-export-get-next-element entity info))
> +	(no-post-blanks-p (= (or (org-element-property :post-blank entity) 1) 0))
> +	(no-pre-blanks-p (= (or (org-element-property :post-blank
> +						   (org-export-get-previous-element
> +						    entity info)) 1) 0))

A nil :post-blank property means 0, not 1. Also, you don't re-use PREV
in NO-PRE-BLANKS-P.

> +	(scripts '(subscript superscript)))
> +    (if (not (org-element-property :latex-math-p entity)) ent
> +      (concat
> +       (if (and no-pre-blanks-p
> +		(memq (org-element-type prev) scripts)
> +		(not (eq (org-export-data prev info) "")))
> +	   "" "$")
> +       ent
> +       (if (and no-post-blanks-p
> +		(memq (org-element-type next) scripts)
> +		(not (eq (org-export-data next info) "")))
> +	   "" "$")))))

I think this is problematic: if an entity needs to export both the
previous and the next object, what happens when we have two consecutive
entities? An infloop?

This is the difficult part of the problem.

> +		    (not (org-element-property :latex-math-p prev))

Sure, but I'd rather make a stricter check and also test PREV's type.


Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2013-08-31  8:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-18  1:29 [patch][ox-latex] context-aware subscript Rasmus
2013-08-19  8:26 ` Nicolas Goaziou
2013-08-28 11:55   ` Rasmus
2013-08-28 13:38     ` Nicolas Goaziou
2013-08-28 13:46       ` Rasmus
2013-08-28 19:21         ` Nicolas Goaziou
2013-08-29 10:50           ` Rasmus
2013-08-31  8:11             ` Nicolas Goaziou [this message]
2013-08-31 13:59               ` Rasmus
2013-08-31 14:46                 ` Nicolas Goaziou

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=87k3j2nusy.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /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).