From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Ryland Miller Subject: Org not preserving Python indent levels on LaTex export due to tabs Date: Sat, 1 Feb 2014 17:56:59 -0600 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9kRH-00028p-Am for emacs-orgmode@gnu.org; Sat, 01 Feb 2014 18:57:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W9kRG-0006zy-GJ for emacs-orgmode@gnu.org; Sat, 01 Feb 2014 18:57:31 -0500 Received: from mail-ob0-x22e.google.com ([2607:f8b0:4003:c01::22e]:53529) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9kRG-0006zN-Bb for emacs-orgmode@gnu.org; Sat, 01 Feb 2014 18:57:30 -0500 Received: by mail-ob0-f174.google.com with SMTP id uy5so6468990obc.5 for ; Sat, 01 Feb 2014 15:57:29 -0800 (PST) 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: emacs-orgmode@gnu.org I'm having trouble with getting python source=code blocks to export to LaTeX properly. I've figured out what's going wrong: the exporter is inserting tab characters on lines with 2 or more indentation levels in python. If I use org to export to .tex first, and then untabify the .tex files, the indent levels are preserved (assuming the tabs correctly lined up with the corresponding python in the first place, which many times they don't). Here's a test.org file: * Heading 1 LaTeX export does not work on python src blocks with more than 2 levels of indentation. For example (4 spaces per indent level, not tabs): #+BEGIN_SRC python -n def foo(x): print("Hi: %s" % x) if x == "James": print("James is the best!") else: return x #+END_SRC The above should be indented properly. But it isn't. The resulting .tex file has tabs on the second indent level lines and the tab doesn't even line up with the 4 spaces per tab either. Any ideas how to get rid of this? If I run a =C-x h M-x untabify= on the .tex file, then it exports just fine. But I don't /want/ to do that each and every time I export my org files. Here's the verbatim portion of the generated LaTeX source: #+BEGIN_SRC latex -n \begin{verbatim} 1 def foo(x): 2 print("Hi: %s" % x) 3 if x == "James": 4 print("James is the best!") 5 else: 6 return x \end{verbatim} #+END_SRC Note: lines 4 and 6 in the =\begin{verbatim}= blocks. Line 4 is "4[space][space][tab]print("James...")" How do I get org to export with all spaces and no tabs for verbatims in LaTeX?