From: James Ryland Miller <james.ryland.miller@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Org not preserving Python indent levels on LaTex export due to tabs
Date: Sat, 1 Feb 2014 17:56:59 -0600 [thread overview]
Message-ID: <CADPbT+BU5GTeyvxczEai-zQNWs-sVsAzA+R+oxTcya17kU4KZg@mail.gmail.com> (raw)
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?
next reply other threads:[~2014-02-01 23:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-01 23:56 James Ryland Miller [this message]
2014-02-02 7:49 ` Org not preserving Python indent levels on LaTex export due to tabs Nicolas Goaziou
2014-02-02 17:32 ` James Ryland Miller
2014-02-02 18:05 ` John Hendy
2014-02-03 13:08 ` Sebastien Vauban
2014-02-03 14:56 ` Bastien
2014-02-14 0:32 ` Samuel Wales
2014-02-16 10:11 ` Nicolas Goaziou
2014-03-15 6:43 ` Bastien
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=CADPbT+BU5GTeyvxczEai-zQNWs-sVsAzA+R+oxTcya17kU4KZg@mail.gmail.com \
--to=james.ryland.miller@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).