emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to prevent tabs from turning into spaces in source-code export?
@ 2013-05-30 11:19 James Harkins
  2013-05-30 13:22 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: James Harkins @ 2013-05-30 11:19 UTC (permalink / raw)
  To: Emacs-orgmode@gnu.org

I have (where <TAB> is a tab character):

#+BEGIN_SRC {}
// SuperCollider code here

(
r = p.chan.play(Pspawner { |sp|
<TAB>var num, subdiv,
...
});
)
#+END_SRC

The exported .tex file contains:

\begin{lstlisting}
// SuperCollider code here

(
r = p.chan.play(Pspawner { |sp|
<spc><spc><spc><spc><spc><spc><spc><spc>var num, subdiv,
...
});
)
\end{lstlisting}

I do not want this conversion to happen. If it doesn't happen, then I
can use listings' tabsize property to control the tab width.

Failing that, how do I tell org to use fewer than 8 spaces? The tabs
are much much too wide in the resulting pdf.

hjh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to prevent tabs from turning into spaces in source-code export?
  2013-05-30 11:19 How to prevent tabs from turning into spaces in source-code export? James Harkins
@ 2013-05-30 13:22 ` Nicolas Goaziou
  2013-05-30 13:46   ` Andreas Röhler
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2013-05-30 13:22 UTC (permalink / raw)
  To: jamshark70; +Cc: Emacs-orgmode@gnu.org

Hello,

James Harkins <jamshark70@gmail.com> writes:

> I have (where <TAB> is a tab character):
>
> #+BEGIN_SRC {}
> // SuperCollider code here
>
> (
> r = p.chan.play(Pspawner { |sp|
> <TAB>var num, subdiv,
> ...
> });
> )
> #+END_SRC
>
> The exported .tex file contains:
>
> \begin{lstlisting}
> // SuperCollider code here
>
> (
> r = p.chan.play(Pspawner { |sp|
> <spc><spc><spc><spc><spc><spc><spc><spc>var num, subdiv,
> ...
> });
> )
> \end{lstlisting}
>
> I do not want this conversion to happen. If it doesn't happen, then I
> can use listings' tabsize property to control the tab width.

Try to preserve indentation:

  #+begin_src {} -i
  ...
  #+end_src


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to prevent tabs from turning into spaces in source-code export?
  2013-05-30 13:22 ` Nicolas Goaziou
@ 2013-05-30 13:46   ` Andreas Röhler
  2013-05-30 15:24     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Röhler @ 2013-05-30 13:46 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Nicolas Goaziou

Am 30.05.2013 15:22, schrieb Nicolas Goaziou:
> Hello,
>
> James Harkins <jamshark70@gmail.com> writes:
>
>> I have (where <TAB> is a tab character):
>>
>> #+BEGIN_SRC {}
>> // SuperCollider code here
>>
>> (
>> r = p.chan.play(Pspawner { |sp|
>> <TAB>var num, subdiv,
>> ...
>> });
>> )
>> #+END_SRC
>>
>> The exported .tex file contains:
>>
>> \begin{lstlisting}
>> // SuperCollider code here
>>
>> (
>> r = p.chan.play(Pspawner { |sp|
>> <spc><spc><spc><spc><spc><spc><spc><spc>var num, subdiv,
>> ...
>> });
>> )
>> \end{lstlisting}
>>
>> I do not want this conversion to happen. If it doesn't happen, then I
>> can use listings' tabsize property to control the tab width.
>
> Try to preserve indentation:
>
>    #+begin_src {} -i
>    ...
>    #+end_src
>
>
> Regards,
>

Hi Nicolas,

as indentation might be provided by TAB and whitespace chars likewise, what about following setting of `indent-tabs-mode'?

Best,

Andreas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to prevent tabs from turning into spaces in source-code export?
  2013-05-30 13:46   ` Andreas Röhler
@ 2013-05-30 15:24     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2013-05-30 15:24 UTC (permalink / raw)
  To: Andreas Röhler; +Cc: emacs-orgmode

Hello,

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> as indentation might be provided by TAB and whitespace chars likewise,
> what about following setting of `indent-tabs-mode'?

It is indeed possible to propagate `indent-tabs-mode' value to the
original buffer's copy where export happens, but it will not be enough
to guaranty that indentation related TAB characters are preserved (e.g.,
if relative indentation falls below `tab-width' value although global
one was above).

The only way to make sure TAB will be preserved is to set
`org-src-preserve-indentation' to a non-nil value (or, locally, to use
"-i" switch).


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-30 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30 11:19 How to prevent tabs from turning into spaces in source-code export? James Harkins
2013-05-30 13:22 ` Nicolas Goaziou
2013-05-30 13:46   ` Andreas Röhler
2013-05-30 15:24     ` Nicolas Goaziou

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).