From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: LaTeX export: underscores and the syntax package Date: Fri, 13 May 2011 23:50:57 -0400 Message-ID: <17549.1305345057@alphaville.dokosmarshall.org> References: <15300C6C-1B46-42B5-89D5-E38BEF0EE371@agfa.com> <97BE4DB8-21C0-4B5F-90A7-EF6ADB173782@comcast.net> Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QL5so-0003G2-21 for emacs-orgmode@gnu.org; Fri, 13 May 2011 23:51:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QL5sm-0005B0-Tw for emacs-orgmode@gnu.org; Fri, 13 May 2011 23:51:14 -0400 Received: from vms173003pub.verizon.net ([206.46.173.3]:60612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QL5sm-0005At-Lq for emacs-orgmode@gnu.org; Fri, 13 May 2011 23:51:12 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LL600GIB2OXOGV0@vms173003.mailsrvcs.net> for emacs-orgmode@gnu.org; Fri, 13 May 2011 22:51:10 -0500 (CDT) In-reply-to: Message from Robert Love of "Fri\, 13 May 2011 21\:51\:59 CDT." <97BE4DB8-21C0-4B5F-90A7-EF6ADB173782@comcast.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Robert Love Cc: nicholas.dokos@hp.com, emacs-orgmode mailing list Robert Love wrote: > And I find the same problem with export to HTML. I have many variables a= nd paths that have underscores in them. The underscores all are shown as s= ubscripts. I don't want to have to go thru all my org files and escape th= e underscore.=20=20 >=20 > How do I make the underscore be a subscript only in math mode? >=20 >=20 > On May 12, 2011, at 9:00 AM, peter.frings@agfa.com wrote: >=20 > > Good afternoon all, > >=20 > > I spent the best part of the afternoon trying to figure out why an org-= generated .tex file wouldn=E2=80=99t compile with my set-up. It turns out t= hat the `syntax=E2=80=99 package messes a bit with the definition of an und= erscore, making it impossible to use the underscore in a \label. > >=20 > > Unfortunately, the LaTeX exporter uses underscores in its section label= s. > >=20 I'm really replying to Peter here, not to Robert, but I cannot find Peter's original mail. You can change the underscore to e.g. a hyphen and get ,---- | \subsubsection{Experiment 1} | \label{sec-1-1-1} `---- in the LaTeX output, by changing it in org-exp.el around line 1300 (I don't want this to end up on patchwork, so I am trying to camouflage it by boxquoting it - I hope that works for hiding the patch from patchwork and also gives you enough context to make the change if you so desire): ,---- | diff --git a/lisp/org-exp.el b/lisp/org-exp.el | index cda1f98..ac07c68 100644 | --- a/lisp/org-exp.el | +++ b/lisp/org-exp.el | @@ -1298,7 +1298,7 @@ Also find all ID and CUSTOM_ID properties and store= them." | (org-outline-level)))) | (setq target (org-solidify-link-text | (format "sec-%s" (replace-regexp-in-string | - "\\." "_" | + "\\." "-" | (org-section-number level))))) | (setq last-section-target target) | (push (cons target target) target-alist) `---- What I don't know is if this change will break something, either in the LaTeX exporter or in the other exporters. So you might test it and report any problems and if there are no problems, maybe you can suggest it as a permanent fix. In my limited experimentation, exporting a simple org file to latex/pdf, text and html, I did not observe any problems, but that does not mean that they don't exist. Nick > >=20 > > Actually, it is possible to have the _ in \label: use the `nounderscore= =E2=80=99 option with the syntax package. But you then do not get the tweak= ed underscore in plain text (unless you use \_ again). > >=20 > > Since I=E2=80=99d like to keep the syntax package and the ease of using= plain underscores, I=E2=80=99d like to avoid the _ in labels.=20 > >=20 > > Maybe I didn=E2=80=99t look hard enough, but I didn=E2=80=99t find an o= bvious way to change the way org generates the labels. Would it be an optio= n to use the same label-generating code as AUCTeX mode? That would be very = nice! > >=20 > >=20 > > Thanks, > > Peter. > > --=20 > > c++; // this makes c bigger but returns the old value > >=20 > >=20 >=20 >=20