emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Emphasis etc. in #+CAPTION:
@ 2010-03-28 19:14 Thomas S. Dye
  2010-03-29  1:14 ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas S. Dye @ 2010-03-28 19:14 UTC (permalink / raw)
  To: emacs-orgmode list


[-- Attachment #1.1: Type: text/plain, Size: 1134 bytes --]

Aloha all,

I see in the Org Manual that:

> You can make words *bold*, /italic/, _underlined_, =code= and  
> ~verbatim~, and, if you must, ‘+strike-through+’.  Text in the  
> code and verbatim string is not processed for Org-mode specific  
> syntax, it is exported verbatim.

So a caption like this doesn't export italicized a, b, c, and d  
(presumably because this is a code string):

> #+CAPTION: Pumice collected from pāhoehoe flows at Manini`ōwali: / 
> a/, pieces that sink in fresh water; /b/, pieces without obvious  
> crystallization or coating (Category A); /c/, pieces with obvious  
> crystallization but no coating (Category B); /d/, pieces with  
> obvious coating (Category C).  The scale is 1 cm.

Is there a common work-around for this that will produce correct LaTeX  
and HTML using the org-mode exporters?

And, this is just a question and not a feature request or a request  
for changes to org-mode, would it be hard to change org-mode's  
behavior so that markup like /a/ in the #+CAPTION: string exports  
correctly marked-up text to LaTeX and HTML?

All the best,
Tom


[-- Attachment #1.2: Type: text/html, Size: 1663 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emphasis etc. in #+CAPTION:
  2010-03-28 19:14 Emphasis etc. in #+CAPTION: Thomas S. Dye
@ 2010-03-29  1:14 ` Nick Dokos
  2010-03-29  4:52   ` Thomas S. Dye
  2010-03-29 12:20   ` Carsten Dominik
  0 siblings, 2 replies; 4+ messages in thread
From: Nick Dokos @ 2010-03-29  1:14 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: nicholas.dokos, emacs-orgmode list

Thomas S. Dye <tsd@tsdye.com> wrote:

> I see in the Org Manual that:
> 
>     You can make words *bold*, /italic/, _underlined_, =code= and
>     ~verbatim~, and, if you must, ‘+strike-through+’. Text in the code
>     and verbatim string is not processed for Org-mode specific syntax,
>     it is exported verbatim.
> 
> So a caption like this doesn't export italicized a, b, c, and d
> (presumably because this is a code string):

Hi Tom,

IIUC, it's not because it's a code string but simply because the caption
is not processed for emphasis (or anything else for that matter - see
below). I think the above text in the manual covers the generic case,
but captions were probably added afterwards and they didn't get the
emphasis treatment.

> 
>     #+CAPTION: Pumice collected from pāhoehoe flows at Manini`ōwali:
>     /a/, pieces that sink in fresh water; /b/, pieces without obvious
>     crystallization or coating (Category A); /c/, pieces with obvious
>     crystallization but no coating (Category B); /d/, pieces with
>     obvious coating (Category C).  The scale is 1 cm.
> 
> Is there a common work-around for this that will produce correct LaTeX
> and HTML using the org-mode exporters?
> 

Can't think of any workaround within org-mode. Post-processing the
output to replace /a/ with \emph{a} for LaTeX and <i>a</i> for HTML,
perhaps restricted to captions, seems possible (but ugly).

> And, this is just a question and not a feature request or a request
> for changes to org-mode, would it be hard to change org-mode's
> behavior so that markup like /a/ in the #+CAPTION: string exports
> correctly marked-up text to LaTeX and HTML?
> 

I think this is the way it works currently:

in org-exp.el:org-export-attach-captions-and-attributes() sets  text properties
on the following line (the first line of a table or the line containing a link)
as follows:

        ...
	(add-text-properties (point-at-bol) end
			     (list 'org-caption cap
				   'org-attributes attr
				   'org-label label))

The various exporters then retrieve the caption with something like the
following code (this is one of the three calls in org-latex.el; the
other calls in this exporter, and the other exporters as well, are
similar):

    (let*
        ...
        (caption (org-find-text-property-in-string 'org-caption raw-path))
        ...

This just gets the value of the given text property without further
elaboration. So I'd guess it's possible to change these calls so that
these values are passed through various filters (emphasis is one of
them, but maybe there are others?) before the exporters get them, but it
is not done today.

But maybe I'm full of it, and somebody will come up with a better idea.

Cheers,
Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emphasis etc. in #+CAPTION:
  2010-03-29  1:14 ` Nick Dokos
@ 2010-03-29  4:52   ` Thomas S. Dye
  2010-03-29 12:20   ` Carsten Dominik
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas S. Dye @ 2010-03-29  4:52 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode list


On Mar 28, 2010, at 3:14 PM, Nick Dokos wrote:

> Thomas S. Dye <tsd@tsdye.com> wrote:
>
>> I see in the Org Manual that:
>>
>>    You can make words *bold*, /italic/, _underlined_, =code= and
>>    ~verbatim~, and, if you must, ‘+strike-through+’. Text in the  
>> code
>>    and verbatim string is not processed for Org-mode specific syntax,
>>    it is exported verbatim.
>>
>> So a caption like this doesn't export italicized a, b, c, and d
>> (presumably because this is a code string):
>
> Hi Tom,
>
> IIUC, it's not because it's a code string but simply because the  
> caption
> is not processed for emphasis (or anything else for that matter - see
> below). I think the above text in the manual covers the generic case,
> but captions were probably added afterwards and they didn't get the
> emphasis treatment.
>
>>
>>    #+CAPTION: Pumice collected from pāhoehoe flows at Manini`ōwali:
>>    /a/, pieces that sink in fresh water; /b/, pieces without obvious
>>    crystallization or coating (Category A); /c/, pieces with obvious
>>    crystallization but no coating (Category B); /d/, pieces with
>>    obvious coating (Category C).  The scale is 1 cm.
>>
>> Is there a common work-around for this that will produce correct  
>> LaTeX
>> and HTML using the org-mode exporters?
>>
>
> Can't think of any workaround within org-mode. Post-processing the
> output to replace /a/ with \emph{a} for LaTeX and <i>a</i> for HTML,
> perhaps restricted to captions, seems possible (but ugly).
>
>> And, this is just a question and not a feature request or a request
>> for changes to org-mode, would it be hard to change org-mode's
>> behavior so that markup like /a/ in the #+CAPTION: string exports
>> correctly marked-up text to LaTeX and HTML?
>>
>
> I think this is the way it works currently:
>
> in org-exp.el:org-export-attach-captions-and-attributes() sets  text  
> properties
> on the following line (the first line of a table or the line  
> containing a link)
> as follows:
>
>        ...
> 	(add-text-properties (point-at-bol) end
> 			     (list 'org-caption cap
> 				   'org-attributes attr
> 				   'org-label label))
>
> The various exporters then retrieve the caption with something like  
> the
> following code (this is one of the three calls in org-latex.el; the
> other calls in this exporter, and the other exporters as well, are
> similar):
>
>    (let*
>        ...
>        (caption (org-find-text-property-in-string 'org-caption raw- 
> path))
>        ...
>
> This just gets the value of the given text property without further
> elaboration. So I'd guess it's possible to change these calls so that
> these values are passed through various filters (emphasis is one of
> them, but maybe there are others?) before the exporters get them,  
> but it
> is not done today.
>
> But maybe I'm full of it, and somebody will come up with a better  
> idea.
>
> Cheers,
> Nick
>

Thanks Nick,

That seems to work.  I'll test it a bit to make certain, but right now  
the italics in the legend look very good in place of /a/, etc., so  
there is some progress.

All the best,
Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Emphasis etc. in #+CAPTION:
  2010-03-29  1:14 ` Nick Dokos
  2010-03-29  4:52   ` Thomas S. Dye
@ 2010-03-29 12:20   ` Carsten Dominik
  1 sibling, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2010-03-29 12:20 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode list


On Mar 29, 2010, at 3:14 AM, Nick Dokos wrote:

> Thomas S. Dye <tsd@tsdye.com> wrote:
>
>> I see in the Org Manual that:
>>
>>    You can make words *bold*, /italic/, _underlined_, =code= and
>>    ~verbatim~, and, if you must, ‘+strike-through+’. Text in the  
>> code
>>    and verbatim string is not processed for Org-mode specific syntax,
>>    it is exported verbatim.
>>
>> So a caption like this doesn't export italicized a, b, c, and d
>> (presumably because this is a code string):
>
> Hi Tom,
>
> IIUC, it's not because it's a code string but simply because the  
> caption
> is not processed for emphasis (or anything else for that matter - see
> below). I think the above text in the manual covers the generic case,
> but captions were probably added afterwards and they didn't get the
> emphasis treatment.
>
>>
>>    #+CAPTION: Pumice collected from pāhoehoe flows at Manini`ōwali:
>>    /a/, pieces that sink in fresh water; /b/, pieces without obvious
>>    crystallization or coating (Category A); /c/, pieces with obvious
>>    crystallization but no coating (Category B); /d/, pieces with
>>    obvious coating (Category C).  The scale is 1 cm.
>>
>> Is there a common work-around for this that will produce correct  
>> LaTeX
>> and HTML using the org-mode exporters?
>>
>
> Can't think of any workaround within org-mode. Post-processing the
> output to replace /a/ with \emph{a} for LaTeX and <i>a</i> for HTML,
> perhaps restricted to captions, seems possible (but ugly).
>
>> And, this is just a question and not a feature request or a request
>> for changes to org-mode, would it be hard to change org-mode's
>> behavior so that markup like /a/ in the #+CAPTION: string exports
>> correctly marked-up text to LaTeX and HTML?
>>
>
> I think this is the way it works currently:
>
> in org-exp.el:org-export-attach-captions-and-attributes() sets  text  
> properties
> on the following line (the first line of a table or the line  
> containing a link)
> as follows:
>
>        ...
> 	(add-text-properties (point-at-bol) end
> 			     (list 'org-caption cap
> 				   'org-attributes attr
> 				   'org-label label))
>
> The various exporters then retrieve the caption with something like  
> the
> following code (this is one of the three calls in org-latex.el; the
> other calls in this exporter, and the other exporters as well, are
> similar):
>
>    (let*
>        ...
>        (caption (org-find-text-property-in-string 'org-caption raw- 
> path))
>        ...
>
> This just gets the value of the given text property without further
> elaboration. So I'd guess it's possible to change these calls so that
> these values are passed through various filters (emphasis is one of
> them, but maybe there are others?) before the exporters get them,  
> but it
> is not done today.
>
> But maybe I'm full of it, and somebody will come up with a better  
> idea.

Full of good analysis you are.  May the force be with you.

Well, it is just like Nick says.  I am grabbing the caption
early, before all that processing happens unfortunately.

And, unfortunately, the Org exporters are not modular enough
to easily fix this entirely.

What I *have* done now is implement basic processing, like emphasis.
But I am afraid that footnotes and link formatting, for example, do
not work.

Hope that make it good enough.

- Carsten

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-29 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-28 19:14 Emphasis etc. in #+CAPTION: Thomas S. Dye
2010-03-29  1:14 ` Nick Dokos
2010-03-29  4:52   ` Thomas S. Dye
2010-03-29 12:20   ` Carsten Dominik

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).