emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* A few quirks of org's Latex passthrough
@ 2009-04-16 11:18 Scot Becker
  2009-04-16 12:22 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Scot Becker @ 2009-04-16 11:18 UTC (permalink / raw)
  To: Org-mode ml

Prompted by Chris Gray's request for org markup in Latex environment,
I thought I'd submit a note (for his sake and others') about a few
quirks of org-latex-export's handling of embedded Latex markup in org
documents.  I have been puzzling with these for a while but only
discovered the problem triggers (and workarounds) this morning just
before Chris' mail arrived.  These are both about inline Latex
commands:

I use a few custom commands \mycommand{like this}, and occasionally
have to invoke the odd bit of standard LaTeX markup, for example /when
\textbf{embedding bold text} inside italics/.  For the most part,
these work fine, but I've discovered the following two 'gotchas' that
happen when exporting to LaTeX.

1.  Inline Latex commands get their final curly brace escaped with a
slash (and therefore don't work) if they spill over into another
line, i.e. if they contain one or more newlines.   This is true also
for standard LaTeX commands like \textbf{} and \emph{}.

----------------SAMPLE------------------------
\mycommand{So, for example this
wrapped setence gets a slash added just after the
final period and before the curly brace.}  Org is quite helpfully
escaping the slash for LaTeX, apparently.

\mycommand{no trouble if it's all on one line}
------------------END-------------------------

The workaround of putting all such commands on one line is no hardship
for me, since I use visual-line-mode in Emacs 23 and keep my
paragraphs as single logical lines.  It might be harder for those
accustomed to hard-wrapping their paragraphs.


2.  If you have two inline Latex commands on the same logical line,
org's latex export doesn't treat the text between them in its usual
manner.  Italics get processed, but not the latexification of quotes.
("this" --> ``this'') For example:

----------------SAMPLE------------------------
I have a short custom command to tell Latex to invoke a
Hebrew-language right-to-left environment when I want to refer to a
Hebrew phrase like this: \heb{phrase here}.  But then if I "quote
something,"  and follow that by another \heb{phrase}, the inner
quotation marks don't get processed.  Oddly enough, this problem is
only triggered when there is an inline Latex command both before and
after the  quoted material on the same logical line.

Now if you put a footnote in between those two inline Latex commands,
the output is really nutty:

And \heb{phrase here} with a footnote[fn:: Footnote here.]  I'm not
sure what funky org commands get invoked, but again, only when
bookended by an inline Latex command like \heb{phrase here}.
------------------END-------------------------

The nutty output is a number in square brackets like this[1], with the
following at the bottom of the document:

\$\^{}{1}\$ Footnote here.

This has a the opposite work-around:  break the lines so those
elements are not all on the same logical line. Put in a few newlines.
Latex, of course doesn't care.  Do take care not to start a newline
with the org-footnote, like this
[fn:: Org doesn't parse a footnote command which starts on its own line.]


This is just "for what it's worth" to those who use org-mode as a
front-end to writing for LaTeX.

Scot

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

* Re: A few quirks of org's Latex passthrough
  2009-04-16 11:18 A few quirks of org's Latex passthrough Scot Becker
@ 2009-04-16 12:22 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-04-16 12:22 UTC (permalink / raw)
  To: Scot Becker; +Cc: Org-mode ml

Hi Scot,

I believe these problems are now fixed - at least when trying your  
examples,
the version I just pushed behaves correctly.

- Carsten

On Apr 16, 2009, at 1:18 PM, Scot Becker wrote:

> Prompted by Chris Gray's request for org markup in Latex environment,
> I thought I'd submit a note (for his sake and others') about a few
> quirks of org-latex-export's handling of embedded Latex markup in org
> documents.  I have been puzzling with these for a while but only
> discovered the problem triggers (and workarounds) this morning just
> before Chris' mail arrived.  These are both about inline Latex
> commands:
>
> I use a few custom commands \mycommand{like this}, and occasionally
> have to invoke the odd bit of standard LaTeX markup, for example /when
> \textbf{embedding bold text} inside italics/.  For the most part,
> these work fine, but I've discovered the following two 'gotchas' that
> happen when exporting to LaTeX.
>
> 1.  Inline Latex commands get their final curly brace escaped with a
> slash (and therefore don't work) if they spill over into another
> line, i.e. if they contain one or more newlines.   This is true also
> for standard LaTeX commands like \textbf{} and \emph{}.
>
> ----------------SAMPLE------------------------
> \mycommand{So, for example this
> wrapped setence gets a slash added just after the
> final period and before the curly brace.}  Org is quite helpfully
> escaping the slash for LaTeX, apparently.
>
> \mycommand{no trouble if it's all on one line}
> ------------------END-------------------------
>
> The workaround of putting all such commands on one line is no hardship
> for me, since I use visual-line-mode in Emacs 23 and keep my
> paragraphs as single logical lines.  It might be harder for those
> accustomed to hard-wrapping their paragraphs.
>
>
> 2.  If you have two inline Latex commands on the same logical line,
> org's latex export doesn't treat the text between them in its usual
> manner.  Italics get processed, but not the latexification of quotes.
> ("this" --> ``this'') For example:
>
> ----------------SAMPLE------------------------
> I have a short custom command to tell Latex to invoke a
> Hebrew-language right-to-left environment when I want to refer to a
> Hebrew phrase like this: \heb{phrase here}.  But then if I "quote
> something,"  and follow that by another \heb{phrase}, the inner
> quotation marks don't get processed.  Oddly enough, this problem is
> only triggered when there is an inline Latex command both before and
> after the  quoted material on the same logical line.
>
> Now if you put a footnote in between those two inline Latex commands,
> the output is really nutty:
>
> And \heb{phrase here} with a footnote[fn:: Footnote here.]  I'm not
> sure what funky org commands get invoked, but again, only when
> bookended by an inline Latex command like \heb{phrase here}.
> ------------------END-------------------------
>
> The nutty output is a number in square brackets like this[1], with the
> following at the bottom of the document:
>
> \$\^{}{1}\$ Footnote here.
>
> This has a the opposite work-around:  break the lines so those
> elements are not all on the same logical line. Put in a few newlines.
> Latex, of course doesn't care.  Do take care not to start a newline
> with the org-footnote, like this
> [fn:: Org doesn't parse a footnote command which starts on its own  
> line.]
>
>
> This is just "for what it's worth" to those who use org-mode as a
> front-end to writing for LaTeX.
>
> Scot
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 2+ messages in thread

end of thread, other threads:[~2009-04-16 12:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-16 11:18 A few quirks of org's Latex passthrough Scot Becker
2009-04-16 12:22 ` 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).