From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Randby Subject: Re: Multiple underscores crash org latex export; other exporters survive Date: Tue, 6 Dec 2016 13:18:42 -0500 Message-ID: <501f73ab-1384-a087-1fdc-e3c81ccec1e3@gmail.com> References: <49b70a0c-f81b-660b-e2f5-9921ab488d65@gmail.com> <50e77033-c13c-c0be-5d4a-ec5c107e93ae@gmail.com> <87bmwsatox.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50546) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEKLL-0003RN-Iw for emacs-orgmode@gnu.org; Tue, 06 Dec 2016 13:19:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cEKLG-0001LU-GS for emacs-orgmode@gnu.org; Tue, 06 Dec 2016 13:19:55 -0500 Received: from mail-io0-f169.google.com ([209.85.223.169]:34918) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cEKLG-0001Kc-Ae for emacs-orgmode@gnu.org; Tue, 06 Dec 2016 13:19:50 -0500 Received: by mail-io0-f169.google.com with SMTP id a124so667282061ioe.2 for ; Tue, 06 Dec 2016 10:19:50 -0800 (PST) In-Reply-To: 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" To: Scott Otterson , emacs-orgmode@gnu.org On 12/06/2016 02:19 AM, Scott Otterson wrote: > I understand that orgmode is literally copying Latex; I am suggesting > that orgmode should do more than copy. Org only literally copies some expressions. The expression "A_B_C" is not a LaTeX expression and it cannot be literally copied when exporting to LaTeX. Instead, Org must export "A_B_C" to a LaTeX expression. In this case, Org exports to "A\(_{\text{B}}_{\text{C}}\)" because in LaTeX the underscore character is used for subscripts in mathematical expressions. The exported string is not a valid LaTeX expression because the original string is incomplete. If you don't want Org LaTeX export to export the underscore character to a subscript, the you need to tell Org you want it to do that with additional markup such as "~A_B_C~" or something similar. As someone who relies on Org's LaTeX exporting capability, I would not be in favor of changing how Org exports a non-LaTeX expression containing underscores. > > This is for the reasons I gave: fixing problems export problems for one > export type (usually Latex) breaks it for other export types; new users, > etc. ...). I don't think it is possible to have a markup scheme that enables one to perfectly export every document to every possible format. For instance, LaTeX and HTML were designed to meet very different needs. The intersection of these two markup languages is far from the union of them. Org does a fantastic job of taking care of the intersection, and it also includes wonderful tools that allow users to deal with instances outside of the intersection. I generally avoid exporting an Org file to both LaTeX and HTML (the two export formats I use) unless the file is very basic. It is too much work to make a file that exports to both formats well. But I can't blame Org for that problem. It is the differing natures and purposes of LaTeX and HTML that cause the trouble. I'm not saying that Org export is as good as it can be. Certain aspects of the default LaTeX export could be improved to help new users in my opinion, but I haven't had the time to suggest those improvements. I sympathize with the problems some new users may face when exporting an Org file to various formats. I have friends who moved to Org but had trouble with PDF export because they had no knowledge of LaTeX or understanding of TeX distributions. Installing Emacs was a challenge for some of my friends. The only solution I've been able to devise is to provide as much help as possible and to encourage my friends to subscribe to this mailing list. Scott Randby > > What do you think of those points? > > On Tue, Dec 6, 2016 at 2:33 AM, Scott Randby > wrote: > > On 12/05/2016 03:36 AM, Scott Otterson wrote: > > Yes, there's a general question of how to escape multiple underscores. > > > > But there's a bigger question too: Should an org-doc that runs fine in > > other exporters cause a messy-to-debug crash when it's exported to > > Latex? Is that the Pandoc-like behavior that orgmode seems to be aiming > > for? > > > > I love org-mode. For years, I've used it as a project organizer, > > brainstorming tool, and extremely versatile notekeeper. I've already > > got a big investment in it, so I'll spend the time to track down this > > kind of problem. > > > > But I'd guess that such unexpected Latex crashes have driven new users > > back to Word or whatever. > > I don't think you can blame Org for the crashes you've experienced. Org > exports the string "a_variable_deleteThisAndItWorks" to > "a\(_{\text{variable}}_{\text{deleteThisAndItWorks}}\)" which is not a > valid LaTeX expression. This invalid output is not the fault of Org, it > is the fault of the input string. Since there are different ways of > interpreting "a_variable_deleteThisAndItWorks," you have to tell Org > which interpretation you want it to make when you export to LaTeX. This > means additional markup of the string is required. > > That the exported LaTeX file crashes your installation of pdfTeX (or > whatever TeX engine you use) when you process it is not the fault of > Org. The exported LaTeX file contains an invalid LaTeX expression that > came from a ambiguous string, so pdfTeX shows an error when processing > the LaTeX file. Using additional markup of the string so that Org > exports it as a valid LaTeX expression is the solution to the problem. > > Scott Randby > >