Dear Eric,

thanks for your quick answer. However this does not solve the problem.
I use source code fontification for source blocks in org mode:

#+begin_src emacs-lisp
  (setq org-src-fontify-natively  t)
  (setq org-src-tab-acts-natively t)
#+end_src


Normally, when I program in C or java, I disable indent-tabs mode. So, I have this hook

 (add-hook 'java-mode-hook (lambda ()
                              (setq c-basic-offset 4
                                    tab-width 4
                                    indent-tabs-mode nil)))

somewhere in my init file.

If I understand well what "org-src-fontify-natively" means, it should call the hook when I edit a code block whose language is Java, and this should in turn set the variable to nil. In fact, no tab is ever inserted anywhere in my org file, and the value od "indent-tabs-mode" at the buffer local level is nil, exactly as in your case. I have no idea if it can be set to nil at the global level (the documentation seems to say that it is not possible).

Summarising

    no tab in the org file, --> a tab appears in the tex file

Thanks anyway.

Giuseppe Lipari




2015-01-11 19:01 GMT+01:00 Eric S Fraga <e.fraga@ucl.ac.uk>:
On Sunday, 11 Jan 2015 at 17:31, Giuseppe Lipari wrote:

[...]

> There is not tab in this snipper (I never use tabs in code, only spaces).
> Unfortunately, when opening the tex file, I see that a tab has been
> introduced whenever 8 consecutive spaces are found, in particular at line 4.

Shot in the dark: are tabs inserted when code is auto-indented?  If so,
maybe:

,----[ C-h v indent-tabs-mode RET ]
| indent-tabs-mode is a variable defined in `C source code'.
| Its value is nil
| Original value was t
| Local in buffer *unsent wide reply to Giuseppe Lipari*; global value is the same.
|
|   Automatically becomes buffer-local when set.
|   This variable is safe as a file local variable if its value
|   satisfies the predicate `booleanp'.
|
| Documentation:
| Indentation can insert tabs if this is non-nil.
|
| You can customize this variable.
|
`----

--
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org release_8.3beta-703-gef523b.dirty



--
Giuseppe Lipari
LIFL
Université de Lille 1
blogs: http://scacciamennule.blogspot.com  (Italian)
          http://okpanico,wordpress.com          (Italian)
          http://algoland.wordpress.com           (English)