emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Italics + footnote in latex export
Date: Tue, 04 Jun 2013 01:56:01 -0400	[thread overview]
Message-ID: <87hahepgge.fsf@pierrot.dokosmarshall.org> (raw)
In-Reply-To: CAFniQ7XUUyJ-Tr9iNW439nACCEY0_kOHWuVB5vczgXOC66jnWA@mail.gmail.com

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

      reply	other threads:[~2013-06-04  6:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-02  3:15 Italics + footnote in latex export James Harkins
2013-06-04  5:56 ` Nick Dokos [this message]

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=87hahepgge.fsf@pierrot.dokosmarshall.org \
    --to=ndokos@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).