emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Italics + footnote in latex export
@ 2013-06-02  3:15 James Harkins
  2013-06-04  5:56 ` Nick Dokos
  0 siblings, 1 reply; 2+ messages in thread
From: James Harkins @ 2013-06-02  3:15 UTC (permalink / raw)
  To: Emacs-orgmode@gnu.org

I have:

   Western notation supports a type of /polyphony/[fn:1]

I get:

   Western notation supports a type of /polyphony/\footnote{ ... blah blah ... }

Or, I can have:

   Western notation supports a type of /polyphony/ [fn:1]

And then I get:

   \emph{polyphony} \footnote{ ... blah blah ... }

And LaTeX puts a space between the word and the footnote number, which
is poor typesetting.

I also tried writing the \emph{} directly, but then org-export doesn't
recognize the footnote tag: "\emph{polyphony}[fn:1]" appears in the
.tex file.

How do I keep the footnote text in the "* Footnotes" node and get
proper typesetting in the main text?

hjh

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

* Re: Italics + footnote in latex export
  2013-06-02  3:15 Italics + footnote in latex export James Harkins
@ 2013-06-04  5:56 ` Nick Dokos
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Dokos @ 2013-06-04  5:56 UTC (permalink / raw)
  To: emacs-orgmode

James Harkins <jamshark70@gmail.com> writes:

> I have:
>
>    Western notation supports a type of /polyphony/[fn:1]
>
> I get:
>
>    Western notation supports a type of /polyphony/\footnote{ ... blah blah ... }
>

I believe you have to fiddle with org-emphasis-regexp-components. The
default value is

(" 	('\"{" "- 	.,:!?;'\")}\\" " 	
,\"'" "." 1)

Pretty, isn't it? Looks like Perl :-) There are four strings and an
integer in that list, if you squint hard enough and count (unescaped)
double quotes.

The second string in this list (i.e. "- .,:!?;'\")}\\") specifies the
set of characters that are allowed as the "postmatch", and they include
the dash, a space, a tab, a period, a comma, a colon, an exclamation
mark, a question mark, a semicolon, a single quote, a double quote
(escaped as \"), a closing paren, a closing curly brace and a backslash
(which has to be escaped as \\ above). Note that this set does *not*
include the opening square bracket, so [ is not a valid postmatch
character. That's what needs to be done to have the parser recognize
``.../foo/[bar]'' as an italics ``foo''.

So we add it, but one has to be careful: you cannot add it at the
beginning of the string, before the dash. This whole set becomes a
character class in the *real* regexp, org-emph-re, that is used by the
rest of the code and if the dash does not come at the very beginning, it
takes on a special meaning, which we don't want to give it in this
case. So let's add the square bracket at the end of that string:

"- 	.,:!?;'\")}\\["

That should be safe.

BTW, don't cut and paste anything from here: I'm not sure that I've cut
and pasted everything correctly in the first place and additionally
mailers tend to mangle various things in email: this is much too
delicate to withstand even the slightest kind of mangling. Best to copy
the default definition of org-emphasis-regexp-components from org.el
into your .emacs and make the modification there. Make sure that you
restart emacs or reload org after adding the modification: the wheels have to
turn again in order to transform the pieces of
org-emphasis-regexp-components into the real regexp, org-emph-re.

This works (I tested it), but it is rather fiddly, so you have to double
and triple check to make sure that you got things right. Maybe there is
an easier method: if so, I'd appreciate a pointer.

NB: no warranty is offered. If it breaks, you get to pick up the
pieces.
-- 
Nick

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

end of thread, other threads:[~2013-06-04  6:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-02  3:15 Italics + footnote in latex export James Harkins
2013-06-04  5:56 ` Nick Dokos

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