emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: n.goaziou@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: Re: [bug][ox-latex] Captions in equations
Date: Sat, 25 Jan 2014 15:35:09 +0100	[thread overview]
Message-ID: <877g9ojfj6.fsf@gmx.us> (raw)
In-Reply-To: <87r483zrm8.fsf@gmail.com> (Nicolas Goaziou's message of "Sun, 19 Jan 2014 20:41:35 +0100")

[-- Attachment #1: Type: text/plain, Size: 1280 bytes --]

Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

>> OK.  I can prepare a patch.
>
> Great. Thank you.
>
>> In LaTeX the floating would be kind of odd, I think.  At the very
>> least math floats shouldn't be Figure or Tables (IMO); unfortunately
>> the Internets seem to suggest that you usually create additional
>> floats via packages such as newfloat of "caption".  HTML should also
>> be considered...
>
> IIRC there is a "caption" package that can add captions to objects
> without making them floats. We could support it, but without requiring
> that package by default.

Attached is a simple patch that works by silently drops the caption in
a sneaky way.  I didn't experience any problems when testing it, but
you might have more insights as to whether this approach have latent
issues.

I think we had the discussion with leaving out packages earlier, when
discussing things like wrap-float etc.  As I recall, the consensus was
to include the necessary packages.  Thus, I think solution (iii) would
require adding caption to the default package alist.  Caption is a
package that's very good, so I wouldn't mind it.  But, I'm still not
convinced that non-floating caption for equation is the correct
behavior.

–Rasmus

-- 
ツ

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Drop-caption-in-ox-latex-math-tables.patch --]
[-- Type: text/x-diff, Size: 1445 bytes --]

From 3470c44a7ef48a92848c39741b25e7c7cf0dddf8 Mon Sep 17 00:00:00 2001
From: Rasmus <w530@pank.eu>
Date: Sat, 25 Jan 2014 15:27:30 +0100
Subject: [PATCH] Drop caption in ox-latex math-tables

* ox-latex.el (org-latex--math-table): Drop captions silently.
---
 lisp/ox-latex.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 4522c6b..4f961cb 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2577,7 +2577,10 @@ used as a communication channel.
 
 This function assumes TABLE has `org' as its `:type' property and
 `inline-math' or `math' as its `:mode' attribute.."
-  (let* ((caption (org-latex--caption/label-string table info))
+  (let* (;; Silently drop captions as they are not supported in
+	 ;; math-mode.
+	 (caption (org-latex--caption/label-string
+		   (org-element-put-property table :caption nil) info))
 	 (attr (org-export-read-attribute :attr_latex table))
 	 (inlinep (equal (plist-get attr :mode) "inline-math"))
 	 (env (or (plist-get attr :environment)
@@ -2651,8 +2654,7 @@ This function assumes TABLE has `org' as its `:type' property and
 				'(0 nil))
 			  (funcall same-mode-p prev))
 		(setq cluster-beg prev))
-	      (and (or (org-element-property :caption cluster-beg)
-		       (org-element-property :name cluster-beg))
+	      (and (org-element-property :name cluster-beg)
 		   "\n\\end{equation}")))
 	   (t "\\]")))))
 
-- 
1.8.5.3


  parent reply	other threads:[~2014-01-25 14:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-18 19:36 [bug][ox-latex] Captions in equations Rasmus
2014-01-19  3:23 ` Vladimir Lomov
2014-01-19 14:19   ` Rasmus
2014-01-20  0:51     ` Vladimir Lomov
2014-01-20 10:41       ` Rasmus
2014-01-19  9:36 ` Nicolas Goaziou
2014-01-19 14:14   ` Rasmus
2014-01-19 19:41     ` Nicolas Goaziou
2014-01-20 10:13       ` Rasmus
2014-01-25 14:35       ` Rasmus [this message]
2014-01-25 22:30         ` 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=877g9ojfj6.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /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).