emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* LaTeX export: inline markup underscore problem
@ 2011-04-09 16:55 Mauro Rovezzi
  2011-04-10 19:36 ` Thomas S. Dye
  0 siblings, 1 reply; 10+ messages in thread
From: Mauro Rovezzi @ 2011-04-09 16:55 UTC (permalink / raw)
  To: emacs-orgmode

Dear all,

I implemented the inline markup for latex export as suggested on Worg
by Tom Dye:

http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10_3

and I have a big problem in exporting references with underscores.
Example: [[latex:cite][some_thing]] is rendered by the latex exporter
as \cite{some\_thing} that is bad because will result in a broken
reference. Could you help me in defining a more clever
org-add-link-type?

Thanks,
Mauro

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

* Re: LaTeX export: inline markup underscore problem
  2011-04-09 16:55 LaTeX export: inline markup underscore problem Mauro Rovezzi
@ 2011-04-10 19:36 ` Thomas S. Dye
  2011-04-10 20:08   ` Nick Dokos
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas S. Dye @ 2011-04-10 19:36 UTC (permalink / raw)
  To: Mauro Rovezzi; +Cc: emacs-orgmode

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

Aloha Mauro,

Please see

http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-17_2

All the best,
Tom

On Apr 9, 2011, at 6:55 AM, Mauro Rovezzi wrote:

> Dear all,
>
> I implemented the inline markup for latex export as suggested on Worg
> by Tom Dye:
>
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10_3
>
> and I have a big problem in exporting references with underscores.
> Example: [[latex:cite][some_thing]] is rendered by the latex exporter
> as \cite{some\_thing} that is bad because will result in a broken
> reference. Could you help me in defining a more clever
> org-add-link-type?
>
> Thanks,
> Mauro
>


[-- Attachment #2: Type: text/html, Size: 1257 bytes --]

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

* Re: LaTeX export: inline markup underscore problem
  2011-04-10 19:36 ` Thomas S. Dye
@ 2011-04-10 20:08   ` Nick Dokos
  2011-04-10 20:45     ` Thomas S. Dye
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2011-04-10 20:08 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Mauro Rovezzi, emacs-orgmode, nicholas.dokos

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

> Aloha Mauro,
> 
> Please see
> 
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-17_2
> 

Excuse the intrusion, but I don't see anything in there that looks like
a solution to the OP's problem (the undesired quoting of the underscore
when exporting the org file to LaTeX): what am I missing?

I was going to suggest that life would be much easier for the OP if he
could change all underscores to some other character in his bibliography
(I often see colons and minus signs used e.g.) That may or may not be
possible of course, but if it is possible, it would be the simplest
solution: the treatment of _ in the LaTeX exporter is often the source
of frustration. That is not the fault of the exporter of course: TeX
makes it very complicated to determine what the right thing to do is.

Nick

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

* Re: LaTeX export: inline markup underscore problem
  2011-04-10 20:08   ` Nick Dokos
@ 2011-04-10 20:45     ` Thomas S. Dye
  2011-04-11  1:44       ` Nick Dokos
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas S. Dye @ 2011-04-10 20:45 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Mauro Rovezzi, emacs-orgmode

Aloha Nick,

The code the OP cited passes desc to \cite{}.  The code I pointed to  
passes path to \cite{}.  It does this to get around the problem of  
escaped underscores, if I remember correctly.  In any case, I use this  
code with bibliography keys that include underscores, so it should  
work for the OP.

All the best,
Tom

On Apr 10, 2011, at 10:08 AM, Nick Dokos wrote:

> Thomas S. Dye <tsd@tsdye.com> wrote:
>
>> Aloha Mauro,
>>
>> Please see
>>
>> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-17_2
>>
>
> Excuse the intrusion, but I don't see anything in there that looks  
> like
> a solution to the OP's problem (the undesired quoting of the  
> underscore
> when exporting the org file to LaTeX): what am I missing?
>
> I was going to suggest that life would be much easier for the OP if he
> could change all underscores to some other character in his  
> bibliography
> (I often see colons and minus signs used e.g.) That may or may not be
> possible of course, but if it is possible, it would be the simplest
> solution: the treatment of _ in the LaTeX exporter is often the source
> of frustration. That is not the fault of the exporter of course: TeX
> makes it very complicated to determine what the right thing to do is.
>
> Nick
>
>

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

* Re: LaTeX export: inline markup underscore problem
  2011-04-10 20:45     ` Thomas S. Dye
@ 2011-04-11  1:44       ` Nick Dokos
  2011-04-11  4:52         ` Thomas S. Dye
  2011-04-11 13:55         ` Mauro Rovezzi
  0 siblings, 2 replies; 10+ messages in thread
From: Nick Dokos @ 2011-04-11  1:44 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Mauro Rovezzi, emacs-orgmode, nicholas.dokos

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

> Aloha Nick,
> 
> The code the OP cited passes desc to \cite{}.  The code I pointed to
> passes path to \cite{}.  It does this to get around the problem of
> escaped underscores, if I remember correctly.  In any case, I use this
> code with bibliography keys that include underscores, so it should
> work for the OP.
> 

I still don't quite understand, so obviously I'm missing something
fundamental - but I'll read your tutorial completely first (great
tutorial btw!) and try some things out.

Thanks,
Nick

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

* Re: LaTeX export: inline markup underscore problem
  2011-04-11  1:44       ` Nick Dokos
@ 2011-04-11  4:52         ` Thomas S. Dye
  2011-04-11 13:55         ` Mauro Rovezzi
  1 sibling, 0 replies; 10+ messages in thread
From: Thomas S. Dye @ 2011-04-11  4:52 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: Mauro Rovezzi, emacs-orgmode

Thanks Nick.  Feel free to change the LaTeX export tutorial as you see  
fit.

All the best,
Tom

On Apr 10, 2011, at 3:44 PM, Nick Dokos wrote:

> Thomas S. Dye <tsd@tsdye.com> wrote:
>
>> Aloha Nick,
>>
>> The code the OP cited passes desc to \cite{}.  The code I pointed to
>> passes path to \cite{}.  It does this to get around the problem of
>> escaped underscores, if I remember correctly.  In any case, I use  
>> this
>> code with bibliography keys that include underscores, so it should
>> work for the OP.
>>
>
> I still don't quite understand, so obviously I'm missing something
> fundamental - but I'll read your tutorial completely first (great
> tutorial btw!) and try some things out.
>
> Thanks,
> Nick

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

* Re: LaTeX export: inline markup underscore problem
  2011-04-11  1:44       ` Nick Dokos
  2011-04-11  4:52         ` Thomas S. Dye
@ 2011-04-11 13:55         ` Mauro Rovezzi
  2011-04-11 16:58           ` Thomas S. Dye
  1 sibling, 1 reply; 10+ messages in thread
From: Mauro Rovezzi @ 2011-04-11 13:55 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

On Mon, Apr 11, 2011 at 3:44 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Thomas S. Dye <tsd@tsdye.com> wrote:
>>
>> The code the OP cited passes desc to \cite{}.  The code I pointed to
>> passes path to \cite{}.  It does this to get around the problem of
>> escaped underscores, if I remember correctly.  In any case, I use this
>> code with bibliography keys that include underscores, so it should
>> work for the OP.
>>
>
> I still don't quite understand, so obviously I'm missing something
> fundamental - but I'll read your tutorial completely first (great
> tutorial btw!) and try some things out.

Thomas, I also do not understand your reply, sorry. I have tried to
implement your solution with ebib, but it is not working. Well,
personally I do not use ebib, so it would be more elegant for me do
not depend on it. Anyway, I think I have to invest more time to better
understand this ebib-oriented solution to underscore.

In addition, I also find out that the cross-references
(http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-16)
do not work either when the reference has underscore in it.

Thanks,
Mauro

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

* Re: LaTeX export: inline markup underscore problem
  2011-04-11 13:55         ` Mauro Rovezzi
@ 2011-04-11 16:58           ` Thomas S. Dye
  2011-04-11 18:54             ` Mauro Rovezzi
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas S. Dye @ 2011-04-11 16:58 UTC (permalink / raw)
  To: Mauro Rovezzi; +Cc: nicholas.dokos, emacs-orgmode

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

Aloha Mauro,

On my system I define a citep link:

> #+source: define-citep-link
> #+begin_src emacs-lisp :results silent
>     (org-add-link-type
>      "citep" 'ebib
>      (lambda (path desc format)
>        (cond
>         ((eq format 'html)
>          (format "(<cite>%s</cite>)" path))
>         ((eq format 'latex)
>          (if (or (not desc) (equal 0 (search "citep:" desc)))
>                (format "\\citep{%s}" path)
>                (format "\\citep[%s]{%s}" desc path)
>   )))))
> #+end_src


then the following Org-mode source:

> Hawaiian archaeology's response to the late Roger Green's call for an
> investigation of diachronic settlement patterns
> [[citep:green84:_settl_patter_studies_ocean]] has been slow and  
> difficult.

exports as:

> Hawaiian archaeology's response to the late Roger Green's call for an
> investigation of diachronic settlement patterns
> \citep{green84:_settl_patter_studies_ocean} has been slow and  
> difficult.

Perhaps you could post a minimal example that doesn't work for you?

Note that this solution doesn't depend on ebib.  It is perfectly OK to  
enter the bibliography key by hand if you prefer.

On your other observation: I don't use underscores in headlines, so  
hadn't run across the limitation in the cross references that you  
mention.  I don't know if there is any way around this.  If you do  
find a way, please feel free to add the solution to the LaTeX export  
tutorial.

All the best,
Tom
On Apr 11, 2011, at 3:55 AM, Mauro Rovezzi wrote:

> On Mon, Apr 11, 2011 at 3:44 AM, Nick Dokos <nicholas.dokos@hp.com>  
> wrote:
>> Thomas S. Dye <tsd@tsdye.com> wrote:
>>>
>>> The code the OP cited passes desc to \cite{}.  The code I pointed to
>>> passes path to \cite{}.  It does this to get around the problem of
>>> escaped underscores, if I remember correctly.  In any case, I use  
>>> this
>>> code with bibliography keys that include underscores, so it should
>>> work for the OP.
>>>
>>
>> I still don't quite understand, so obviously I'm missing something
>> fundamental - but I'll read your tutorial completely first (great
>> tutorial btw!) and try some things out.
>
> Thomas, I also do not understand your reply, sorry. I have tried to
> implement your solution with ebib, but it is not working. Well,
> personally I do not use ebib, so it would be more elegant for me do
> not depend on it. Anyway, I think I have to invest more time to better
> understand this ebib-oriented solution to underscore.
>
> In addition, I also find out that the cross-references
> (http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-16)
> do not work either when the reference has underscore in it.
>
> Thanks,
> Mauro


[-- Attachment #2: Type: text/html, Size: 6208 bytes --]

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

* Re: LaTeX export: inline markup underscore problem
  2011-04-11 16:58           ` Thomas S. Dye
@ 2011-04-11 18:54             ` Mauro Rovezzi
  2011-04-12  3:34               ` Thomas S. Dye
  0 siblings, 1 reply; 10+ messages in thread
From: Mauro Rovezzi @ 2011-04-11 18:54 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: nicholas.dokos, emacs-orgmode

Hello Thomas,

On Mon, Apr 11, 2011 at 6:58 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
> Aloha Mauro,
> On my system I define a citep link:
>
> #+source: define-citep-link
> #+begin_src emacs-lisp :results silent
>     (org-add-link-type
>      "citep" 'ebib
>      (lambda (path desc format)
>        (cond
>         ((eq format 'html)
>          (format "(<cite>%s</cite>)" path))
>         ((eq format 'latex)
>          (if (or (not desc) (equal 0 (search "citep:" desc)))
>                (format "\\citep{%s}" path)
>                (format "\\citep[%s]{%s}" desc path)
>   )))))
> #+end_src
>
> then the following Org-mode source:
>
> Hawaiian archaeology's response to the late Roger Green's call for an
> investigation of diachronic settlement patterns
> [[citep:green84:_settl_patter_studies_ocean]] has been slow and difficult.
>
> exports as:
>
> Hawaiian archaeology's response to the late Roger Green's call for an
> investigation of diachronic settlement patterns
> \citep{green84:_settl_patter_studies_ocean} has been slow and difficult.
>
> Perhaps you could post a minimal example that doesn't work for you?
> Note that this solution doesn't depend on ebib.  It is perfectly OK to enter
> the bibliography key by hand if you prefer.

Yes, I did the same but I get different behavior. If I put the same
code in a .org file (the current file where the citation is or the
#+SETUPFILE), the LaTeX export is
\hyperref[citep:green84:_settl_patter_studies_ocean]{citep:green84:_settl_patter_studies_ocean},
while if I put the same in my .emacs, it is exported as
\texttt{cite:green84:_settl_patter_studies_ocean}. This happens in Org
version 6.21b (Ubuntu 10.10 version). while in the last version from
Git it transforms to
\hyperref[citep-green84-_settl_patter_studies_ocean]{citep:green84:_settl\_patter\_studies\_ocean}

Well, something is going weird...

> On your other observation:
> I don't use underscores in headlines, so hadn't run across the limitation in the cross references that you mention.  I don't know if there is any way around this.
>  If you do find a way, please feel free to add the solution to the LaTeX
> export tutorial.

OK, but for this is easier to just change the labels and remove
underscores, so this is definitely a minor point.

Anyway, thanks a lot for your help!
M.

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

* Re: LaTeX export: inline markup underscore problem
  2011-04-11 18:54             ` Mauro Rovezzi
@ 2011-04-12  3:34               ` Thomas S. Dye
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas S. Dye @ 2011-04-12  3:34 UTC (permalink / raw)
  To: Mauro Rovezzi; +Cc: nicholas.dokos, emacs-orgmode

Aloha Mauro,

It appears that the new link type is not defined.  Have you executed  
the source block, define-citep-link?

Also, version 6.21 is probably too old for at least some of the LaTeX  
export.  It is probably not worth the trouble to try to set things up  
for that version of Org-mode.

hth,
Tom

On Apr 11, 2011, at 8:54 AM, Mauro Rovezzi wrote:

> Hello Thomas,
>
> On Mon, Apr 11, 2011 at 6:58 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>> Aloha Mauro,
>> On my system I define a citep link:
>>
>> #+source: define-citep-link
>> #+begin_src emacs-lisp :results silent
>>     (org-add-link-type
>>      "citep" 'ebib
>>      (lambda (path desc format)
>>        (cond
>>         ((eq format 'html)
>>          (format "(<cite>%s</cite>)" path))
>>         ((eq format 'latex)
>>          (if (or (not desc) (equal 0 (search "citep:" desc)))
>>                (format "\\citep{%s}" path)
>>                (format "\\citep[%s]{%s}" desc path)
>>   )))))
>> #+end_src
>>
>> then the following Org-mode source:
>>
>> Hawaiian archaeology's response to the late Roger Green's call for an
>> investigation of diachronic settlement patterns
>> [[citep:green84:_settl_patter_studies_ocean]] has been slow and  
>> difficult.
>>
>> exports as:
>>
>> Hawaiian archaeology's response to the late Roger Green's call for an
>> investigation of diachronic settlement patterns
>> \citep{green84:_settl_patter_studies_ocean} has been slow and  
>> difficult.
>>
>> Perhaps you could post a minimal example that doesn't work for you?
>> Note that this solution doesn't depend on ebib.  It is perfectly OK  
>> to enter
>> the bibliography key by hand if you prefer.
>
> Yes, I did the same but I get different behavior. If I put the same
> code in a .org file (the current file where the citation is or the
> #+SETUPFILE), the LaTeX export is
> \hyperref[citep:green84:_settl_patter_studies_ocean] 
> {citep:green84:_settl_patter_studies_ocean},
> while if I put the same in my .emacs, it is exported as
> \texttt{cite:green84:_settl_patter_studies_ocean}. This happens in Org
> version 6.21b (Ubuntu 10.10 version). while in the last version from
> Git it transforms to
> \hyperref[citep-green84-_settl_patter_studies_ocean] 
> {citep:green84:_settl\_patter\_studies\_ocean}
>
> Well, something is going weird...
>
>> On your other observation:
>> I don't use underscores in headlines, so hadn't run across the  
>> limitation in the cross references that you mention.  I don't know  
>> if there is any way around this.
>>  If you do find a way, please feel free to add the solution to the  
>> LaTeX
>> export tutorial.
>
> OK, but for this is easier to just change the labels and remove
> underscores, so this is definitely a minor point.
>
> Anyway, thanks a lot for your help!
> M.

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

end of thread, other threads:[~2011-04-12  3:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-09 16:55 LaTeX export: inline markup underscore problem Mauro Rovezzi
2011-04-10 19:36 ` Thomas S. Dye
2011-04-10 20:08   ` Nick Dokos
2011-04-10 20:45     ` Thomas S. Dye
2011-04-11  1:44       ` Nick Dokos
2011-04-11  4:52         ` Thomas S. Dye
2011-04-11 13:55         ` Mauro Rovezzi
2011-04-11 16:58           ` Thomas S. Dye
2011-04-11 18:54             ` Mauro Rovezzi
2011-04-12  3:34               ` Thomas S. Dye

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