emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* tabs inserted in code blocks
@ 2014-03-11 20:41 Stephen J. Barr
  2014-03-12  4:21 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen J. Barr @ 2014-03-11 20:41 UTC (permalink / raw)
  To: org mode


Hello,

I have the following code block in an org-mode file:

--------------------------------------------------------------------------------

#+CAPTION: Matlab Dynamic Programming Solution
#+LABEL: code:matlab-outer-loop-reference
#+BEGIN_SRC octave  
  Normal_BuildT = realmax * ones(T, i_max, j_max);
  for i=(1:i_max)
      for j=(1:j_max)
          Normal_BuildT(T,i,j) = compute_cell_final(i,j);
      end
  end
  
  for t=((T-1):-1:1)
      for i=(1:i_max)
          for j=(1:j_max)
             Normal_BuildT(t,i,j) = compute_cell(t,i,j, Normal_BuildT(t+1,:,:));
          end
      end
  end
#+END_SRC 

--------------------------------------------------------------------------------

I am exporting this to LaTeX, which gives me the following code.
See that there are tab characters inserted before the lines with Normal_BuildT. 
This is causing minted to render with these strange ^^I characters. 

--------------------------------------------------------------------------------

\begin{listing}[H]
\begin{minted}[]{octave}
Normal_BuildT = realmax * ones(T, i_max, j_max);
for i=(1:i_max)
    for j=(1:j_max)
	Normal_BuildT(T,i,j) = compute_cell_final(i,j);
    end
end

for t=((T-1):-1:1)
    for i=(1:i_max)
	for j=(1:j_max)
	   Normal_BuildT(t,i,j) = compute_cell(t,i,j, Normal_BuildT(t+1,:,:));
	end
    end
end
\end{minted}
\caption{\label{code:matlab-outer-loop-reference}Matlab Dynamic Programming Solution}
\end{listing}

--------------------------------------------------------------------------------

How do I disable this behavior?

Thanks,
Stephen

-- 
Sent with my mu4e

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

* Re: tabs inserted in code blocks
  2014-03-11 20:41 tabs inserted in code blocks Stephen J. Barr
@ 2014-03-12  4:21 ` Nick Dokos
  2014-03-12 12:30   ` John Hendy
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2014-03-12  4:21 UTC (permalink / raw)
  To: emacs-orgmode

"Stephen J. Barr" <stevejb@uw.edu> writes:

> Hello,
>
> I have the following code block in an org-mode file:
>
> --------------------------------------------------------------------------------
>
> #+CAPTION: Matlab Dynamic Programming Solution
> #+LABEL: code:matlab-outer-loop-reference
> #+BEGIN_SRC octave  
>   Normal_BuildT = realmax * ones(T, i_max, j_max);
>   for i=(1:i_max)
>       for j=(1:j_max)
>           Normal_BuildT(T,i,j) = compute_cell_final(i,j);
>       end
>   end
>   
>   for t=((T-1):-1:1)
>       for i=(1:i_max)
>           for j=(1:j_max)
>              Normal_BuildT(t,i,j) = compute_cell(t,i,j, Normal_BuildT(t+1,:,:));
>           end
>       end
>   end
> #+END_SRC 
>
> --------------------------------------------------------------------------------
>
> I am exporting this to LaTeX, which gives me the following code.
> See that there are tab characters inserted before the lines with Normal_BuildT. 
> This is causing minted to render with these strange ^^I characters. 
>
> --------------------------------------------------------------------------------
>
> \begin{listing}[H]
> \begin{minted}[]{octave}
> Normal_BuildT = realmax * ones(T, i_max, j_max);
> for i=(1:i_max)
>     for j=(1:j_max)
> 	Normal_BuildT(T,i,j) = compute_cell_final(i,j);
>     end
> end
>
> for t=((T-1):-1:1)
>     for i=(1:i_max)
> 	for j=(1:j_max)
> 	   Normal_BuildT(t,i,j) = compute_cell(t,i,j, Normal_BuildT(t+1,:,:));
> 	end
>     end
> end
> \end{minted}
> \caption{\label{code:matlab-outer-loop-reference}Matlab Dynamic Programming Solution}
> \end{listing}
>
> --------------------------------------------------------------------------------
>
> How do I disable this behavior?
>

Untested and not sure it'll work: (setq indent-tabs-mode nil) or perhaps
(setq-default indent-tabs-mode nil) - in the latter case, you might have
to turn it on in specific modes. You will also have to restart emacs.

-- 
Nick

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

* Re: tabs inserted in code blocks
  2014-03-12  4:21 ` Nick Dokos
@ 2014-03-12 12:30   ` John Hendy
  0 siblings, 0 replies; 3+ messages in thread
From: John Hendy @ 2014-03-12 12:30 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2200 bytes --]

On Mar 11, 2014 11:21 PM, "Nick Dokos" <ndokos@gmail.com> wrote:
>
> "Stephen J. Barr" <stevejb@uw.edu> writes:
>
> > Hello,
> >
> > I have the following code block in an org-mode file:
> >
> >
--------------------------------------------------------------------------------
> >
> > #+CAPTION: Matlab Dynamic Programming Solution
> > #+LABEL: code:matlab-outer-loop-reference
> > #+BEGIN_SRC octave
> >   Normal_BuildT = realmax * ones(T, i_max, j_max);
> >   for i=(1:i_max)
> >       for j=(1:j_max)
> >           Normal_BuildT(T,i,j) = compute_cell_final(i,j);
> >       end
> >   end
> >
> >   for t=((T-1):-1:1)
> >       for i=(1:i_max)
> >           for j=(1:j_max)
> >              Normal_BuildT(t,i,j) = compute_cell(t,i,j,
Normal_BuildT(t+1,:,:));
> >           end
> >       end
> >   end
> > #+END_SRC
> >
> >
--------------------------------------------------------------------------------
> >
> > I am exporting this to LaTeX, which gives me the following code.
> > See that there are tab characters inserted before the lines with
Normal_BuildT.
> > This is causing minted to render with these strange ^^I characters.
> >
> >
--------------------------------------------------------------------------------
> >
> > \begin{listing}[H]
> > \begin{minted}[]{octave}
> > Normal_BuildT = realmax * ones(T, i_max, j_max);
> > for i=(1:i_max)
> >     for j=(1:j_max)
> >       Normal_BuildT(T,i,j) = compute_cell_final(i,j);
> >     end
> > end
> >
> > for t=((T-1):-1:1)
> >     for i=(1:i_max)
> >       for j=(1:j_max)
> >          Normal_BuildT(t,i,j) = compute_cell(t,i,j,
Normal_BuildT(t+1,:,:));
> >       end
> >     end
> > end
> > \end{minted}
> > \caption{\label{code:matlab-outer-loop-reference}Matlab Dynamic
Programming Solution}
> > \end{listing}
> >
> >
--------------------------------------------------------------------------------
> >
> > How do I disable this behavior?
> >
>
> Untested and not sure it'll work: (setq indent-tabs-mode nil) or perhaps
> (setq-default indent-tabs-mode nil) - in the latter case, you might have
> to turn it on in specific modes. You will also have to restart emacs.
>

Would org-src-preserve-indentation be relevant?

John

> --
> Nick
>
>

[-- Attachment #2: Type: text/html, Size: 3178 bytes --]

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

end of thread, other threads:[~2014-03-12 12:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-11 20:41 tabs inserted in code blocks Stephen J. Barr
2014-03-12  4:21 ` Nick Dokos
2014-03-12 12:30   ` John Hendy

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